summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
Commit message (Collapse)AuthorAgeFilesLines
* Commit 14/14 of sched_lock decomposition.jeff2007-06-051-6/+6
| | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* Remove 'MPSAFE' annotations from the comments above most system calls: allrwatson2007-03-041-5/+1
| | | | | | | | system calls now enter without Giant held, and then in some cases, acquire Giant explicitly. Remove a number of other MPSAFE annotations in the credential code and tweak one or two other adjacent comments.
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-1/+2
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-221-1/+2
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* On shutdown try to turn off all swap devices. This way GEOM providers arepjd2006-04-101-0/+7
| | | | | | | | properly closed on shutdown. Requested by: ru Reviewed by: alc MFC after: 2 weeks
* - Add the global 'rebooting' variable that is used to detect whenjeff2006-02-061-0/+3
| | | | | | | boot() has been called. Sponsored by: Isilon Systems, Inc. MFC After: 1 week
* Don't pretend to be thread0 when calling sync().ups2005-09-221-2/+2
| | | | | | | | | It confuses the lock manager since in some places thread0 is then used for vnode locking while curthread is used for vnode unlocking. Found by: Yahoo! Reviewed by: ps@,jhb@ MFC after: 3 days
* Add a new struct buf flag bit, B_PERSISTENT, and use it to tagtruckman2005-09-081-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | struct bufs that are persistently held by ext2fs. Ignore any buffers with this flag in the code in boot() that counts "busy" and dirty buffers and attempts to sync the dirty buffers, which is done before attempting to unmount all the file systems during shutdown. This fixes the problem caused by any ext2fs file systems that are mounted at system shutdown time, which caused boot() to give up on a non-zero number of buffers and skip the call to vfs_unmountall(). This left all the mounted file systems in a dirty state and caused them to all require cleanup by fsck on reboot. Move the two separate copies of the "busy" buffer test in boot() to a separate function. Nuke the useless spl() stuff in the ext2fs ULCK_BUF() macro. Bring the PRINT_BUF_FLAGS definition in sys/buf.h up to date with this and previous flag changes. PR: kern/56675, kern/85163 Tested by: "Matthias Andree" matthias.andree at gmx.de Reviewed by: bde MFC after: 3 days
* - Remove unused include.jeff2005-04-121-1/+0
|
* Replace a printf with a KASSERT that we are indeed running on the BSP.njl2004-11-301-4/+1
|
* Bind to cpu0 for boot() processing on all platforms again.marcel2004-11-081-1/+1
|
* Add comments to clarify why we need to run shutdown code on the BSP, updatenjl2004-11-071-4/+9
| | | | | an old comment about boot() being MI, and note that splhigh() no longer disables interrupts.
* Restrict the sched_bind to cpu 0 to i386 and amd64 for now. I forgot thatpeter2004-11-051-1/+1
| | | | alpha still doesn't use logical cpu id's.
* Bind to cpu0 for boot() processing. (Note this is reboot, not startup)peter2004-11-051-0/+8
| | | | | This means we'll always call the event hooks, device_shutdown etc on the BSP and theoretically means we can de-cruftify the cpu_reset_proxy stuff.
* Remove buf->b_dev field.phk2004-11-041-2/+5
|
* Change the perfectly precise messagephk2004-10-041-1/+1
| | | | | | | printf("No buffers busy after final sync"); to printf("All buffers synced."); in order to not leave the users wondering if there should be.
* Turn PREEMPTION into a kernel option. Make sure that it's defined ifscottl2004-09-021-0/+1
| | | | | | FULL_PREEMPTION is defined. Add a runtime warning to ULE if PREEMPTION is enabled (code inspired by the PREEMPTION warning in kern_switch.c). This is a possible MT5 candidate.
* Remove the HW_WDOG option; it serves no purpose.des2004-08-291-12/+0
| | | | MFC after: 3 days
* Remove some dead code under a straggling APIC_IO #ifdef that I missedjhb2004-08-201-7/+1
| | | | back before 5.2.
* Yet another tweak to the shutdown messages in boot():truckman2004-08-151-15/+12
| | | | | | | | | | | | | | | | | | | | | | Don't count busy buffers before the initial call to sync() and don't skip the initial sync() if no busy buffers were called. Always call sync() at least once if syncing is requested. This defers the "Syncing disks, buffers remaining..." message until after the initial sync() call and the first count of busy buffers. This backs out changes in kern_shutdown 1.162. Print a different message when there are no busy buffers after the initial sync(), which is now the expected situation. Print an additional message when syncing has completed successfully in the unusual situation where the work of syncing was done by boot(). Uppercase one message to make it consistent with all of the other kernel shutdown messages. Discussed with: bde (in a much earlier form, prior to 1.162) Reviewed by: njl (in an earlier form)
* Skip the syncing disks loop if there are no dirty buffers. Remove anjl2004-08-101-5/+13
| | | | | | variable used to flag the initial printf. Submitted by: truckman (earlier version)
* Minor message cleanup.njl2004-07-301-4/+3
|
* Don't sync the file system on panic by default. This seems to basicallyrwatson2004-07-211-1/+1
| | | | | | | | work very infrequently, and often results in a compound panic which confuses debugging; locking/SMP have made the layering violation (and risks) of this more obvious over time. Discussed with: green, bde, et al.
* You always spot the typos after you have committed.. Start sentencejulian2004-07-191-1/+1
| | | | with a Cap.
* Allow the user who calls doadump() from the kernel debuggerjulian2004-07-191-2/+11
| | | | | | | | | | to not get a page fault if he has not defined a dump device. Panic can often not do a dump as it can hang forever in some cases. The original PR was for amd64 only. This is a generalised version of that change. PR: amd64/67712 Submitted by: wjw@withagen.nl <Willen Jan Withagen>
* Cleanup shutdown output.alfred2004-07-151-5/+3
|
* Tidy up system shutdown.alfred2004-07-151-5/+13
|
* Clean up the output on reboot by keeping completion messages on the samenjl2004-07-151-2/+2
| | | | | | line as the announcement. Someone should probably update the "buffers remaining" message since we now no longer should have any buffers remaining at that point.
* Update for the KDB framework:marcel2004-07-101-33/+15
| | | | | | | | | | | | | | | | | | | | | | o Make debugging code conditional upon KDB instead of DDB. o Call kdb_enter() instead of Debugger(). o Call kdb_backtrace() instead of db_print_backtrace() or backtrace(). kern_mutex.c: o Replace checks for db_active with checks for kdb_active and make them unconditional. kern_shutdown.c: o s/DDB_UNATTENDED/KDB_UNATTENDED/g o s/DDB_TRACE/KDB_TRACE/g o Save the TID of the thread doing the kernel dump so the debugger knows which thread to select as the current when debugging the kernel core file. o Clear kdb_active instead of db_active and do so unconditionally. o Remove backtrace() implementation. kern_synch.c: o Call kdb_reenter() instead of db_error().
* Implement preemption of kernel threads natively in the scheduler ratherjhb2004-07-021-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than as one-off hacks in various other parts of the kernel: - Add a function maybe_preempt() that is called from sched_add() to determine if a thread about to be added to a run queue should be preempted to directly. If it is not safe to preempt or if the new thread does not have a high enough priority, then the function returns false and sched_add() adds the thread to the run queue. If the thread should be preempted to but the current thread is in a nested critical section, then the flag TDF_OWEPREEMPT is set and the thread is added to the run queue. Otherwise, mi_switch() is called immediately and the thread is never added to the run queue since it is switch to directly. When exiting an outermost critical section, if TDF_OWEPREEMPT is set, then clear it and call mi_switch() to perform the deferred preemption. - Remove explicit preemption from ithread_schedule() as calling setrunqueue() now does all the correct work. This also removes the do_switch argument from ithread_schedule(). - Do not use the manual preemption code in mtx_unlock if the architecture supports native preemption. - Don't call mi_switch() in a loop during shutdown to give ithreads a chance to run if the architecture supports native preemption since the ithreads will just preempt DELAY(). - Don't call mi_switch() from the page zeroing idle thread for architectures that support native preemption as it is unnecessary. - Native preemption is enabled on the same archs that supported ithread preemption, namely alpha, i386, and amd64. This change should largely be a NOP for the default case as committed except that we will do fewer context switches in a few cases and will avoid the run queues completely when preempting. Approved by: scottl (with his re@ hat)
* - Change mi_switch() and sched_switch() to accept an optional thread tojhb2004-07-021-1/+1
| | | | | | | | | | | | | switch to. If a non-NULL thread pointer is passed in, then the CPU will switch to that thread directly rather than calling choosethread() to pick a thread to choose to. - Make sched_switch() aware of idle threads and know to do TD_SET_CAN_RUN() instead of sticking them on the run queue rather than requiring all callers of mi_switch() to know to do this if they can be called from an idlethread. - Move constants for arguments to mi_switch() and thread_single() out of the middle of the function prototypes and up above into their own section.
* Second half of the dev_t cleanup.phk2004-06-171-1/+1
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Remove filename+line number from panic messages.phk2004-06-061-3/+3
|
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* - Add a flags parameter to mi_switch. The value of flags may be SW_VOL orjeff2004-01-251-2/+4
| | | | | | | | | | SW_INVOL. Assert that one of these is set in mi_switch() and propery adjust the rusage statistics. This is to simplify the large number of users of this interface which were previously all required to adjust the proper counter prior to calling mi_switch(). This also facilitates more switch and locking optimizations. - Change all callers of mi_switch() to pass the appropriate paramter and remove direct references to the process statistics.
* Add linenumber and source filename to panic(9) output.phk2004-01-191-3/+3
| | | | Ideally a traceback should be printed too, any takers ?
* 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)
* Don't overwrite the static panicstr buffer for secondary and furtheriedowse2003-06-151-3/+8
| | | | | | | | | panics. Before revision 1.38, we used to just point panicstr at the format string if panicstr was NULL, but since we now use a static buffer for the formatted panic message, we have to be careful to only write to it during the first panic. Pointed out by: bde
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Lock the sched_lock while setting TDF_INPANIC.jhb2003-04-171-0/+2
|
* Don't include <sys/disklabel.h>phk2003-04-161-1/+0
|
* style.alfred2003-02-141-8/+20
|
* Print "Stack backtrace:" right before dumping the backtrace. We cannotpeter2003-02-131-1/+2
| | | | expect end users to automatically recognize a stack trace for what it is.
* - Update a printf format for b_flags.jeff2003-02-091-1/+1
|
* Introduce thephk2003-01-041-0/+14
| | | | | | | | | | | | | void backtrace(void); function which will print a backtrace if DDB is in the kernel and an explanation if not. This is useful for recording backtraces in non-fatal circumstances and does not require pollution with DDB #includes in the files where it is used. It would of course be nice to have a non-DDB dependent version too, but since the meat of a backtrace is MD it is probably not worth it.
* During shutdown explain what the numbers following the 'syncingalfred2002-11-181-1/+1
| | | | disks' message mean, specifically, 'buffers remaining...'.
* Hook up mac_check_system_reboot(), a MAC Framework entry point thatrwatson2002-10-271-3/+12
| | | | | | | | | permits MAC modules to augment system security decisions regarding the reboot() system call, if MAC is compiled into the kernel. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Add kernel dump support, based on the ia64 version (which was committedtmm2002-10-201-1/+1
| | | | | | | | | | as sparc64/sparc64/dump_machdep.c a while back). Other than ia64 (which uses ELF), sparc64 uses a homegrown format for the dumps (headers are required because the physical address and size of the tsb must be noted, and because physical memory may be discontiguous); ELF would not offer any advantages here. Reviewed by: jake
* Add ability to dump stacktraces on kernel panics when DDB is compiled intojhb2002-09-191-2/+17
| | | | | | | | | | | | | | | the kernel. By default this is turned off since otherwise it could scroll valuable panic messages off of the screen. This option can be turned on by the DDB_TRACE kernel option as well as the debug.trace_on_panic sysctl. Also, fix the DDB_UNATTENDED option to use its own header instead of abusing opt_ddb.h. This way turning that one option on or off doesn't force you to recompile all of ddb. Requested by: many (1), bde (2*) * - I know bde prefers !abusing option headers in general but can't remember if he as brought up this specific case.
* Revert previous revision which was accidentally committed and has not beenjhb2002-08-011-11/+9
| | | | tested yet.
OpenPOWER on IntegriCloud