Re: [panic] ipw and kismet

2006-04-09 Thread Ulrich Spoerlein
Max Laier wrote:
 Could you try the attached patch, please?  This is something I did for
 iwi and just moved the general idea over without testing or close
 evaluation.  So be aware and let me know either way.  Thanks.

Great, Thanks!

I ran with this patch and loaded different fimwares, upped and downed
the interface like mad and not a single panic!

I only ran with INVARIANTS, I'm currently recompiling with
INVARIANTS+WITNESS and will give it another try, but it seems to work
just fine.

Please commit this, and I hope if will make it into 6.1-RELEASE. Thanks
again!

Ulrich Spoerlein
-- 
 PGP Key ID: 20FEE9DD   Encrypted mail welcome!
Fingerprint: AEC9 AF5E 01AC 4EE1 8F70  6CBD E76E 2227 20FE E9DD
Which is worse: ignorance or apathy?
Don't know. Don't care.


pgpupzdQTQiWS.pgp
Description: PGP signature


Re: [panic] ipw and kismet

2006-04-09 Thread Max Laier
On Saturday 08 April 2006 13:49, Ulrich Spoerlein wrote:
 Max Laier wrote:
  Could you try the attached patch, please?  This is something I did for
  iwi and just moved the general idea over without testing or close
  evaluation.  So be aware and let me know either way.  Thanks.

 Great, Thanks!

 I ran with this patch and loaded different fimwares, upped and downed
 the interface like mad and not a single panic!

 I only ran with INVARIANTS, I'm currently recompiling with
 INVARIANTS+WITNESS and will give it another try, but it seems to work
 just fine.

 Please commit this, and I hope if will make it into 6.1-RELEASE. Thanks
 again!

This is partly fixed in CURRENT already, but needs more work to be MFCed.  Is 
there any chance that you can test CURRENT plus this patch as well?  I will 
then commit and MFC, but doubt that it will make 6.1 - too late I'm afraid.

Note, you need the new fireware modules (net/ipw-firmware-kmod) in CURRENT.

-- 
/\  Best regards,  | [EMAIL PROTECTED]
\ /  Max Laier  | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | [EMAIL PROTECTED]
/ \  ASCII Ribbon Campaign  | Against HTML Mail and News


pgphzWCyVJufn.pgp
Description: PGP signature


Re: [panic] ipw and kismet

2006-04-09 Thread Ulrich Spoerlein
Max Laier wrote:
 This is partly fixed in CURRENT already, but needs more work to be MFCed.  Is 
 there any chance that you can test CURRENT plus this patch as well?

Not in the near future, I'm sorry. But I'll watch the cvs-logs and
report back to you, as soon as I tried CURRENT on this laptop.

Ulrich Spoerlein
-- 
 PGP Key ID: 20FEE9DD   Encrypted mail welcome!
Fingerprint: AEC9 AF5E 01AC 4EE1 8F70  6CBD E76E 2227 20FE E9DD
Which is worse: ignorance or apathy?
Don't know. Don't care.


pgpTI6bch2MXJ.pgp
Description: PGP signature


Re: [panic] ipw and kismet

2006-04-07 Thread Max Laier
On Thursday 06 April 2006 14:14, Ulrich Spoerlein wrote:
 Hello,

 I almost always get a panic when running kismet on my ipw-Interface
 under 6.1-PRERELEASE. This has been the case ever since ipw hit the
 tree. Sometimes kismet works, sometimes it doesn't. A sure way to
 trigger the panic is to switch between bss/ibss/monitor mode prior to
 running kismet. Perhaps there is a bug in the re-initialization when
 loading a different firmware?

 Is this panic known? Does the new firmware-framework address this?

The trace below seems unrelated to firmware loading, but there have been some 
problems with firmware loading before and we hope to improve things with the 
new firmware framework.

