Date: Thu, 21 Aug 2008 17:18:12 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: kevin <kevinxlinuz@163.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: <20080821141812.GK1803@deviant.kiev.zoral.com.ua> In-Reply-To: <48AD7892.4080802@163.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--PBu/a+gn9/ndsyD5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: > > =20 > >>Hi, > >> I update to the newest source tree and rebuild kernel(with zfs=20 > >>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 =3D 0x80094dd0c, rsp =3D= =20 > >>0x7fffffffcdf8, rbp =3D 0x62d548 --- > >>panic: sleeping thread > >>cpuid =3D 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 =3D 0x8009115c, rsp =3D=20 > >>0x7fffffffcf18, rbp =3D 0x26 --- > >>db>show locks > >>exclusive sx proctree (proctree) r =3D 0 (0xffffffff8099fc80) locked=20 > >>@/usr/src/sys/kern/kern_exit.c:702 > >>db>show allpcpu > >>Current CPU:0 > >>cpuid =3D 0 > >>curthread =3D0xffffff000f073700:pid 1143 "sh" > >>curpcb =3D0xfffffffea6084d40 > >>fpcurthread =3D none > >>idlethread =3D 0xffffff0002395380:pid 11 "idle: cpu0" > >>spin locks held: > >> > >>cpuid =3D 1 > >>curthread =3D0xffffff0002395700:pid 1143 "idle: cpu1" > >>curpcb =3D0xfffffffe4001dd40 > >>fpcurthread =3D none > >>idlethread =3D 0xffffff0002395700:pid 11 "idle: cpu1" > >>spin locks held: > >> > >> =20 > > > >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. > > */ > >=20 > >+ 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 =3D tty_udev(p->p_pgrp->pg_session->s_ttyp); > >+ else > >+ acct.ac_tty =3D NODEV; > >+ sx_sunlock(&proctree_lock); > >+ > >+ /* (2) The name of the command that ran */ > > bcopy(p->p_comm, acct.ac_comm, sizeof acct.ac_comm); > >=20 > >- /* (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 =3D encode_timeval(ut); > > acct.ac_stime =3D encode_timeval(st); > >=20 > >- /* (3) The elapsed time the command ran (and its starting time) */ > >+ /* (4) The elapsed time the command ran (and its starting time) */ > > tmp =3D boottime; > > timevaladd(&tmp, &p->p_stats->p_start); > > acct.ac_btime =3D tmp.tv_sec; > >@@ -383,7 +392,7 @@ acct_process(struct thread *td) > > timevalsub(&tmp, &p->p_stats->p_start); > > acct.ac_etime =3D encode_timeval(tmp); > >=20 > >- /* (4) The average amount of memory used */ > >+ /* (5) The average amount of memory used */ > > tmp =3D 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 =3D 0; > >=20 > >- /* (5) The number of disk I/O operations done */ > >+ /* (6) The number of disk I/O operations done */ > > acct.ac_io =3D encode_long(ru.ru_inblock + ru.ru_oublock); > >=20 > >- /* (6) The UID and GID of the process */ > >+ /* (7) The UID and GID of the process */ > > acct.ac_uid =3D p->p_ucred->cr_ruid; > > acct.ac_gid =3D p->p_ucred->cr_rgid; > >=20 > >- /* (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 =3D tty_udev(p->p_pgrp->pg_session->s_ttyp); > >- else > >- acct.ac_tty =3D NODEV; > >- sx_sunlock(&proctree_lock); > >- > > /* (8) The boolean flags that tell how the process terminated, etc.=20 > > */ > > acct.ac_flagx =3D p->p_acflag; > > PROC_UNLOCK(p); > > =20 > 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 ? --PBu/a+gn9/ndsyD5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkiteSMACgkQC3+MBN1Mb4iF7gCghV03KBbG1VcIqZ68vfDAGy27 p0YAnj159XlON2WoNu1x3YUNCrQ2Deu0 =dPBF -----END PGP SIGNATURE----- --PBu/a+gn9/ndsyD5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080821141812.GK1803>