Commit Graph

6295 Commits

Author SHA1 Message Date
freza 1531f6d32e Any time we remove event from the queue make sure we 1. release the
event plist and 2. free the drvctl_event struct.

Discussed with jmcneill@.
2008-05-30 15:30:37 +00:00
ad 13cf4bcc55 PR kern/38663 Kernel preemption can't be enabled on x86 because of amd64
FPU handling

Remove ifdef(i386), kernel preemption works on amd64 now.
2008-05-30 12:18:14 +00:00
rmind 1be38c90d8 do_sys_accept: release the reference to sock in few error paths.
Should fix PR/38790, report and test-case by Nicolas Joly.
2008-05-30 09:49:01 +00:00
rmind a68758f8bd sched_idle: initialise 'tci' to NULL, avoids compiler warning. 2008-05-30 08:31:42 +00:00
ad e98d2c1016 lwp_exit_switchaway: set l_lwpctl->lc_curcpu = EXITED, not NONE. 2008-05-29 23:29:59 +00:00
rmind 29170d3854 Simplifcation for running LWP migration. Removes double-locking in
mi_switch(), migration for LSONPROC is now performed via idle loop.
Handles/fixes on-CPU case in lwp_migrate(), misc.

Closes PR/38169, idea of migration via idle loop by Andrew Doran.
2008-05-29 22:33:27 +00:00
rmind 15e36ef766 sys_shmget: use the correct size variable for uobj_wirepages().
Adjust shm_memlock() for consistency too.

