Date: Thu, 21 Aug 2008 22:53:45 +0800 From: kevin <kevinxlinuz@163.com> To: Kostik Belousov <kostikbel@gmail.com> Cc: Ed Schouten <ed@80386.nl>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: 8.0-CURRENT kernel panic on system boot Message-ID: <48AD8179.8080906@163.com> In-Reply-To: <20080821141812.GK1803@deviant.kiev.zoral.com.ua> References: <747dc8f30808201223i46ba04daw34c267574ba7cc99@mail.gmail.com> <20080820201226.GI99951@hoeg.nl> <20080820203238.GF1803@deviant.kiev.zoral.com.ua> <3c1674c90808201438p2751d7f7x3f5ee892310201c8@mail.gmail.com> <747dc8f30808210529s329bed21iea29ae5c0c28b793@mail.gmail.com> <48AD6EC3.5000507@163.com> <20080821135735.GJ1803@deviant.kiev.zoral.com.ua> <48AD7892.4080802@163.com> <20080821141812.GK1803@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Kostik Belousov wrote: > On Thu, Aug 21, 2008 at 10:15:46PM +0800, kevin wrote: > >> Kostik Belousov wrote: >> >>> On Thu, Aug 21, 2008 at 09:33:55PM +0800, kevin wrote: >>> >>> >>>> Hi, >>>> I update to the newest source tree and rebuild kernel(with zfs >>>> patch).kernel panic on system startup.Should I rebuild world? >>>> ...... >>>> Starting gdm. >>>> Sleeping thread (tid 100068,pid 1145) owns a non-sleepable lock >>>> sched_switch() at sched_switch+0x184 >>>> mi_switch() at mi_switch+0x21b >>>> sleepq_switch() at sleepq_switch+0xfa >>>> sleepq_wait() at sleepq_wait+0x46 >>>> _sx_slock_hard() at _sx_slock_hard+0x169 >>>> _sx_slock() at _sx_slock+0x6b >>>> acct_process() at acct_process+0x24b >>>> exit1() at exit1+0x3e8 >>>> sys_exit() at sys_exit+0xe >>>> syscall() at syscall+0x1dd >>>> Xfast_syscall() at Xfast_syscall+0xab >>>> --- syscall (1, FreeBSD ELF64, sys_exit), rip = 0x80094dd0c, rsp = >>>> 0x7fffffffcdf8, rbp = 0x62d548 --- >>>> panic: sleeping thread >>>> cpuid = 0 >>>> KDB: enter: panic >>>> [thread pid 1143 tid 100127 ] >>>> Stopped at kdb_enter+0x3d: movq $0,0x6cebb4(%rip) >>>> db>bt >>>> Tracing pid 1143 tid 100127 td 0xfffff000f073700 >>>> kdb_enter() at kdb_enter()+0x3d >>>> panic() at panic()+0x16c >>>> propagate_priority() propagate_priority+0x221 >>>> turnstile_wait() at turnstile_wait+0x212 >>>> _mtx_lock_sleep() at _mtx_lock_sleep+0xe0 >>>> _mtx_lock_flags() at _mtx_lock_flags+0xc0 >>>> kern_wait() at kern_wait+0x11b >>>> wait4() at wait4+0x33 >>>> syscall() at syscall()+0x1dd >>>> Xfast_syscall() at Xfast_syscall()+0xab >>>> --- syscall (7, FreeBSD ELF64, wait4), rip = 0x8009115c, rsp = >>>> 0x7fffffffcf18, rbp = 0x26 --- >>>> db>show locks >>>> exclusive sx proctree (proctree) r = 0 (0xffffffff8099fc80) locked >>>> @/usr/src/sys/kern/kern_exit.c:702 >>>> db>show allpcpu >>>> Current CPU:0 >>>> cpuid = 0 >>>> curthread =0xffffff000f073700:pid 1143 "sh" >>>> curpcb =0xfffffffea6084d40 >>>> fpcurthread = none >>>> idlethread = 0xffffff0002395380:pid 11 "idle: cpu0" >>>> spin locks held: >>>> >>>> cpuid = 1 >>>> curthread =0xffffff0002395700:pid 1143 "idle: cpu1" >>>> curpcb =0xfffffffe4001dd40 >>>> fpcurthread = none >>>> idlethread = 0xffffff0002395700:pid 11 "idle: cpu1" >>>> spin locks held: >>>> >>>> >>>> >>> No, this is a consequence of taking sx after proc lock in kern_acct.c, >>> acct_process(). You may turn off accounting, or try this patch: >>> >>> diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c >>> index e505f62..d45e3b7 100644 >>> --- a/sys/kern/kern_acct.c >>> +++ b/sys/kern/kern_acct.c >>> @@ -366,16 +366,25 @@ acct_process(struct thread *td) >>> * Get process accounting information. >>> */ >>> >>> + sx_slock(&proctree_lock); >>> PROC_LOCK(p); >>> - /* (1) The name of the command that ran */ >>> + >>> + /* (1) The terminal from which the process was started */ >>> + if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) >>> + acct.ac_tty = tty_udev(p->p_pgrp->pg_session->s_ttyp); >>> + else >>> + acct.ac_tty = NODEV; >>> + sx_sunlock(&proctree_lock); >>> + >>> + /* (2) The name of the command that ran */ >>> bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm); >>> >>> - /* (2) The amount of user and system time that was used */ >>> + /* (3) The amount of user and system time that was used */ >>> rufetchcalc(p, &ru, &ut, &st); >>> acct.ac_utime = encode_timeval(ut); >>> acct.ac_stime = encode_timeval(st); >>> >>> - /* (3) The elapsed time the command ran (and its starting time) */ >>> + /* (4) The elapsed time the command ran (and its starting time) */ >>> tmp = boottime; >>> timevaladd(&tmp, &p->p_stats->p_start); >>> acct.ac_btime = tmp.tv_sec; >>> @@ -383,7 +392,7 @@ acct_process(struct thread *td) >>> timevalsub(&tmp, &p->p_stats->p_start); >>> acct.ac_etime = encode_timeval(tmp); >>> >>> - /* (4) The average amount of memory used */ >>> + /* (5) The average amount of memory used */ >>> tmp = ut; >>> timevaladd(&tmp, &st); >>> /* Convert tmp (i.e. u + s) into hz units to match ru_i*. */ >>> @@ -394,21 +403,13 @@ acct_process(struct thread *td) >>> else >>> acct.ac_mem = 0; >>> >>> - /* (5) The number of disk I/O operations done */ >>> + /* (6) The number of disk I/O operations done */ >>> acct.ac_io = encode_long(ru.ru_inblock + ru.ru_oublock); >>> >>> - /* (6) The UID and GID of the process */ >>> + /* (7) The UID and GID of the process */ >>> acct.ac_uid = p->p_ucred->cr_ruid; >>> acct.ac_gid = p->p_ucred->cr_rgid; >>> >>> - /* (7) The terminal from which the process was started */ >>> - sx_slock(&proctree_lock); >>> - if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) >>> - acct.ac_tty = tty_udev(p->p_pgrp->pg_session->s_ttyp); >>> - else >>> - acct.ac_tty = NODEV; >>> - sx_sunlock(&proctree_lock); >>> - >>> /* (8) The boolean flags that tell how the process terminated, etc. >>> */ >>> acct.ac_flagx = p->p_acflag; >>> PROC_UNLOCK(p); >>> >>> >> Thanks. After I turned off accounting in /etc/rc.conf. It works. >> > > And, could you, please, give us a service and try to turn accounting > on the patched kernel ? > yes I rebuilt the kernel and it seems well now.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48AD8179.8080906>