summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Implement MBUF_STRESS_TEST mark II.silby2003-09-011-0/+84
| | | | | | | | | | | | | | | | | | | Changes from the original implementation: - Fragmentation is handled by the function m_fragment, which can be called from whereever fragmentation is needed. Note that this function is wrapped in #ifdef MBUF_STRESS_TEST to discourage non-testing use. - m_fragment works slightly differently from the old fragmentation code in that it allocates a seperate mbuf cluster for each fragment. This defeats dma_map_load_mbuf/buffer's feature of coalescing adjacent fragments. While that is a nice feature in practice, it nerfed the usefulness of mbuf_stress_test. - Add two modes of random fragmentation. Chains with fragments all of the same random length and chains with fragments that are each uniquely random in length may now be requested.
* o interlock domain list when adding domainssam2003-09-011-8/+9
| | | | | | | | | | | | | | | o remove irrlevant spl Notes: 1. We don't lock domain list traversals as this is safe until we start removing domains. 2. The calculation of max_datalen in net_init_domain appears safe as noone depends on max_hdr and max_datalen having consistent values. 3. Giant is still held for fast and slow timeouts; this must stay until each timeout routine is properly locked (coming soon). Sponsored by: FreeBSD Fondation
* - Define a new flag for getblk(): GB_NOCREAT. This flag causes getblk() tojeff2003-08-311-0/+8
| | | | | | | bail out if the buffer is not already present. - The buffer returned by incore() is not locked and should not be sent to brelse(). Use getblk() with the new GB_NOCREAT flag to preserve the desired semantics.
* - If there is no vp assume that BKGRDINPROG is not set and set RELPBUF injeff2003-08-311-1/+2
| | | | brelse().
* - In some cases bp->b_vp can be NULL in brelse, don't try to lock thejeff2003-08-311-4/+6
| | | | | | interlock in that case. Found by: alc
* Migrate the sf_buf allocator that is used by sendfile(2) and zero-copyalc2003-08-291-99/+0
| | | | | | | | | | | sockets into machine-dependent files. The rationale for this migration is illustrated by the modified amd64 allocator. It uses the amd64's direct map to avoid emphemeral mappings in the kernel's address space. On an SMP, the emphemeral mappings result in an IPI for TLB shootdown for each transmitted page. Yuck. Maintainers of other 64-bit platforms with direct maps should be able to use the amd64 allocator as a reference implementation.
* In bufdone(), change the format specifier for m->valid and m->dirty tomarcel2003-08-281-2/+3
| | | | | a long type and explicitly cast m->valid and m->dirty to unsigned long. When PAGE_SIZE is 32K, these fields are in fact unsigned long.
* Do not return with vnode interlock held.kan2003-08-281-0/+2
| | | | Reviewed by: rwatson
* - Move BX_BKGRDWAIT and BX_BKGRDINPROG to BV_ and the b_vflags field.jeff2003-08-282-80/+89
| | | | | | | | | | | | | | | | | | - Surround all accesses of the BKGRD{WAIT,INPROG} flags with the vnode interlock. - Don't use the B_LOCKED flag and QUEUE_LOCKED for background write buffers. Check for the BKGRDINPROG flag before recycling or throwing away a buffer. We do this instead because it is not safe for us to move the original buffer to a new queue from the callback on the background write buffer. - Remove the B_LOCKED flag and the locked buffer queue. They are no longer used. - The vnode interlock is used around checks for BKGRDINPROG where it may not be strictly necessary. If we hold the buf lock the a back-ground write will not be started without our knowledge, one may only be completed while we're not looking. Rather than remove the code, Document two of the places where this extra locking is done. A pass should be done to verify and minimize the locking later.
* Fix a mac_policy_list reference to be a mac_static_policy_listrwatson2003-08-261-1/+1
| | | | | | | | reference: this fixes mac_syscall() for static policies when using optimized locking. Obtained from: TrustedBSD Project Sponosred by: DARPA, Network Associates Laboratories
* Let SA process work under ULE scheduler, originally it would panic kernel.davidxu2003-08-263-24/+49
| | | | Reviewed by: jeff
* Hold the page queues lock when performing vm_page_clear_dirty() andalc2003-08-231-0/+2
| | | | vm_page_set_invalid().
* Fix a logic error in osethostid() that was introduced in rev. 1.34:tjr2003-08-231-3/+4
| | | | | allow hostid to be set when suser() returns 0, not when it returns an error. This would have allowed non-root users to set the host ID.
* On ia64 time_t is 64 bit. Explicitly cast tv_sec to long and changemarcel2003-08-231-2/+2
| | | | | | | the corresponding format specifier to %ld in a call to printf() in function softclock(). The printf() is conditional upon DIAGNOSTIC. Found by: LINT
* Introduce two new MAC Framework and MAC policy entry points:rwatson2003-08-211-0/+19
| | | | | | | | | | | | | | mac_reflect_mbuf_icmp() mac_reflect_mbuf_tcp() These entry points permit MAC policies to do "update in place" changes to the labels on ICMP and TCP mbuf headers when an ICMP or TCP response is generated to a packet outside of the context of an existing socket. For example, in respond to a ping or a RST packet to a SYN on a closed port. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Change description of kern.osreldate from "Operating system release date" toeivind2003-08-211-1/+5
| | | | "Kernel release date" - userland version is in /usr/include/osreldate.h
* Add mac_check_vnode_deleteextattr() and mac_check_vnode_listextattr():rwatson2003-08-213-8/+38
| | | | | | | | | | | explicit access control checks to delete and list extended attributes on a vnode, rather than implicitly combining with the setextattr and getextattr checks. This reflects EA API changes in the kernel made recently, including the move to explicit VOP's for both of these operations. Obtained from: TrustedBSD PRoject Sponsored by: DARPA, Network Associates Laboratories
* Remove about 40 lines of #ifdef/#endif by using new macrosrwatson2003-08-201-70/+31
| | | | | | | | | MAC_DEBUG_COUNTER_INC() and MAC_DEBUG_COUNTER_DEC() to maintain debugging counter values rather than #ifdef'ing the atomic operations to MAC_DEBUG. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* bde made a number of suggested improvements to the code. This commitimp2003-08-201-20/+17
| | | | | | | | | | represents the pruely stylistic changes and should have no net impact on the rest of the code. bde's more substantive changes will follow in a separate commit once we've come to closure on them. Submitted by: bde
* Fix an extreme edge case in leap second handling. We need to callimp2003-08-201-4/+6
| | | | | | | | | | | ntp_update_second twice when we have a large step in case that step goes across a scheduled leap second. The only way this could happen would be if we didn't call tc_windup over the end of day on the day of a leap second, which would only happen if timeouts were delayed for seconds. While it is an edge case, it is an important one to get right for my employer. Sponsored by: Timing Solutions Corporation
* Change instances of callout_init that specify MPSAFE behaviour tosam2003-08-197-8/+8
| | | | | use CALLOUT_MPSAFE instead of "1" for the second parameter. This does not change the behaviour; it just makes the intent more clear.
* It is not an error to have no devices in the kernel: Return thephk2003-08-171-4/+4
| | | | generation number and start it from one instead of zero.
* Use constants less throughout the code and instead use the objsizebmilekic2003-08-161-6/+6
| | | | | | | variable. This makes changing the size of an mbuf or cluster for testing/debugging/whatever purposes easier. Submitted by: sam
* Further cleanup <machine/cpu.h> and <machine/md_var.h>: move the MImarcel2003-08-161-1/+1
| | | | | | | | | | | | | | | | | | | prototypes of cpu_halt(), cpu_reset() and swi_vm() from md_var.h to cpu.h. This affects db_command.c and kern_shutdown.c. ia64: move all MD prototypes from cpu.h to md_var.h. This affects madt.c, interrupt.c and mp_machdep.c. Remove is_physical_memory(). It's not used (vm_machdep.c). alpha: the MD prototypes have been left in cpu.h with a comment that they should be there. Moving them is left for later. It was expected that the impact would be significant enough to be done in a seperate commit. powerpc: MD prototypes left in cpu.h. Comment added. Suggested by: bde Tested with: make universe (pc98 incomplete)
* Give timecounters a numeric quality field.phk2003-08-161-8/+35
| | | | | | | | | | | | | | | | A timecounter will be selected when registered if its quality is not negative and no less than the current timecounters. Add a sysctl to report all available timecounters and their qualities. Give the dummy timecounter a solid negative quality of minus a million. Give the i8254 zero and the ACPI 1000. The TSC gets 800, unless APM or SMP forces it negative. Other timecounters default to zero quality and thereby retain current selection behaviour.
* - Various style fixes in both code and comments.jhb2003-08-153-66/+75
| | | | | | | | | - Update some stale comments. - Sort a couple of includes. - Only set 'newcpu' in updatepri() if we use it. - No functional changes. Obtained from: bde (via an old diff I got a long time ago)
* Add or finish support for machine dependent ptrace requests. When wemarcel2003-08-151-22/+13
| | | | | | | | | | | | | | | | | check for permissions, do it for all requests, not the known requests. Later when we actually service the request we deal with the invalid requests we previously caught earlier. This commit changes the behaviour of the ptrace(2) interface for boundary cases such as an unknown request without proper permissions. Previously we would return EINVAL. Now we return EBUSY or EPERM. Platforms need to define __HAVE_PTRACE_MACHDEP when they have MD requests. This makes the prototype of cpu_ptrace() visible and introduces a call to this function for all requests greater or equal to PT_FIRSTMACH. Silence on: audit
* if we got this far, we definately don't have an EBADF. Return a morejmg2003-08-151-1/+1
| | | | | | | sane result of EPIPE. Reported by: nCircle dev team MFC after: 3 day
* add a read-only sysctl to display the number of entries in the fixed sizecg2003-08-141-5/+9
| | | | | | | | | kobj global method table; also kassert that the table has not overflowed when defining a new method. there are indications that the table is being overflowed in certain situations as we gain more kobj consumers- this will allow us to check whether kobj is at fault. symptoms would be incorrect methods being called.
* Update powerpc to use the (old thread,new thread) calling conventiongrehan2003-08-144-18/+0
| | | | for cpu_throw() and cpu_switch().
* - The vm_object pointer in pipe_buffer is unused. Remove it.alc2003-08-131-5/+2
| | | | | - Check for successful initialization of pipe_zone in pipeinit() rather than every call to pipe(2).
* Expand inline the relevant parts of src/COPYRIGHT for Matt Dillon'simp2003-08-121-3/+26
| | | | | | copyrighted files. Approved by: Matt Dillon
* Remove extra space.mux2003-08-121-1/+1
|
* - Convert Alpha over to the new calling conventions for cpu_throw() andjhb2003-08-124-5/+5
| | | | | | | | cpu_switch() where both the old and new threads are passed in as arguments. Only powerpc uses the old conventions now. - Update comments in the Alpha swtch.s to reflect KSE changes. Tested by: obrien, marcel
* Pipespace() no longer requires Giant.alc2003-08-111-2/+2
|
* Drop Giant in recvit before returning an error to the caller to avoidkan2003-08-111-1/+4
| | | | leaking the Giant on the syscall exit.
* Add the mlockall() and munlockall() system calls.bms2003-08-112-2/+2
| | | | | | | | | | | | | | | | | | | | | | | - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall() was disabled, which would prevent applications from linking to this API (suggested by mux) - Giant has been quoshed. It is no longer held by the code, as the required locking has been pushed down within vm_map.c. - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES to express their intention explicitly. - Inspected at the vmstat, top and vm pager sysctl stats level. Paging-in activity is occurring correctly, using a test harness. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to mappings of the same shared library page being wired twice. Further exploration is needed. - Believed to back out of allocations and locks correctly (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC). PR: kern/43426, standards/54223 Reviewed by: jake, alc Approved by: jake (mentor) MFC after: 2 weeks
* More pipe changes:silby2003-08-112-48/+34
| | | | | | | | | | | | | | From alc: Move pageable pipe memory to a seperate kernel submap to avoid awkward vm map interlocking issues. (Bad explanation provided by me.) From me: Rework pipespace accounting code to handle this new layout, and adjust our default values to account for the fact that we now have a solid limit on allocations. Also, remove the "maxpipes" limit, as it no longer has a purpose. (The limit on kva usage solves the problem of having two many pipes.)
* Use vm_page_hold() instead of vm_page_wire(). Otherwise, a multithreadedalc2003-08-111-3/+3
| | | | | | | | | | application could cause a wired page to be freed. In general, vm_page_hold() should be preferred for ephemeral kernel mappings of pages borrowed from a user-level address space. (vm_page_wire() should really be reserved for indefinite duration pinning by the "owner" of the page.) Discussed with: silby Submitted by: tegge
* panic() if we try to handle an out-of-range signal number innectar2003-08-101-2/+5
| | | | | | | | psignal()/tdsignal(). The test was historically in psignal(). It was changed into a KASSERT, and then later moved to tdsignal() when the latter was introduced. Reviewed by: iedowse, jhb
* Add or correct range checking of signal numbers in system calls andnectar2003-08-101-2/+2
| | | | | | | | | ioctls. In the particular case of ptrace(), this commit more-or-less reverts revision 1.53 of sys_process.c, which appears to have been erroneous. Reviewed by: iedowse, jhb
* Background: When proc_rwmem() wired and mapped a page, it also addedalc2003-08-091-30/+5
| | | | | | | | | | | | | | | | a reference to the containing object. The purpose of the reference being to prevent the destruction of the object and an attempt to free the wired page. (Wired pages can't be freed.) Unfortunately, this approach does not work. Some operations, like fork(2) that call vm_object_split(), can move the wired page to a difference object, thereby making the reference pointless and opening the possibility of the wired page being freed. A solution is to use vm_page_hold() in place of vm_page_wire(). Held pages can be freed. They are moved to a special hold queue until the hold is released. Submitted by: tegge
* - Remove GIANT_REQUIRED from pipespace().alc2003-08-081-4/+0
| | | | - Remove a duplicate initialization from pipe_create().
* Copyin the thread mailbox flags from the correct locationdeischen2003-08-082-2/+2
| | | | in the mailbox.
* td_dupfd just needs to be less than 0, it does not have to hold thejhb2003-08-072-2/+2
| | | | negative value of the index of the new file, so just use -1.
* Update some argument-documenting comments to match reality.nectar2003-08-073-6/+9
| | | | | Add an explicit range check to those same arguments to reduce risk of cardiac arrest in future code readers.
* Consistently use the BSD u_int and u_short instead of the SYSV uint andjhb2003-08-075-15/+15
| | | | | | | ushort. In most of these files, there was a mixture of both styles and this change just makes them self-consistent. Requested by: bde (kern_ktrace.c)
* The ktrace mutex does not need to be locked around the post of the ktracejhb2003-08-071-1/+1
| | | | | | | semaphore and doing so can lead to a possible reversal. WITNESS would have caught this if semaphores were used more often in the kernel. Submitted by: Ted Unangst <tedu@stanford.edu>, Dawson Engler
* - Remove GIANT_REQUIRED from pipe_free_kmem().alc2003-08-071-3/+0
| | | | | - Remove the acquisition and release of Giant around pipe_kmem_free() and uma_zfree() in pipeclose().
* If connect(2) has been interrupted by a signal and therefore theyar2003-08-061-3/+8
| | | | | | | | | | | | | | connection is to be established asynchronously, behave as in the case of non-blocking mode: - keep the SS_ISCONNECTING bit set thus indicating that the connection establishment is in progress, which is the case (clearing the bit in this case was just a bug); - return EALREADY, instead of the confusing and unreasonable EADDRINUSE, upon further connect(2) attempts on this socket until the connection is established (this also brings our connect(2) into accord with IEEE Std 1003.1.)
OpenPOWER on IntegriCloud