Re: 8.0-CURRENT kernel panic on system boot



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 ?

Attachment: pgpSa5aB242CI.pgp
Description: PGP signature



Relevant Pages

  • 8.0-CURRENT kernel panic on system boot
    ... I update to the newest source tree and rebuild kernel.kernel panic on system startup.Should I rebuild world? ... Sleeping thread (tid 100068,pid 1145) owns a non-sleepable lock ... spin locks held: ...
    (freebsd-current)
  • Re: 8.0-CURRENT kernel panic on system boot
    ... I update to the newest source tree and rebuild kernel(with zfs ... Sleeping thread (tid 100068,pid 1145) owns a non-sleepable lock ... spin locks held: ...
    (freebsd-current)
  • Re: 8.0-CURRENT kernel panic on system boot
    ... I update to the newest source tree and rebuild kernel(with zfs ... Sleeping thread (tid 100068,pid 1145) owns a non-sleepable lock ...
    (freebsd-current)
  • Re: Share DOS files on XP Home
    ... with Excel and almost any other program which tries to use the files. ... check default Access open and it is set to shared with no locks. ... the program which maintains them do a rebuild on the file with no ... I also use file recovery utilities check the file and still no ...
    (microsoft.public.windowsxp.general)
  • Re: Lock method for 1 million items
    ... struct TST { ... pthread_t tid; ... rwmtxtbl::locker locks; ... union TID tid; ...
    (comp.programming.threads)