Commit Graph

2280 Commits

Author SHA1 Message Date
bouyer efc4435cb3 in vfs_shutdown(), use sched_suspend() to suspend scheduling, and use
tsleep() instead of DELAY. Also, keep trying flushing buffers when the
number of dirty buffers decreases (20 rounds may not be enouth for a
very large buffer cache).

Using tsleep instead of delay gives a chance to others kernel threads to run,
which is needed for raidframe. With this change I've not been able to
reproduce the 'dirty buffer not flushed' problem with raidframe.
2000-08-31 14:41:35 +00:00
bouyer 629150f864 Add the sched_suspend/sched_resume functions, as discussed on tech-kern,
with the following modifications to the initial patch:
- rename SHOLD and P_HOST to SSUSPEND and P_SUSPEND to avoid confusion with
  PHOLD()
- don't deal with SSUSPEND/P_SUSPEND in fork1(), if we come here while
  scheduler is suspended we're forking proc0, which can't have P_SUSPEND set.

sched_suspend() suspends the scheduling of users process, by removing all
processes from the run queues and changing their state from SRUN to
SSUSPEND. Also mark all user process but curproc P_SUSPEND.
When a process has to be put in SRUN and is marked P_SUSPEND, it's placed in
the SSUSPEND state instead.
sched_resume() places all SSUSPEND processes back in SRUN, clear the P_SUSPEND
flag.
2000-08-31 14:36:19 +00:00
jhawk a022cf9d37 Use
${MAKE}
instead of
  make
2000-08-30 23:51:46 +00:00
sommerfeld 1cbfb08951 Fix !LOCKDEBUG && !DIAGNOSTIC case 2000-08-28 21:07:52 +00:00
sommerfeld bdc30aed03 Since the spinlock count is per-cpu, we don't need atomic operations
to update it, so don't bother with <machine/atomic.h>

