panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread David Wolfskill

On my laptop (but not the build machine; the latter may not have any USB
devices) I get the following panic after builing, installing,  trying
to boot -CURRENT from today.  (CVSup log below panic trace.)

an0: Ethernet address 00:40:96:32:19:a9
bpf: an0 attached
panic: sleeping without a mutex
Debugger(panic)
Stopped at  Debugger+0x40:  xorl%eax,%eax
db trace
Debugger(c03d647c) at Debugger+0x40
panic(c03d6cac,c021ffec,c8e4e000,c8e4e100,c8e4e000) at panic+0x70
msleep(c0442d98,0,5c,c03c7784,0) at msleep+0x23
usb_task_thread(0,c8e6ad48,c8e4e100,c021ffec,0) at usb_task_thread+0x23
fork_exit(c021ffec,0,c8e6ad48) at fork_exit+0x8c
fork_trampoline() at fork_trampoline+0x37
dbshow locks
dbshow witness [scrolls off screen]
db

[Above was hand-transcribed; I don't have a serial console on my laptop,
and I'm not running VMware.]

Recent CVSup history:
freebeast(4.5-S)[1] tail /var/log/cvsup-history.log
CVSup begin from cvsup14.freebsd.org at Thu Apr  4 03:47:06 PST 2002
CVSup ended from cvsup14.freebsd.org at Thu Apr  4 03:53:56 PST 2002
CVSup begin from cvsup14.freebsd.org at Fri Apr  5 03:47:02 PST 2002
CVSup ended from cvsup14.freebsd.org at Fri Apr  5 03:54:13 PST 2002
CVSup begin from cvsup14.freebsd.org at Sat Apr  6 03:47:02 PST 2002
CVSup ended from cvsup14.freebsd.org at Sat Apr  6 03:54:32 PST 2002
CVSup begin from cvsup14.freebsd.org at Sun Apr  7 03:47:03 PDT 2002
CVSup ended from cvsup14.freebsd.org at Sun Apr  7 03:53:32 PDT 2002
CVSup begin from cvsup14.freebsd.org at Mon Apr  8 03:47:02 PDT 2002
CVSup ended from cvsup14.freebsd.org at Mon Apr  8 03:53:43 PDT 2002
freebeast(4.5-S)[2] 

I can leave it in this condition for a while, if it would be helpful to
poke around at all.

Cheers,
david
-- 
David H. Wolfskill  [EMAIL PROTECTED]
Based on my experience as a computing professional, I consider the use of
Microsoft products as components of computing systems to be just as
advisable as using green wood to frame a house... and expect similar results.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



RE: panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread John Baldwin


On 08-Apr-2002 David Wolfskill wrote:
 On my laptop (but not the build machine; the latter may not have any USB
 devices) I get the following panic after builing, installing,  trying
 to boot -CURRENT from today.  (CVSup log below panic trace.)
 
 an0: Ethernet address 00:40:96:32:19:a9
 bpf: an0 attached
 panic: sleeping without a mutex
 Debugger(panic)
 Stopped atDebugger+0x40:  xorl%eax,%eax
 db trace
 Debugger(c03d647c) at Debugger+0x40
 panic(c03d6cac,c021ffec,c8e4e000,c8e4e100,c8e4e000) at panic+0x70
 msleep(c0442d98,0,5c,c03c7784,0) at msleep+0x23
 usb_task_thread(0,c8e6ad48,c8e4e100,c021ffec,0) at usb_task_thread+0x23
 fork_exit(c021ffec,0,c8e6ad48) at fork_exit+0x8c
 fork_trampoline() at fork_trampoline+0x37
 dbshow locks
 dbshow witness [scrolls off screen]
 db
 
 [Above was hand-transcribed; I don't have a serial console on my laptop,
 and I'm not running VMware.]
 
 Recent CVSup history:
 freebeast(4.5-S)[1] tail /var/log/cvsup-history.log
 CVSup begin from cvsup14.freebsd.org at Thu Apr  4 03:47:06 PST 2002
 CVSup ended from cvsup14.freebsd.org at Thu Apr  4 03:53:56 PST 2002
 CVSup begin from cvsup14.freebsd.org at Fri Apr  5 03:47:02 PST 2002
 CVSup ended from cvsup14.freebsd.org at Fri Apr  5 03:54:13 PST 2002
 CVSup begin from cvsup14.freebsd.org at Sat Apr  6 03:47:02 PST 2002
 CVSup ended from cvsup14.freebsd.org at Sat Apr  6 03:54:32 PST 2002
 CVSup begin from cvsup14.freebsd.org at Sun Apr  7 03:47:03 PDT 2002
 CVSup ended from cvsup14.freebsd.org at Sun Apr  7 03:53:32 PDT 2002
 CVSup begin from cvsup14.freebsd.org at Mon Apr  8 03:47:02 PDT 2002
 CVSup ended from cvsup14.freebsd.org at Mon Apr  8 03:53:43 PDT 2002
 freebeast(4.5-S)[2] 
 
 I can leave it in this condition for a while, if it would be helpful to
 poke around at all.

show witness isn't useful to most people so I would avoid it unless someone
explicitly asks for it.  The problem here is likely due to the
usb_task_thread() not locking Giant when it starts up.

-- 

John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
Power Users Use the Power to Serve!  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread Josef Karthauser

On Mon, Apr 08, 2002 at 12:33:40PM -0400, John Baldwin wrote:
 
 show witness isn't useful to most people so I would avoid it unless someone
 explicitly asks for it.  The problem here is likely due to the
 usb_task_thread() not locking Giant when it starts up.

We probably want this:


Index: usb.c
===
RCS file: /home/ncvs/src/sys/dev/usb/usb.c,v
retrieving revision 1.75
diff -u -5 -r1.75 usb.c
--- usb.c   7 Apr 2002 14:21:32 -   1.75
+++ usb.c   8 Apr 2002 17:58:38 -
 -423,10 +423,14 
 usb_task_thread(void *arg)
 {
struct usb_task *task;
int s;
 
+#ifdef __FreeBSD__
+   mtx_lock(Giant);
+#endif
+
DPRINTF((usb_task_thread: start\n));
 
s = splusb();
for (;;) {
task = TAILQ_FIRST(usb_all_tasks);


Joe



msg37102/pgp0.pgp
Description: PGP signature


Re: panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread John Baldwin


On 08-Apr-2002 Josef Karthauser wrote:
 On Mon, Apr 08, 2002 at 12:33:40PM -0400, John Baldwin wrote:
  
 show witness isn't useful to most people so I would avoid it unless someone
 explicitly asks for it.  The problem here is likely due to the
 usb_task_thread() not locking Giant when it starts up.
 
 We probably want this:

Probably unless some USB specific locks are added instead, but this is the
easier fix for the time being.

 Index: usb.c
 ===
 RCS file: /home/ncvs/src/sys/dev/usb/usb.c,v
 retrieving revision 1.75
 diff -u -5 -r1.75 usb.c
 --- usb.c 7 Apr 2002 14:21:32 -   1.75
 +++ usb.c 8 Apr 2002 17:58:38 -
 @@ -423,10 +423,14 @@
  usb_task_thread(void *arg)
  {
   struct usb_task *task;
   int s;
  
 +#ifdef __FreeBSD__
 + mtx_lock(Giant);
 +#endif
 +
   DPRINTF((usb_task_thread: start\n));
  
   s = splusb();
   for (;;) {
   task = TAILQ_FIRST(usb_all_tasks);
 
 
 Joe

-- 

John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
Power Users Use the Power to Serve!  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread Josef Karthauser

On Mon, Apr 08, 2002 at 01:37:55PM -0400, John Baldwin wrote:
 
 On 08-Apr-2002 Josef Karthauser wrote:
  On Mon, Apr 08, 2002 at 12:33:40PM -0400, John Baldwin wrote:
   
  show witness isn't useful to most people so I would avoid it unless someone
  explicitly asks for it.  The problem here is likely due to the
  usb_task_thread() not locking Giant when it starts up.
  
  We probably want this:
 
 Probably unless some USB specific locks are added instead, but this is the
 easier fix for the time being.
 

Cool.  I've committed this; where should I look to get a low down on
what to lock, when and how?  Is there anything other than source to
refer to?

Joe



msg37104/pgp0.pgp
Description: PGP signature


Re: panic sleeping without a mutex in usb_task_thread

2002-04-08 Thread John Baldwin


On 08-Apr-2002 Josef Karthauser wrote:
 On Mon, Apr 08, 2002 at 01:37:55PM -0400, John Baldwin wrote:
 
 On 08-Apr-2002 Josef Karthauser wrote:
  On Mon, Apr 08, 2002 at 12:33:40PM -0400, John Baldwin wrote:
   
  show witness isn't useful to most people so I would avoid it unless
  someone
  explicitly asks for it.  The problem here is likely due to the
  usb_task_thread() not locking Giant when it starts up.
  
  We probably want this:
 
 Probably unless some USB specific locks are added instead, but this is the
 easier fix for the time being.
 
 
 Cool.  I've committed this; where should I look to get a low down on
 what to lock, when and how?  Is there anything other than source to
 refer to?

Nothing besides the source really.  If it's walking a list you might use a lock
to protect the list for example, but then you might need to conditionally get
Giant while performing an action on the list.

 Joe

-- 

John Baldwin [EMAIL PROTECTED]http://www.FreeBSD.org/~jhb/
Power Users Use the Power to Serve!  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message