RE: lock order reversal? current with tl ethernet

2003-03-13 Thread Tod McQuillin
On Wed, 12 Mar 2003, John Baldwin wrote:

 It's holding the lock across bus_setup_intr().  You can try the
 following patch:

 Index: if_tl.c
 ===
 RCS file: /usr/cvs/src/sys/pci/if_tl.c,v
 retrieving revision 1.74
 diff -u -r1.74 if_tl.c
 --- if_tl.c 19 Feb 2003 05:47:41 -  1.74
 +++ if_tl.c 12 Mar 2003 15:20:47 -
 @@ -1138,12 +1138,11 @@

 if (t-tl_name == NULL) {
 device_printf(dev, unknown device!?\n);
 -   goto fail;
 device_printf(dev, unknown device!?\n);
 -   goto fail;
 RCS file: /usr/cvs/src/sys/pci/if_tl.c,v
 retrieving revision 1.74
 diff -u -r1.74 if_tl.c
 --- if_tl.c 19 Feb 2003 05:47:41 -  1.74
 +++ if_tl.c 12 Mar 2003 15:20:47 -
 @@ -1138,12 +1138,11 @@

 if (t-tl_name == NULL) {
 device_printf(dev, unknown device!?\n);
 -   goto fail;
 +   return (ENXIO);
 }

 mtx_init(sc-tl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 MTX_DEF | MTX_RECURSE);
 -   TL_LOCK(sc);

 /*
  * Map control/status registers.
 @@ -1348,12 +1347,12 @@
 /*
  * Call MI attach routine.
  */

Thanks John --

This patch looks a little bit mangled to me.  It has two sections talking
about line 1138 of if_tl.c (with two different changes) and a section
talking about line 1348 (with no changes).

I assumed cut and paste error and proceeded along the same lines with this
patch instead:

Index: if_tl.c
===
RCS file: /usr/src/cvs-repo/src/sys/pci/if_tl.c,v
retrieving revision 1.74
diff -u -r1.74 if_tl.c
--- if_tl.c 19 Feb 2003 05:47:41 -  1.74
+++ if_tl.c 13 Mar 2003 00:26:20 -
@@ -1138,12 +1138,11 @@

if (t-tl_name == NULL) {
device_printf(dev, unknown device!?\n);
-   goto fail;
+   return (ENXIO);
}

mtx_init(sc-tl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
-   TL_LOCK(sc);

/*
 * Map control/status registers.
@@ -1349,11 +1348,9 @@
 * Call MI attach routine.
 */
ether_ifattach(ifp, sc-arpcom.ac_enaddr);
-   TL_UNLOCK(sc);
return(0);

 fail:
-   TL_UNLOCK(sc);
mtx_destroy(sc-tl_mtx);
return(error);
 }


This has made the messages go away -- thanks for that!  If this is a
correct fix, should I submit a PR to have it committed?
-- 
Tod McQuillin


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


RE: lock order reversal? current with tl ethernet

2003-03-12 Thread John Baldwin

On 12-Mar-2003 Tod McQuillin wrote:
 
 Running -current from March 11 on a dual cpu compaq 5100, there are some
 warnings in the dmesg about the tl ethernet interface.
 
 Here are the warnings:
 
 malloc() of 128 with the following non-sleepablelocks held:
 exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @
 /usr/src/5-current/src/sys/pci/if_tl.c:1146

It's holding the lock across bus_setup_intr().  You can try the
following patch:

Index: if_tl.c
===
RCS file: /usr/cvs/src/sys/pci/if_tl.c,v
retrieving revision 1.74
diff -u -r1.74 if_tl.c
--- if_tl.c 19 Feb 2003 05:47:41 -  1.74
+++ if_tl.c 12 Mar 2003 15:20:47 -
@@ -1138,12 +1138,11 @@
 
if (t-tl_name == NULL) {
device_printf(dev, unknown device!?\n);
-   goto fail;
device_printf(dev, unknown device!?\n);
-   goto fail;
RCS file: /usr/cvs/src/sys/pci/if_tl.c,v
retrieving revision 1.74
diff -u -r1.74 if_tl.c
--- if_tl.c 19 Feb 2003 05:47:41 -  1.74
+++ if_tl.c 12 Mar 2003 15:20:47 -
@@ -1138,12 +1138,11 @@
 
if (t-tl_name == NULL) {
device_printf(dev, unknown device!?\n);
-   goto fail;
+   return (ENXIO);
}
 
mtx_init(sc-tl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
-   TL_LOCK(sc);
 
/*
 * Map control/status registers.
@@ -1348,12 +1347,12 @@
/*
 * Call MI attach routine.
 */

-- 

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


lock order reversal? current with tl ethernet

2003-03-11 Thread Tod McQuillin

Running -current from March 11 on a dual cpu compaq 5100, there are some
warnings in the dmesg about the tl ethernet interface.

Here are the warnings:

malloc() of 128 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
malloc() of PROC with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
lock order reversal
 1st 0xc4017aa8 tl0 (network driver) @ /usr/src/5-current/src/sys/pci/if_tl.c:1146
 2nd 0xc043f8c0 allproc (allproc) @ /usr/src/5-current/src/sys/kern/kern_fork.c:328
Stack backtrace:
malloc() of 64 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
malloc() of 256 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
malloc() of 64 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
malloc() of 512 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:658

I'm willing to work on this myself if someone can give me a pointer to
technical docs describing how things are supposed to work.

I have not yet attempted to use the tl0 interface since I also have an
fxp in the system, but I do plan on using it later.

Here's the complete dmesg with warnings intact:

Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 5.0-CURRENT #0: Tue Mar 11 18:56:10 JST 2003
[EMAIL PROTECTED]:/usr/obj/usr/src/5-current/src/sys/BOROSILICATE
Preloaded elf kernel /boot/kernel/kernel at 0xc0565000.
Timecounter i8254  frequency 1193182 Hz
CPU: Pentium II/Pentium II Xeon/Celeron (299.94-MHz 686-class CPU)
  Origin = GenuineIntel  Id = 0x634  Stepping = 4
  Features=0x80fbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,MMX
real memory  = 536870912 (512 MB)
avail memory = 515575808 (491 MB)
APIC_IO: MP table broken: 8259-APIC entry missing!
Programming 24 pins in IOAPIC #0
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): apic id:  1, version: 0x00040011, at 0xfee0
 cpu1 (AP):  apic id:  0, version: 0x00040011, at 0xfee0
 io0 (APIC): apic id:  8, version: 0x00170011, at 0xfec0
Allocating major#253 to net
Allocating major#252 to pci
Pentium Pro MTRR support enabled
npx0: math processor on motherboard
npx0: INT 16 interface
pcibios: BIOS version 2.10
pcib0: ServerWorks NB6536 2.0HE host to PCI bridge at pcibus 0 on motherboard
pci0: PCI bus on pcib0
IOAPIC #0 intpin 19 - irq 2
IOAPIC #0 intpin 18 - irq 11
IOAPIC #0 intpin 17 - irq 15
pci0: display, VGA at device 3.0 (no driver attached)
pci0: display, VGA at device 4.0 (no driver attached)
fxp0: Intel 82557/8/9 EtherExpress Pro/100(B) Ethernet port 0x6020-0x603f mem 
0xe020-0xe02f,0xe048-0xe0480fff irq 15 at device 5.0 on pci0
fxp0: Ethernet address 00:a0:c9:c8:b6:2f
inphy0: i82555 10/100 media interface on miibus0
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
atapci0: Promise TX2 UDMA100 controller port 
0x6010-0x601f,0x6054-0x6057,0x6048-0x604f,0x6050-0x6053,0x6040-0x6047 mem 
0xe040-0xe0403fff irq 16 at device 6.0 on pci0
ata2: at 0x6040 on atapci0
ata3: at 0x6048 on atapci0
isab0: PCI-ISA bridge at device 15.0 on pci0
isa0: ISA bus on isab0
atapci1: GENERIC ATA controller port 0x6000-0x600f,0-0x3,0-0x7,0-0x3,0-0x7 irq 15 at 
device 15.1 on pci0
ata0: at 0x1f0 irq 14 on atapci1
ata1: simplex device, DMA on primary only
ata1: at 0x170 irq 15 on atapci1
pcib1: ServerWorks NB6536 2.0HE host to PCI bridge at pcibus 1 on motherboard
pci1: PCI bus on pcib1
IOAPIC #0 intpin 23 - irq 17
IOAPIC #0 intpin 20 - irq 18
IOAPIC #0 intpin 21 - irq 19
ohci0: OHCI (generic) USB controller mem 0xe000-0xefff irq 17 at device 10.0 
on pci1
usb0: OHCI version 1.0, legacy support
usb0: OHCI (generic) USB controller on ohci0
usb0: USB revision 1.0
uhub0: (0x0e11) OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
tl0: Compaq Netelligent 10/100 TX UTP port 0x5400-0x540f mem 0xe018-0xe018000f 
irq 18 at device 11.0 on pci1
malloc() of 128 with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
malloc() of PROC with the following non-sleepablelocks held:
exclusive sleep mutex tl0 (network driver) r = 0 (0xc4017aa8) locked @ 
/usr/src/5-current/src/sys/pci/if_tl.c:1146
lock order reversal
 1st