Could you try the attached patch, please?  This is something I did for iwi and 
just moved the general idea over without testing or close evaluation.  So be 
aware and let me know either way.  Thanks.

 ipw0: Intel(R) PRO/Wireless 2100 MiniPCI mem 0xfaffc000-0xfaffcfff irq 9
 at device 3.0 on pci2 ...
 panic: mutex ipw0 recursed at /usr/src/sys/kern/kern_synch.c:177
 KDB: enter: panic
 [thread pid 1527 tid 100119 ]
 Stopped at  kdb_enter+0x2b: nop
 db tr
 Tracing pid 1527 tid 100119 td 0xc5cca300
 kdb_enter(c06d3e90) at kdb_enter+0x2b
 panic(c06d332c,c4c5d600,c06d4661,b1,0) at panic+0xbb
 _mtx_assert(c4d3cc74,9,c06d4661,b1,0) at _mtx_assert+0x83
 msleep(c4d3c000,c4d3cc74,0,c0912121,3e8) at msleep+0x16a
 ipw_init(c4d3c000,c4d3c000,2080,c4d3c904,c4c2dc00) at ipw_init+0xb63
 ipw_media_change(c4c2dc00,c4f6fd00,80,c4d36600,0) at ipw_media_change+0x8b
 ifmedia_ioctl(c4c2dc00,c4d9a360,c4d3c904,c0206937,0) at ifmedia_ioctl+0x93
 ieee80211_ioctl(c4d3c004,c0206937,c4d9a360,c4d3cc74,c4d3c000) at
 ieee80211_ioctl+0xc1
 ipw_ioctl(c4c2dc00,c0206937,c4d9a360,ef577c38,c051bbee) at ipw_ioctl+0x5c
 ifhwioctl(c0206937,c4c2dc00,c4d9a360,c5cca300,c074a4c0) at ifhwioctl+0x9ac
 ifioctl(c5a4f858,c0206937,c4d9a360,c5cca300,0) at ifioctl+0xc3
 soo_ioctl(c59c0750,c0206937,c4d9a360,c5a41a80,c5cca300) at soo_ioctl+0x2db
 ioctl(c5cca300,ef577d04,3,2,282) at ioctl+0x370
 syscall(3b,3b,3b,bfbf90a0,80dc400) at syscall+0x22f
 Xint0x80_syscall() at Xint0x80_syscall+0x1f
 --- syscall (54, FreeBSD ELF32, ioctl), eip = 0x482d468f, esp = 0xbfbf906c,
 ebp = 0xbfbf90e8 ---


 Ulrich Spoerlein

-- 
/\  Best regards,  | [EMAIL PROTECTED]
\ /  Max Laier  | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | [EMAIL PROTECTED]
/ \  ASCII Ribbon Campaign  | Against HTML Mail and News
Index: if_ipw.c
===
RCS file: /usr/store/mlaier/fcvs/src/sys/dev/ipw/if_ipw.c,v
retrieving revision 1.7.2.4
diff -u -r1.7.2.4 if_ipw.c
--- if_ipw.c	29 Jan 2006 15:13:01 -	1.7.2.4
+++ if_ipw.c	7 Apr 2006 22:27:33 -
@@ -220,7 +220,7 @@
 	sc-sc_dev = dev;
 
 	mtx_init(sc-sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
-	MTX_DEF | MTX_RECURSE);
+	MTX_DEF);
 
 	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
 		device_printf(dev, chip is in D%d power mode 
@@ -380,6 +380,7 @@
 	struct ipw_softc *sc = device_get_softc(dev);
 	struct ieee80211com *ic = sc-sc_ic;
 	struct ifnet *ifp = ic-ic_ifp;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -722,6 +723,7 @@
 {
 	struct ipw_softc *sc = device_get_softc(dev);
 	struct ifnet *ifp = sc-sc_ic.ic_ifp;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -743,6 +745,7 @@
 {
 	struct ipw_softc *sc = ifp-if_softc;
 	int error;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -1222,6 +1225,7 @@
 {
 	struct ipw_softc *sc = arg;
 	uint32_t r;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -1474,6 +1478,7 @@
 	struct mbuf *m0;
 	struct ether_header *eh;
 	struct ieee80211_node *ni;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -1557,6 +1562,7 @@
 	struct ieee80211com *ic = sc-sc_ic;
 	struct ifreq *ifr;
 	int error = 0;
+	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -1769,6 +1775,7 @@
 	struct ipw_firmware_hdr hdr;
 	u_char *p = data;
 	int error;
+	IPW_LOCK_DECL;
 
 	ipw_free_firmware(sc);
 
Index: if_ipwvar.h
===
RCS file: /usr/store/mlaier/fcvs/src/sys/dev/ipw/if_ipwvar.h,v
retrieving revision 1.3
diff -u -r1.3 if_ipwvar.h
--- if_ipwvar.h	10 Jun 2005 16:49:11 -	1.3
+++ if_ipwvar.h	7 Apr 2006 22:23:46 -
@@ -170,5 +170,12 @@
 #define SIOCSLOADFW	 _IOW('i', 137, struct ifreq)
 #define SIOCSKILLFW	 _IOW('i', 138, struct ifreq)
 
-#define IPW_LOCK(sc)	mtx_lock((sc)-sc_mtx)
-#define IPW_UNLOCK(sc)	mtx_unlock((sc)-sc_mtx)
+#define	IPW_LOCK_DECL	int __waslocked = 0
+#define IPW_LOCK(sc)	do {\
+	if (!(__waslocked = mtx_owned((sc)-sc_mtx)))	\
+		mtx_lock((sc)-sc_mtx);		\
+} while (0)
+#define IPW_UNLOCK(sc)	do {			\
+	if (!__waslocked)			\
+		mtx_unlock((sc)-sc_mtx);	\
+} while (0)


pgpRDnZ1xjljg.pgp
Description: PGP signature