Bug #87

kernel panic when running dhclient on tulip

Added by michal almost 9 years ago. Updated about 8 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

hello,

i'm getting kernel panic each time i run dhclient on my dragon fly
installation. probably the most important thing is that it's a
"virtual" pc, under MS virtual pc on Mac OS X.
emulated network card is some "tulip" model.
below you have a link to the screenshoot of that crash, all panic
visible (it's not long).
http://img97.imageshack.us/my.php?image=panic9np.png

looking forward for a patch.

History

#1 Updated by LabThug almost 9 years ago

Michal,

I just fixed a similar thing for my atheros driver. You need to add a

lkwt_serialze_enter(ifp->if_serializer);
lkwt_serialze_exit(ifp->if_serializer);

pair to tulip_rx_intr (which is probably
in /usr/src/sys/dev/netif/tulip/if_tulip.c)

For the atheros code, I was lucky enough to have a NET_GIANT_[UN]LOCK to
swap out. However, putting the enter after ifp has been defined in the
function and the exit at the end should get you on the right path.

I'm nowhere near a DF box atm and can't supply a patch; but am 99% sure
that is what needs to be done.

Good luck,

Adrian

On Mon, 2006-02-06 at 18:20 +0100, Michal Purzynski wrote:
> hello,
>
> i'm getting kernel panic each time i run dhclient on my dragon fly
> installation. probably the most important thing is that it's a
> "virtual" pc, under MS virtual pc on Mac OS X.
> emulated network card is some "tulip" model.
> below you have a link to the screenshoot of that crash, all panic
> visible (it's not long).
> http://img97.imageshack.us/my.php?image=panic9np.png
>
>
> looking forward for a patch.

#2 Updated by dillon almost 9 years ago

I think this one is a bit different. It's in netif/de/if_de.c.

The problem is simply that the IFP's serializer is not being installed
by bus_setup_intr(). Instead it looks like its installing a private
serializer.

I probably did this before the IFP serialization work.

Try the attached patch. I'm not 100% sure the initialization is
ordered properly, but its worth a shot.

-Matt
Matthew Dillon
<>

Index: if_de.c
===================================================================
RCS file: /cvs/src/sys/dev/netif/de/if_de.c,v
retrieving revision 1.41
diff -u -r1.41 if_de.c
--- if_de.c 28 Nov 2005 17:13:42 -0000 1.41
+++ if_de.c 6 Feb 2006 19:49:47 -0000
@@ -129,11 +129,11 @@
{
tulip_softc_t *sc = arg;

- lwkt_serialize_enter(&sc->tulip_serializer);
+ lwkt_serialize_enter(sc->tulip_if.if_serializer);
sc->tulip_flags &= ~TULIP_TIMEOUTPENDING;
sc->tulip_probe_timeout -= 1000 / TULIP_HZ;
(sc->tulip_boardsw->bd_media_poll)(sc, TULIP_MEDIAPOLL_TIMER);
- lwkt_serialize_exit(&sc->tulip_serializer);
+ lwkt_serialize_exit(sc->tulip_if.if_serializer);
}

static void
@@ -3945,6 +3945,13 @@
}

static void
+tulip_detach(tulip_softc_t *sc)
+{
+ ifmedia_removeall(&sc->tulip_ifmedia);
+ ether_ifdetach(&sc->tulip_if);
+}
+
+static void
tulip_initcsrs(tulip_softc_t *sc, tulip_csrptr_t csr_base, size_t csr_size)
{
sc->tulip_csrs.csr_busmode = csr_base + 0 * csr_size;
@@ -4031,12 +4038,12 @@
{
tulip_softc_t *sc = device_get_softc(dev);

- lwkt_serialize_enter(&sc->tulip_serializer);
+ lwkt_serialize_enter(sc->tulip_if.if_serializer);
TULIP_CSR_WRITE(sc, csr_busmode, TULIP_BUSMODE_SWRESET);
DELAY(10); /* Wait 10 microseconds (actually 50 PCI cycles but at
33MHz that comes to two microseconds but wait a
bit longer anyways) */
- lwkt_serialize_exit(&sc->tulip_serializer);
+ lwkt_serialize_exit(sc->tulip_if.if_serializer);
return 0;
}

@@ -4090,7 +4097,6 @@
}

sc = device_get_softc(dev);
- lwkt_serialize_init(&sc->tulip_serializer);
sc->tulip_dev = dev;
sc->tulip_pci_busno = pci_get_bus(dev);
sc->tulip_pci_devno = pci_get_slot(dev);
@@ -4156,7 +4162,6 @@
33MHz that comes to two microseconds but wait a
bit longer anyways) */

- lwkt_serialize_enter(&sc->tulip_serializer);
if ((retval = tulip_read_macaddr(sc)) < 0) {
device_printf(dev, "can't read ENET ROM (why=%d) (", retval);
for (idx = 0; idx < 32; idx++)
@@ -4172,6 +4177,7 @@
if (sc->tulip_features & TULIP_HAVE_SHAREDINTR)
intr_rtn = tulip_intr_shared;

+ tulip_attach(sc);
if ((sc->tulip_features & TULIP_HAVE_SLAVEDINTR) == 0) {
void *ih;

@@ -4180,16 +4186,14 @@
RF_SHAREABLE | RF_ACTIVE);
if (res == 0 || bus_setup_intr(dev, res, INTR_NETSAFE,
intr_rtn, sc, &ih,
- &sc->tulip_serializer)) {
- lwkt_serialize_exit(&sc->tulip_serializer);
+ sc->tulip_if.if_serializer)) {
device_printf(dev, "couldn't map interrupt\n");
+ tulip_detach(sc);
free((caddr_t) sc->tulip_rxdescs, M_DEVBUF);
free((caddr_t) sc->tulip_txdescs, M_DEVBUF);
return ENXIO;
}
}
- tulip_attach(sc);
- lwkt_serialize_exit(&sc->tulip_serializer);
}
return 0;
}

#3 Updated by LabThug almost 9 years ago

This is the perfect example of why I always have at least a 1% doubt in
everything :-)

Adrian

<Snip/>

Also available in: Atom PDF