Re: ndis0 panics -current

From: Niki Denev <nike_d_at_cytexbg.com>
Date: Wed, 28 Apr 2004 20:07:58 +0300
Niki Denev writes:

> 
> Hello,
> 
> Here is what i get with today cvsupped and rebuilt -CURRENT on IBM TP X31,
> Kernel is GENERIC, dmesg, loader.conf, and the WinXP Centrino drivers
> can be found at : http://www.totalterror.net/freebsd/
> Basically all i do is to load the if_ndis module (ndis.ko preloaded in 
> loader.conf) , set the ssid and wepkey and bring the interface up, and it 
> seems that just before the "ndis0: link up" console message, the machine 
> panics.
> 
> -----------------------------------------------------------------
> [root_at_phobos /usr/src/sys/modules/if_ndis]# make clean && make
> ...
> [root_at_phobos /usr/src/sys/modules/if_ndis]# make load
> /sbin/kldload -v /usr/src/sys/modules/if_ndis/if_ndis.ko
> pci0: driver added
> pci0:29:7: reprobing on driver added
> pci0:31:3: reprobing on driver added
> pci0:31:6: reprobing on driver added
> pci1: driver added
> pci2: driver added
> pci2:2:0: reprobing on driver added
> ndis0: <Intel(R) PRO/Wireless LAN 2100 3B Mini PCI Adapter> mem 0xc0200000-0xc02
> 00fff irq 11 at device 2.0 on pci2
> ndis0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xc0200000
> ndis0: [GIANT-LOCKED]
> can't re-use a leaf (ESS_ID)!
> ndis0: NDIS API version: 5.1
> ndis0: Ethernet address: 00:04:23:92:33:23
> ndis0: 11b rates: 11Mbps 2Mbps 1Mbps
> Loaded /usr/src/sys/modules/if_ndis/if_ndis.ko, id=9
> [root_at_phobos] /usr/src/sys/modules/if_ndis]# ifconfig ndis0 ssid my_ssid wepmode on wepkey 0x************************** up
> ndis0: set filter failed: 6 
> ndis0: set filter failed: 6
> ndis0: set filter failed: 6
> [root_at_phobos] /usr/src/sys/modules/if_ndis]#panic: lock (sleep mutex) Giant not locked _at_ /usr/src/sys/dev/if_ndis/if_ndis.c:1035
> at line 1038 in file /usr/src/sys/kern/subr_witness.c
> cpuid = 0;
> Debugger("panic")
> Stopped at      Debugger+0x46: xchgl   %ebx,in_Debugger.0
> db> trace
> Debugger(c07c28d5) at Debugger+0x46
> __panic(c07c5ee6,40e,c07c6487,c07da514,c07c1f57) at __panic+0x13d
> witness_unlock(c0880980,0,c4a32f5f,40b) at witness_unlock+0xc6
> _mtx_unlock_flags(c0880980,0,c4a32f5f,40b,0) at _mtx_unlock_flags+0x67
> ndis_ticktask(c4cf4000,c43991b8,c09cd054,0,d7e3ed34) at ndis_ticktask+0x1e
> ndis_runq(c09d1d1c,d7e3ed48,c09d1d1c,c09cd054,0) at ndis_runq+0x79
> fork_exit(c09cd054,c09d1d1c,d7e3ed48) at fork_exit+0xa8
> fork_trampoline() at fork_trampoline+0x8
> --- trap 0x1, eip = 0, esp = 0xd7e3ed7c, ebp = 0 ---
> db>
> ----------------------------------------------------------------
> p.s. the trace is written by hand
> because i don't have com port.
>

I took a peek at if_ndis.c,(around line 1035) and without pretending to know 
anything about, kernel and device drivers, it seemed a little odd to me,
why the order of locking is  mtx_unlock(&Giant), NDIS_LOCK, NDIS_UNLOCK, 
mtx_lock(&Giant).
So, i've switched the Giant locks places and my wireless is working again, 
but i'm not sure that fix is correct?

anyway, here are the changes that i've made:

--- sys/dev/if_ndis/if_ndis.c	Wed Apr 28 19:48:32 2004
+++ sys/dev/if_ndis/if_ndis.c.orig	Wed Apr 28 19:48:10 2004
_at__at_ -1032,7 +1032,7 _at__at_
 	ndis_media_state	linkstate;
 	int			error, len;
 
-	mtx_unlock(&Giant);
+	mtx_lock(&Giant);
 
 	sc = xsc;
 
_at__at_ -1068,7 +1068,7 _at__at_
 
 	NDIS_UNLOCK(sc);
 
-	mtx_lock(&Giant);
+	mtx_unlock(&Giant);
 
 	return;
 }


Received on Wed Apr 28 2004 - 08:07:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:52 UTC