summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Push down Giant into fdfree() and remove it from two of the callers.jhb2005-11-013-13/+24
| | | | | | | Other callers such as some rfork() cases weren't locking Giant anyway. Reviewed by: csjp MFC after: 1 week
* Reuse ktr_unused field in ktr_header structure as ktr_tid; populaterwatson2005-11-011-1/+1
| | | | | | | | | ktr_tid as part of gathering of ktr header data for new ktrace records. The continued use of intptr_t is required for file layout reasons, and cannot be changed to lwpid_t at this point. MFC after: 1 month Reviewed by: davidxu
* Replace ktr_buffer pointer in struct ktr_header with a ktr_unusedrwatson2005-11-011-9/+11
| | | | | | | | | | | | | intptr_t. The buffer length needs to be written to disk as part of the trace log, but the kernel pointer for the buffer does not. Add a new ktr_buffer pointer to the kernel-only ktrace request structure to hold that pointer. This frees up an integer in the ktrace record format that can be used to hold the threadid, although older ktrace files will have a garbage ktr_buffer field (or more accurately, a kernel pointer value). MFC after: 2 weeks Space requested by: davidxu
* Reformat socket control messages on input/output for 32bit compatibilityps2005-10-311-5/+14
| | | | | | | on 64bit systems. Submitted by: ps, ups Reviewed by: jhb
* Check to see if the hash table is present in link_elf_lookup_symbol()jhb2005-10-311-0/+6
| | | | | | | | | | before dereferencing it. Certain corrupt kernel modules might not have a valid hash table, and would cause a kernel panic when they were loaded. Instead of panic'ing, the kernel now prints out a warning that it is missing the symbol hash table. Tested by: Benjamin Close Benjamin dot Close at clearchain dot com MFC after: 1 week
* Normalize a significant number of kernel malloc type names:rwatson2005-10-319-9/+10
| | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
* Push the assignment of a new or updated so_qlimit from solisten()rwatson2005-10-304-22/+15
| | | | | | | | | | | | | | following the protocol pru_listen() call to solisten_proto(), so that it occurs under the socket lock acquisition that also sets SO_ACCEPTCONN. This requires passing the new backlog parameter to the protocol, which also allows the protocol to be aware of changes in queue limit should it wish to do something about the new queue limit. This continues a move towards the socket layer acting as a library for the protocol. Bump __FreeBSD_version due to a change in the in-kernel protocol interface. This change has been tested with IPv4 and UNIX domain sockets, but not other protocols.
* Let itimer store itimerspec instead of itimerval, so I don't have todavidxu2005-10-302-60/+123
| | | | | | | | | | | | | | | | | | | convert to or from timeval frequently. Introduce function itimer_accept() to ack a timer signal in signal acceptance code, this allows us to return more fresh overrun counter than at signal generating time. while POSIX says: "the value returned by timer_getoverrun() shall apply to the most recent expiration signal delivery or acceptance for the timer,.." I prefer returning it at acceptance time. Introduce SIGEV_THREAD_ID notification mode, it is used by thread libary to request kernel to deliver signal to a specified thread, and in turn, the thread library may use the mechanism to implement SIGEV_THREAD which is required by POSIX. Timer signal is managed by timer code, so it can not fail even if signal queue is full filled by sigqueue syscall.
* Regen.davidxu2005-10-302-14/+14
|
* Fix sigevent's POSIX incompatible problem by adding member fieldsdavidxu2005-10-302-17/+73
| | | | | | | sigev_notify_function and sigev_notify_attributes. AIO syscalls use sigevent, so they have to be adjusted. Reviewed by: alc
* In watchdog_config enable the software watchdog iff the WD_ACTIVE flag isemaste2005-10-271-2/+1
| | | | | | | | | set. When watchdogd(1) is terminated intentionally it clears the bit, which should then disable it in the kernel. PR: kern/74386 Submitted by: Alex Hoff <ahoff at sandvine dot com> Approved by: phk, rwatson (mentor)
* Revert most of revision 1.235 and fix the problem a different way. Wejhb2005-10-271-7/+12
| | | | | | | | | | | | | | | | | | can't acquire an sx lock in ttyinfo() because ttyinfo() can be called from interrupt handlers (such as atkbd_intr()). Instead, go back to locking the process group while we pick a thread to display information for and hold that lock until after we drop sched_lock to make sure the process doesn't exit out from under us. sched_lock ensures that the specific thread from that process doesn't go away. To protect against the process exiting after we drop the proc lock but before we dereference it to lookup the pid and p_comm in the call to ttyprintf(), we now copy the pid and p_comm to local variables while holding the proc lock. This problem was found by the recently added TD_NO_SLEEPING assertions for interrupt handlers. Tested by: emaste MFC after: 1 week
* Allow 32bit get/setsockopt with SO_SNDTIMEO or SO_RECVTIMEO to work.ps2005-10-271-3/+29
|
* Commit something we found useful at work at one point. Add sysctls forpeter2005-10-261-0/+40
| | | | | | | debug.kdb.panic and debug.kdb.trap alongside the existing debug.kdb.enter sysctl. 'panic' causes a panic, and 'trap' causes a page fault. We used these to ensure that crash dumps succeed from those two common failure modes. This avoids the need for creating a 'panic' kld module.
* Add a swi_remove() function to teardown software interrupt handlers. Forjhb2005-10-261-0/+17
| | | | | now it just calls intr_event_remove_handler(), but at some point it might also be responsible for tearing down interrupt events created via swi_add.
* - Fix leak of struct nlminfo on process exit.glebius2005-10-261-0/+9
| | | | | | | - Fix malloc type collision, that made the above problem difficult to understand. Reported by: Vladimir Sharun <sharun ukr.net>
* do umtx_wake at userland thread exit address, so that others userlanddavidxu2005-10-262-4/+8
| | | | | | | | | | threads can wait for a thread to exit, and safely assume that the thread has left userland and is no longer using its userland stack, this is necessary for pthread_join when a thread is waiting for another thread to exit which has user customized stack, after pthread_join returns, the userland stack can be reused for other purposes, without this change, the joiner thread has to spin at the address to ensure the thread is really exited.
* Reorganize the interrupt handling code a bit to make a few things cleanerjhb2005-10-253-271/+438
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and increase flexibility to allow various different approaches to be tried in the future. - Split struct ithd up into two pieces. struct intr_event holds the list of interrupt handlers associated with interrupt sources. struct intr_thread contains the data relative to an interrupt thread. Currently we still provide a 1:1 relationship of events to threads with the exception that events only have an associated thread if there is at least one threaded interrupt handler attached to the event. This means that on x86 we no longer have 4 bazillion interrupt threads with no handlers. It also means that interrupt events with only INTR_FAST handlers no longer have an associated thread either. - Renamed struct intrhand to struct intr_handler to follow the struct intr_foo naming convention. This did require renaming the powerpc MD struct intr_handler to struct ppc_intr_handler. - INTR_FAST no longer implies INTR_EXCL on all architectures except for powerpc. This means that multiple INTR_FAST handlers can attach to the same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach to the same interrupt. Sharing INTR_FAST handlers may not always be desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun either. Drivers can always still use INTR_EXCL to ask for an interrupt exclusively. The way this sharing works is that when an interrupt comes in, all the INTR_FAST handlers are executed first, and if any threaded handlers exist, the interrupt thread is scheduled afterwards. This type of layout also makes it possible to investigate using interrupt filters ala OS X where the filter determines whether or not its companion threaded handler should run. - Aside from the INTR_FAST changes above, the impact on MD interrupt code is mostly just 's/ithread/intr_event/'. - A new MI ddb command 'show intrs' walks the list of interrupt events dumping their state. It also has a '/v' verbose switch which dumps info about all of the handlers attached to each event. - We currently don't destroy an interrupt thread when the last threaded handler is removed because it would suck for things like ppbus(8)'s braindead behavior. The code is present, though, it is just under #if 0 for now. - Move the code to actually execute the threaded handlers for an interrrupt event into a separate function so that ithread_loop() becomes more readable. Previously this code was all in the middle of ithread_loop() and indented halfway across the screen. - Made struct intr_thread private to kern_intr.c and replaced td_ithd with a thread private flag TDP_ITHREAD. - In statclock, check curthread against idlethread directly rather than curthread's proc against idlethread's proc. (Not really related to intr changes) Tested on: alpha, amd64, i386, sparc64 Tested on: arm, ia64 (older version of patch by cognet and marcel)
* Use shorter names for the Giant and fast taskqueues so that their namesjhb2005-10-251-2/+2
| | | | actually fit.
* Rename the KDB_STOP_NMI kernel option to STOP_NMI and make it apply to alljhb2005-10-242-67/+8
| | | | | | | | | | | | | | | | | | | | | | IPI_STOP IPIs. - Change the i386 and amd64 MD IPI code to send an NMI if STOP_NMI is enabled if an attempt is made to send an IPI_STOP IPI. If the kernel option is enabled, there is also a sysctl to change the behavior at runtime (debug.stop_cpus_with_nmi which defaults to enabled). This includes removing stop_cpus_nmi() and making ipi_nmi_selected() a private function for i386 and amd64. - Fix ipi_all(), ipi_all_but_self(), and ipi_self() on i386 and amd64 to properly handle bitmapped IPIs as well as IPI_STOP IPIs when STOP_NMI is enabled. - Fix ipi_nmi_handler() to execute the restart function on the first CPU that is restarted making use of atomic_readandclear() rather than assuming that the BSP is always included in the set of restarted CPUs. Also, the NMI handler didn't clear the function pointer meaning that subsequent stop and restarts could execute the function again. - Define a new macro HAVE_STOPPEDPCBS on i386 and amd64 to control the use of stoppedpcbs[] and always enable it for i386 and amd64 instead of being dependent on KDB_STOP_NMI. It works fine in both the NMI and non-NMI cases.
* - Various small whitespace and style nits.jhb2005-10-241-11/+10
| | | | | - Use PCPU_GET(cpumask) in preference to 1 << PCPU_GET(cpuid) in a few places.
* Document in #ifdef notnow code the actions that proc_fini would need tojhb2005-10-241-0/+9
| | | | take if struct procs were actually freed.
* Don't panic if a spin lock is initialized that isn't in our static orderjhb2005-10-241-7/+16
| | | | | | | list. Just warn about it instead. Requested by: scottl MFC after: 1 day
* Revert previous change to this file. I accidentally committed whilejhb2005-10-241-19/+0
| | | | fixing spelling in a comment.
* Spell hierarchy correctly in comments.jhb2005-10-242-2/+21
| | | | Submitted by: Wojciech A. Koszek dunstan at freebsd dot czest dot pl
* Only set B_RAM (Read ahead mark) on an incore buffers if we can lock it.ups2005-10-241-3/+8
| | | | | | | This fixes a race condition caused by the unlocked write access to the b_flags field. MFC after: 3 days
* Don't touch last overrun if signal was already on queue.davidxu2005-10-231-2/+0
|
* Make p_itimers as a pointer, so file sys/proc.h does not need to includedavidxu2005-10-234-29/+27
| | | | sys/timers.h.
* Previously, nothing prevented the page that was returned by pmap_extract()alc2005-10-231-4/+3
| | | | | | from being reclaimed before it was wired. Use pmap_extract_and_hold() instead of pmap_extract() and retain the hold on the page until it has been wired.
* Regen for POSIX timer syscalls.davidxu2005-10-232-12/+12
|
* Implement POSIX timers. Current only CLOCK_REALTIME and CLOCK_MONOTONICdavidxu2005-10-235-9/+681
| | | | | | | | | | | | clock are supported. I have plan to merge XSI timer ITIMER_REAL and other two CPU timers into the new code, current three slots are available for the XSI timers. The SIGEV_THREAD notification type is not supported yet because our sigevent struct lacks of two member fields: sigev_notify_function sigev_notify_attributes I have found the sigevent is used in AIO, so I won't add the two members unless the AIO code is adjusted.
* 1. Make ksiginfo_alloc and ksiginfo_free public.davidxu2005-10-231-12/+58
| | | | | | 2. Introduce flags KSI_EXT and KSI_INS. The flag KSI_EXT allows a ksiginfo to be managed by outside code, the KSI_INS indicates sigqueue_add should directly insert passed ksiginfo into queue other than copy it.
* Verify that access to the given address is allowed from user-space.alc2005-10-221-1/+8
| | | | Discussed with: rwatson@
* Eliminate spl* calls.alc2005-10-211-6/+0
|
* Change format string for u_int64_t to %ju from %llu, in order to use therwatson2005-10-201-1/+1
| | | | | | correct format string on 64-bit systems. Pointed out by: pjd
* Add a "show malloc" command to DDB, which prints out the current stats forrwatson2005-10-201-0/+27
| | | | | | | available kernel malloc types. Quite useful for post-mortem debugging of memory leaks without a dump device configured on a panicked box. MFC after: 2 weeks
* Add entry for the spin mutex used by the hptmv(4) driver.jhb2005-10-201-0/+1
| | | | | MFC after: 1 day Tested by: Philip Kizer pckizer at nostrum dot com
* Fix a bug in the kernel module runtime linker that made it impossiblejdp2005-10-191-0/+3
| | | | | | | | | | | | | to unload the usb.ko module after boot if it was originally preloaded from "/boot/loader.conf". When processing preloaded modules, the linker erroneously added self-dependencies the each module's reference count. That prevented usb.ko's reference count from ever going to 0, so it could not be unloaded. Sponsored by Isilon Systems. Reviewed by: pjd, peter MFC after: 1 week
* Move the initialization of the devmtx into the mutex_init() functionjhb2005-10-182-2/+4
| | | | | | | | | called during early init before cninit(). Tested on: i386, alpha, sparc64 Reviewed by: phk, imp Reported by: Divacky Roman xdivac02 at stud dot fit dot vutbr dot cz MFC after: 1 week
* Const-qualify ksem_timedwait's parameter abstime as it's only passed in.stefanf2005-10-182-2/+2
|
* Add support for kernel modules with a single PT_LOAD section.peter2005-10-171-6/+9
| | | | | | | | | | | | | | While here, support up to four sections because it was trivial to do and cheap. (One pointer per section). For amd64 with "-fpic -shared" format .ko files, using a single PT_LOAD section is important to avoid wasting about 1MB of KVM and physical ram for the 'gap' between the two PT_LOAD sections. amd64 normally uses .o format kld files and isn't affected normally. But -fpic -shared modules are actually possible to produce and load... (And with a bugfix to binutils, we can build and use plain -shared .ko files without -fpic) i386 only wastes 4K per .ko file, so that isn't such a big deal there.
* Use new functions to call into drivers methods.phk2005-10-161-39/+27
|
* Make ttyconsolemode() call ttsetwater() so that drivers don't have to.phk2005-10-161-0/+1
|
* Make ttsetcompat() staticphk2005-10-161-1/+1
|
* Eliminate two unused arguments to ttycreate().phk2005-10-161-2/+4
|
* Implement the 32bit versions of recvmsg, recvfrom, sendmsgps2005-10-151-3/+15
| | | | Partially obtained from: jhb
* Implement 32bit wrappers for clock_gettime, clock_settime, andps2005-10-151-19/+51
| | | | clock_getres.
* mpsafevm has been stable and defaulted to 1 on sparc64 for over 6 months,kris2005-10-141-1/+1
| | | | | | | | so we are ready for mpsafevfs=1 by default on sparc64 too. I have been running this on all my sparc64 machines for over 6 months, and have not encountered MD problems. MFC after: 1 week
* Partially revert revision 1.66, which contained a change that did notkris2005-10-141-4/+4
| | | | | | | | | | | | | | | | | | correspond to the commit log. It changed the maxswzone and maxbcache parameters from int to long, without changing the extern definitions in <sys/buf.h>. In fact it's a good thing it did not, because other parts of the system are not yet ready for this, and on large-memory sparc machines it causes severe filesystem damage if you try. The worst effect of the change was that the tunables controlling the above variables stopped working. These were necessary to allow such large sparc64 machines (with >12GB RAM) to boot, since sparc64 did not set a hard-coded upper limit on these parameters and they ended up overflowing an int, causing an infinite loop at boot in bufinit(). Reviewed by: mlaier
* Regen for sigqueue syscall.davidxu2005-10-142-2/+3
|
OpenPOWER on IntegriCloud