Fixes PR/38782, reported by Adam Hoka.
2008-05-29 21:38:18 +00:00
joerg 157262cae8 Explicitly compute the next interval using 64bit arithmetic, if the time
was either stepped backwards or the timer has overflown. This fixes
PR 26470.
2008-05-29 15:27:51 +00:00
pooka de98844194 Mark pread/pwrite rump syscalls.
from Arnaud Ysmal
2008-05-29 12:01:37 +00:00
ad 79d0501e52 Disable zero copy if MULTIPROCESSOR, until it is fixed:
- The TLB coherency overhead on MP systems is really expensive.
- It triggers a race in the VM system (grep kpause uvm/*).
2008-05-28 21:01:42 +00:00
dyoung 801c395b47 Run shutdown hooks whether or not the kernel has panicked. Restores
NetBSD's shutdown behavior of more than 6 years before rev 1.176.
Ok joerg@.

It is essential that we restore some hardware to initial conditions
before rebooting, in order to avoid interfering with the BIOS
bootstrap.  For example, if NetBSD gives control back to the Soekris
comBIOS while the kernel text is write-protected, the BIOS bootstrap
hangs during the power-on self-test, "POST: 0123456789bcefghip".
In principle, bus masters can also interfere with BIOS boot.
2008-05-28 15:40:58 +00:00
ad b5d8351e8e PR kern/38355 lockf deadlock detection is broken after vmlocking
- Fix it; tested with Sun's libMicro.
- Use pool_cache.
- Use a global lock, so the deadlock detection code is safer.
2008-05-28 13:35:32 +00:00
ad 5831c8ac63 Pull in sys/evcnt.h. 2008-05-27 22:05:50 +00:00
ad f79b59f700 #ifdef strikes again 2008-05-27 21:36:03 +00:00
ad 4c634c7155 Sigh. The previous change did bad things to MySQL sysbench. Continue stealing
jobs from sched_nextlwp, but also do it in the idle loop. In sched_nextlwp
use trylock, in the idle LWP try harder.
2008-05-27 19:05:52 +00:00
ad 208df81d99 Move lwp_exit_switchaway() into kern_synch.c. Instead of always switching
to the idle loop, pick a new LWP from the run queue.
2008-05-27 17:51:17 +00:00
ad aa7e99c693 Replace a couple of tsleep calls with cv_wait. 2008-05-27 17:50:03 +00:00
ad 234470c22e tsleep -> kpause 2008-05-27 17:49:07 +00:00
ad ec32985f61 Use pool_cache. 2008-05-27 17:48:27 +00:00
ad f90f3a01ea Use kmem_alloc/free. 2008-05-27 17:42:14 +00:00
ad 81fa379a0b PR kern/38707 scheduler related deadlock during build.sh
- Fix performance regression inroduced by the workaround by making job
  stealing a lot simpler: if the local run queue is empty, let the CPU enter
  the idle loop. In the idle loop, try to steal a job from another CPU's run
  queue if we are idle. If we succeed, re-enter mi_switch() immediatley to
  dispatch the job.

- When stealing jobs, consider a remote CPU to have one less job in its
  queue if it's currently in the idle loop. It will dispatch the job soon,
  so there's no point sloshing it about.

- Introduce a few event counters to monitor what's happening with the run
  queues.

- Revert the idle CPU bitmap change. It's pointless considering NUMA.
2008-05-27 14:48:52 +00:00
ad f985e88f2b Start profiling clock on new process before setting it running, in case
there is a preemption.
2008-05-27 14:18:51 +00:00
christos b51f45d9e6 More fixes needed in the error paths for the chroot code to work. 2008-05-26 18:20:36 +00:00
rmind 06171502fc Adjust and thus unify my license. 2008-05-26 17:45:51 +00:00
ad c9ac92b592 Use pool_cache for sockets. 2008-05-26 17:21:18 +00:00
ad 46540aaf0e brelse: always wakeup on b_busy, in case BC_WANTED is not set. 2008-05-26 14:56:55 +00:00
ad 95488a6b7b Broken assertion. 2008-05-26 12:58:24 +00:00
ad 93e0e98369 Take the mutex pointer and waiters count out of sleepq_t: the values can
be or are maintained elsewhere. Now a sleepq_t is just a TAILQ_HEAD.
2008-05-26 12:08:38 +00:00
christos 0d264cffef PR/38745: Kouichirou Hiratsuka: chroot(8) can leak information of outside of
chrooted directory
2008-05-26 02:29:13 +00:00
christos 0e41ecf58b use PNBUF_* instead of malloc 2008-05-26 02:27:36 +00:00
ad c7615c48c8 PR kern/38707 scheduler related deadlock during build.sh
Fail sched_catchlwp() if mutex_tryenter() on the remote CPU's state fails.
Seems to work around the issue described in this PR.

XXX Stealing jobs from remote CPUs could probably be moved into the idle
loop, making the locking quite a bit simpler.
2008-05-25 23:46:55 +00:00
ad 1cc9a3ae7e If converting a process/thread from SCHED_OTHER to a realtime thread,
ignore the existing priority. If no priority is specified, give threads
the minimum user RT priority.
2008-05-25 23:34:24 +00:00
ad 90035a10c9 sched_tick:
- Do timeslicing for SCHED_RR threads. At ~16Hz it's too slow but better
  than nothing. XXX

- If a SCHED_OTHER thread has hogged the CPU for 1/8s without taking a
  trip through mi_switch(), try to force a kernel preemption to give other
  threads a chance.
2008-05-25 22:04:50 +00:00
christos 6e0baf783e don't forget to fill in the emulation. 2008-05-25 20:18:33 +00:00
ad 5e4b324300 Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
2008-05-25 19:22:21 +00:00
jmcneill 1e2888bbbd Export device-driver and device-unit properties via drvctl 2008-05-25 15:03:01 +00:00
jmcneill 3a8a32076d Add DRVGETEVENT support for /dev/drvctl, based on devmon support by
Jachym Holecek for Google Summer of Code. DRVGETEVENT plist is currently
limited to event type, device name, and device parent name.
2008-05-25 12:30:40 +00:00
christos 934b677fde Coverity CID 5015: Remove unnecessary test; if l was null we would have
crashed before when p = l->l_proc.
2008-05-24 18:43:02 +00:00
christos 2847938186 Coverity CID 5019: Check before deref. 2008-05-24 16:49:30 +00:00
christos a2c63c0004 Coverity CID 5025: sbreserve is never called with a null socket. 2008-05-24 16:35:28 +00:00
ad 25866fbff7 Set cpu_onproc on entry to the idle loop. 2008-05-24 12:59:06 +00:00
njoly 12da67c77e Make msgsnd return EINVAL instead of 0, when the value of mtype is
less than 1.
2008-05-22 11:25:54 +00:00
ad 697d5e2cd4 PR kern/38663 Kernel preemption can't be enabled on x86 because of amd64
FPU handling

Ugly hack until the amd64 fpu handling is working (which should be soon):
enable kernel preemption on i386.
2008-05-21 15:41:03 +00:00
ad d88444761b Ignore return from module_load() and just try vfsop lookup again. 2008-05-20 19:30:03 +00:00
ad ce7cbbfb63 Back out unintentional change. 2008-05-20 19:21:23 +00:00
ad 61270d54f1 If autoloading a module, don't consider the current working directory. 2008-05-20 19:20:38 +00:00
ad 88435c0e48 Remove stale comment. 2008-05-20 19:16:07 +00:00
ad a72f5a57fb Don't try to load a module while holding a vnode lock. 2008-05-20 17:28:59 +00:00
ad 7bf8432671 If mount fails because the needed file system code isn't in kernel, try
to autoload with the needed vfsops.
2008-05-20 17:25:49 +00:00
ad 67280de1f2 Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.
2008-05-20 17:24:56 +00:00