Flush kernel_lock_release_all() and kernel_lock_acquire_count() (which
didn't do spinlock accounting correctly), and replace them with
spinlock_release_all() and spinlock_acquire_count().
2000-08-26 19:26:43 +00:00
thorpej fe036cae9a Fix a printf format (for Alpha). 2000-08-26 17:02:16 +00:00
sommerfeld 340951f9d1 On second thought.. pass cpu_info * to roundrobin() explicitly. 2000-08-26 04:01:16 +00:00
sommerfeld ec08310fab More MP clock/scheduler changes:
- Periodically invoke roundrobin() from hardclock() on all cpu's rather
than from a timer callout; this allows time-slicing on non-primary cpu's.
 - Make pscnt per-cpu.
 - Notice psdiv changes on each cpu, and adjust pscnt at that point.
Also, invoke setstatclockrate() from the clock interrupt when each cpu
notices the divisor change, rather than when starting/stopping the
profiling clock.
2000-08-26 03:34:36 +00:00
sommerfeld 392f867be8 MULTIPROCESSOR: Initialize new proc's p_cpu pointer to NULL, so
anything which looks at it before it runs won't explode.
2000-08-25 02:55:49 +00:00
thorpej 4db6fc7542 Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity.  Its use in
roundrobin() still needs some work.
2000-08-25 01:04:06 +00:00
thorpej 4f944290a2 Correct a comment. 2000-08-24 06:14:34 +00:00
sommerfeld 6d8ab92a1a Move kernel_lock release/switch/reacquire from ltsleep() to
mi_switch(), so we don't botch the locking around preempt() or
yield().
2000-08-24 02:37:27 +00:00
sommerfeld 11eae2ffaf Default simple_lock_debugger to "on" on MULTIPROCESSOR.
Change uninitialized simple_lock check from KASSERT to use SLOCK_WHERE
(to show the "real" source line where the error was detected).
2000-08-23 15:17:47 +00:00
thorpej 7508bd7231 Use spllock() rather than splhigh(). 2000-08-22 19:47:26 +00:00
thorpej a2f2d10800 Slight adjustment to INTERLOCK_*() macros to make it easier
for the compiler to optimize.
2000-08-22 17:31:32 +00:00
thorpej f759220f40 Define the MI parts of the "big kernel lock" perimeter. From
Bill Sommerfeld.
2000-08-22 17:28:28 +00:00
eeh 3787c3f7fd Should use an `intrptr_t' for address calculations rather than `int'. 2000-08-22 16:44:51 +00:00
thorpej 25fe521af4 Fix a locking glitch in callwheel_slock handling. Noted by Bill Sommerfeld. 2000-08-22 15:30:59 +00:00
thorpej 14c0be9cd4 Protect hardclock_ticks and softclock_ticks with the callwheel
lock to prevent a race between hardclock() and callout_reset().
2000-08-21 23:51:33 +00:00
thorpej b7e86fa7a8 spllowersoftclock() is already void; no need to cast it. 2000-08-21 23:43:30 +00:00
thorpej 012500bf1f Add a lock for the callwheel (callout facility), and only go to
splclock() while holding it.
2000-08-21 23:40:56 +00:00
enami d707b78562 Declare this static simplelock data only when MULTIPROCESSOR or LOCKDEBUG is
defined to prevent compiler warning.
2000-08-21 06:42:57 +00:00
thorpej 7da965dade splsched() is appropriate for select()/poll(). 2000-08-21 06:27:59 +00:00
thorpej 5573e863c7 - Clean up _simple_lock_held()
- In simple_lock_switchcheck(), allow/enforce exactly one lock to be
  held: sched_lock.
- Per e-mail to tech-smp from Bill Sommerfeld, r/w spin locks have
  an interlock at splsched(), rather than splhigh().
2000-08-21 02:17:45 +00:00
sommerfeld 78e4a089b8 Don't bother reinitializing statically-inited locks 2000-08-21 02:16:30 +00:00
thorpej f42254818f splhigh() -> splsched() 2000-08-21 02:09:33 +00:00
thorpej a86d1f4891 Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
2000-08-20 21:50:06 +00:00
thorpej 8bc6ee56cb Lock debugging fix: Make sure a simplelock's lock_holder gets
initialized properly, and consistently tracks the owning CPU's
cpuid.  Add some diagnostic assertions to enforce this.
2000-08-19 19:36:18 +00:00
sommerfeld 8875442492 Statically initialize statically-allocated locks 2000-08-19 17:25:33 +00:00
cgd 0199b04bef update for changed makesyscalls.master 2000-08-18 19:35:15 +00:00
cgd 6858b430d3 tweak white space around generated NetBSD rcs ids 2000-08-18 19:33:30 +00:00
cgd c07a11c347 nuke __P for generated syscall prototypes and sy_call_t 2000-08-18 19:14:33 +00:00
itojun f5fa53578a repair m_dup(). specifically, now it is safe against non-MCLBYTES cluster
mbuf.  noone seem to be using this function at this moment.
2000-08-18 16:19:22 +00:00
itojun 243eebc256 disable m_dup(), as it makes false assumption on cluster mbuf and unsafe
(does not do the right thing).
2000-08-18 14:23:48 +00:00
itojun 1905ac079e add a comment about false assumption made by m_dup() 2000-08-18 14:12:47 +00:00
thorpej 3a1f5cdbfc If maniuplating a read lock on the proc list, we no longer need
to go to splclock() -- spinlockmgr() handles the interrupt blocking
while holding the interlock for us, now.
2000-08-17 14:37:54 +00:00
thorpej 391e1e1f44 For spinlocks, block interrupts while holding the interlock. Partially
from Bill Sommerfeld.
2000-08-17 14:36:32 +00:00
thorpej b6aaff9c44 Add a DIAGNOSTIC check for release of an unlocked lock.
From Bill Sommerfeld.
2000-08-17 04:18:21 +00:00
thorpej f2098b2382 Some more lock debugging support:
- LOCK_ASSERT(), which expands to KASSERT() if LOCKDEBUG.
- new simple_lock_held(), which tests if the calling CPU holds
  the specified simple lock.

From Bill Sommerfeld, modified slightly by me.
2000-08-17 04:15:43 +00:00
fvdl 4ca7344324 Fix omission in previous. 2000-08-15 17:54:59 +00:00
eeh 2ce37274f1 Fix LP64BE bug. 2000-08-15 16:26:42 +00:00
augustss ce60088d05 Define ltsleep() in the case of _EXTENT_TESTING so regressions testing
works again.
2000-08-12 23:56:50 +00:00
thorpej a91e7a7c6d Don't bother with a trampoline to start the pagedaemon and
reaper threads.
2000-08-12 22:41:53 +00:00
thorpej d66573f747 In reaper(), use ltsleep() instead of simple_unlock()/tsleep(). 2000-08-12 22:26:01 +00:00
sommerfeld 861fcc44b7 Use ltsleep(...,PNORELOCK..) instead of simple_unlock()/tsleep() 2000-08-12 16:43:00 +00:00
sommerfeld a6cdaddbe6 Use ltsleep(... PNORELOCK ) instead of simple_unlock()/tsleep() 2000-08-12 16:29:36 +00:00
sommerfeld 01233143b9 Use ltsleep instead of simple_unlock/tsleep/simple_lock 2000-08-12 16:28:30 +00:00
eeh cd557cfb3c Nother __kprintf_attribute__ to be removed. 2000-08-10 04:37:59 +00:00
tv 5b0a45ec9b Strip %b and DDB formats out of kprintf, as they are no longer supported. 2000-08-09 10:22:31 +00:00
thorpej 414765c253 In fill_kproc2(), testing p->p_stats != NULL doesn't do much good,
instead test for (p->p_flag & I_INMEM), and don't access the U-area
(via p->p_stats) if that bit is clear.  Fixes the hangs people have
seen when the system is paging and the user runs top/ps/w.
2000-08-08 23:42:07 +00:00