summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_shutdown.c
Commit message (Collapse)AuthorAgeFilesLines
* Replace accidentally removed setrunqueue()julian2002-02-091-0/+1
| | | | | solves problem with machines failing to sync in booting. Submitted by: Tor.Egge@cvsup.no.freebsd.org
* Pre-KSE/M3 commit.julian2002-02-071-3/+2
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* Allow dump device be configured as early as possible using loader(8) tunable.sobomax2002-01-211-0/+11
| | | | | | | This allows obtaining crash dumps from the panics occured during late stages of kernel initialisation before system enters into single-user mode. MFC after: 2 weeks
* Explain that the admin can safely power down the system as well asnik2002-01-181-1/+2
| | | | rebooting.
* Change the preemption code for software interrupt thread schedules andjhb2002-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mutex releases to not require flags for the cases when preemption is not allowed: The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent switching to a higher priority thread on mutex releease and swi schedule, respectively when that switch is not safe. Now that the critical section API maintains a per-thread nesting count, the kernel can easily check whether or not it should switch without relying on flags from the programmer. This fixes a few bugs in that all current callers of swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from fast interrupt handlers and the swi_sched of softclock needed this flag. Note that to ensure that swi_sched()'s in clock and fast interrupt handlers do not switch, these handlers have to be explicitly wrapped in critical_enter/exit pairs. Presently, just wrapping the handlers is sufficient, but in the future with the fully preemptive kernel, the interrupt must be EOI'd before critical_exit() is called. (critical_exit() can switch due to a deferred preemption in a fully preemptive kernel.) I've tested the changes to the interrupt code on i386 and alpha. I have not tested ia64, but the interrupt code is almost identical to the alpha code, so I expect it will work fine. PowerPC and ARM do not yet have interrupt code in the tree so they shouldn't be broken. Sparc64 is broken, but that's been ok'd by jake and tmm who will be fixing the interrupt code for sparc64 shortly. Reviewed by: peter Tested on: i386, alpha
* Fix a signed bug in the crashdump code for systems with > 2GB of ram.ps2001-11-131-2/+2
| | | | Reviewed by: peter
* Add a sysctl for preventing the sync() in panic() recovery. This canpeter2001-10-191-0/+6
| | | | | | be so dangerous it isn't funny. eg: if you panic inside NFS or softdep, and then try and sync you run into held locks and cause either deadlocks, recursive panics or other interesting chaos. Default is unchanged.
* decrement the dumping variable after use so we can call it several timespeter2001-09-201-4/+6
| | | | if needed.
* KSE Milestone 2julian2001-09-121-7/+7
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* - Axe holding_giant as it is not used now anyways and was ok'd byjhb2001-09-101-35/+4
| | | | | | | | | | dillon in an earlier e-mail. - We don't need to test the console right before we vfprintf() the panicstr message. The printing of the panic message is a fine console test by itself and doesn't make useful messages scroll off the screen or tick developers off in quite the same. Requested by: jlemon, imp, bmilekic, chris, gsutter, jake (2)
* Sigh. Dig up text from a signature in a 1994 Usenet post I made and redopeter2001-09-051-5/+12
| | | | the ..uhh... ``console test'' to avoid another 50 emails about GPL issues.
* The !RESTARTABLE_PANICS code has some loose ends.peter2001-09-021-0/+8
|
* Giant Pushdown. Saved the worst P4 tree breakage for last.dillon2001-09-011-9/+28
| | | | | | | | | | | | reboot() getpriority() setpriority() rtprio() osetrlimit() ogetrlimit() setrlimit() getrlimit() getrusage() getpid() getppid() getpgrp() getpgid() getsid() getgid() getegid() getgroups() setsid() setpgid() setuid() seteuid() setgid() setegid() setgroups() setreuid() setregid() setresuid() setresgid() getresuid() getresgid () __setugid() getlogin() setlogin() modnext() modfnext() modstat() modfind() kldload() kldunload() kldfind() kldnext() kldstat() kldfirstmod() kldsym() getdtablesize() dup2() dup() fcntl() close() ofstat() fstat() nfsstat() fpathconf() flock()
* Add a new kernel option RESTARTABLE_PANICS. If this option is present,jhb2001-08-231-0/+2
| | | | | | | | then one can restart from a panic by resetting the panicstr variable to NULL. This commit conditionalizes the previously committed functionality on this variable. It also removes the __dead2 attribute from the panic() function so that when one continues from a panic() the behavior will be predictable.
* Clear db_active in boot() so that one can call the boot function (as welljhb2001-08-211-0/+8
| | | | | as use the panic command) w/o having to manually clear db_active first to avoid the db_error() in mi_switch().
* Allow one to restart from a panic in DDB by clearing the panicstrjhb2001-08-211-6/+18
| | | | | variable to NULL. Note that since panic() is marked with __dead2, this has somewhat unpredictable results at best.
* Don't dump on the label sector or below. This avoids clobbering thebde2001-08-151-2/+3
| | | | | | | | | | | | | | | | | | | label if the dump device overflaps the label (which is a slight misconfiguration). Dump routines don't use dscheck(), so the normal write protection of the label doesn't help. Reduced some nearby overflow bugs. In disk_dumpcheck(), there was (fatal but fail-safe) overflow on i386's with 4GB of memory, at least if Maxmem was the top page (can this happen?). The fix assumes that the sector size divides PAGE_SIZE (dump routines already assume this). In setdumpdev(), the corresponding overflow occurred with only about 2GB of memory on all machines with 32-bit ints. This allowed setdumpdev() to succeed when it shouldn't have, but then disk_dumpcheck() failed safe later. Except in old versions of FreeBSD like RELENG_3 where there is no disk_dumpcheck(). PR: 28164 (label clobbering part) MFC after: 1 week
* - Sort includes.jhb2001-06-251-9/+9
| | | | | | | - Count the context switches during shutdown when we give ithreads a chance to run as volutary context switches. Submitted by: bde (2)
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Overhaul of the SMP code. Several portions of the SMP kernel support havejhb2001-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | been made machine independent and various other adjustments have been made to support Alpha SMP. - It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in. Reviewed by: jake, peter Looked over by: eivind
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* Blow away the panic mutex in favor of using a single atomic_cmpset() on ajhb2001-04-171-1/+9
| | | | | | panic_cpu shared variable. I used a simple atomic operation here instead of a spin lock as it seemed to be excessive overhead. Also, this can avoid recursive panics if, for example, witness is broken.
* Last commit was broken.. It always prints '[CTRL-C to abort]'.ps2001-03-281-0/+21
| | | | | | | Move duplicate code for printing the status of the dump and checking for abort into a separate function. Pointy hat to: me
* Lock initproc when we send SIGINT to init during shutdown.jhb2001-03-071-0/+2
|
* RIP <machine/lock.h>.markm2001-02-111-1/+0
| | | | | | | Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
* Change and clean the mutex lock interface.bmilekic2001-02-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Fix typo: seperate -> separate.asmodai2001-02-061-1/+1
| | | | Seperate does not exist in the english language.
* Convert all simplelocks to mutexes and remove the simplelock implementations.jasone2001-01-241-1/+1
|
* Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variablesjake2001-01-101-2/+2
| | | | other then curproc.
* Stick the kthread API in a kthread_* namespace, and the specialized kprocjhb2000-12-151-2/+2
| | | | | | functions in a kproc_* namespace. Reviewed by: -arch
* Only print out APIC info on an SMP system during a panic if APIC_IO isjhb2000-11-291-0/+2
| | | | defined.
* Don't release and acquire Giant in mi_switch(). Instead, release andjhb2000-11-161-0/+2
| | | | | | | | acquire Giant as needed in functions that call mi_switch(). The releases need to be done outside of the sched_lock to avoid potential deadlocks from trying to acquire Giant while interrupts are disabled. Submitted by: witness
* Catch up to moving headers:jhb2000-10-201-1/+1
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* savectx() is now used exclusively by the crash dump system. Move thepeter2000-10-131-3/+0
| | | | | i386 specific gunk (copy %cr3 to the pcb) from the MI dumpsys() to the MD savectx().
* Do not allocate a callout for all crashdumps, not just when you panic.ps2000-10-131-1/+2
|
* Added used include of <sys/mutex.h> (don't depend on pollution inbde2000-09-171-0/+1
| | | | <sys/signalvar.h>).
* Fix some printf format string warnings due to sizeof(int) != sizeof(long) onjhb2000-09-111-4/+4
| | | | the alpha.
* Allow interrupt threads to run during shutdown. This should fix thejasone2000-09-101-2/+15
| | | | | | "dirty buffers during shutdown" problem introduced by the SMPng commit. Submitted by: tegge, cg
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-2/+7
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* kern_shutdown.c was more ANSI-C than K&R - remove the remnants of K&Rpeter2000-09-031-21/+12
| | | | support with extreme prejudice.
* gcc knows that savectx() is potentially a setjmp style dual-returnpeter2000-09-031-6/+5
| | | | | | | function which may lead to stack lossage and clobbered variables. This isn't the case here, but there is no way to tell gcc that. Work around this in a kinda bizzare way, but it shuts gcc up.
* Make it possible to pass boot()'s flags to shutdown_nice() so that themsmith2000-08-311-1/+8
| | | | | | kernel can instigate an orderly shutdown but still determine the form of that shutdown. Make it possible eg. to cleanly shutdown and power off the system under ACPI when the power button is pressed.
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-1/+1
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-1/+1
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Separate the struct bio related stuff out of <sys/buf.h> intophk2000-05-051-0/+1
| | | | | | | | | | | | | | | <sys/bio.h>. <sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall not be made a nested include according to bdes teachings on the subject of nested includes. Diskdrivers and similar stuff below specfs::strategy() should no longer need to include <sys/buf.> unless they need caching of data. Still a few bogus uses of struct buf to track down. Repocopy by: peter
* The SMP cleanup commit broke UP compiles. Make UP compiles work again.dillon2000-03-281-2/+0
|
* Seconds to ticks conversion was done at the wrong place.luoqi2000-01-121-2/+2
|
* Introduce a mechanism to suspend/resume system processes. Suspend syncerluoqi2000-01-071-0/+32
| | | | and bufdaemon prior to disk sync during system shutdown.
* Change the default poweroff delay from 0 to 5 seconds. This seems to bemsmith1999-12-071-1/+5
| | | | | | | | | adequate for the IDE disks that I have available for testing. Most seem to wait between 1 and 3 seconds before flushing their caches. Add the ability to override the delay at compile time via the undocumented option POWEROFF_DELAY. The delay can still be set via sysctl as it was originally implemented.
OpenPOWER on IntegriCloud