On Thu, Mar 31, 2011 at 3:58 PM, John Baldwin <jhb_at_freebsd.org> wrote: > On Thursday, March 31, 2011 7:32:26 am Svatopluk Kraus wrote: >> Hi, >> >> I've got a page fault (because of NULL td_lock) in >> thread_lock_flags() called from schedcpu() in /sys/kern/sched_4bsd.c >> file. During process fork, new thread is linked to new process which >> is linked to allproc list and both allproc_lock and new process lock >> are unlocked before sched_fork() is called, where new thread td_lock >> is initialized. Only PRS_NEW process status is on sentry but not >> checked in schedcpu(). > > I think this should fix it: > > Index: sched_4bsd.c > =================================================================== > --- sched_4bsd.c (revision 220190) > +++ sched_4bsd.c (working copy) > _at__at_ -463,6 +463,10 _at__at_ schedcpu(void) > sx_slock(&allproc_lock); > FOREACH_PROC_IN_SYSTEM(p) { > PROC_LOCK(p); > + if (p->p_state == PRS_NEW) { > + PROC_UNLOCK(p); > + continue; > + } > FOREACH_THREAD_IN_PROC(p, td) { > awake = 0; > thread_lock(td); > Thanks for patch. Maybe, test p_state not to be PRS_NORMAL could be better? I've got next (same reason) page fault in thread_lock_flags() called from scheduler() in sys/vm/vm_glue.c. I try to search for FOREACH_THREAD_IN_PROC() together with FOREACH_PROC_IN_SYSTEM() in /sys subtree and next problem could be in deadlkres() in sys/kern/kern_clock.c at least.Received on Thu Mar 31 2011 - 14:21:46 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:12 UTC