netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spinlock badness in last dongle changes.
@ 2003-10-07  5:26 Stephen Hemminger
  2003-10-07 15:29 ` David S. Miller
  2003-10-08  2:03 ` Jean Tourrilhes
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2003-10-07  5:26 UTC (permalink / raw)
  To: jt, davem; +Cc: netdev

On 2.6.0-test6 bk latest, rmmod of irda hangs on SMP...

A couple of locking problems happened when converted from using
hashbin lock outside of irqueue.  First, the lock was never initialized;
Second, the lock was being unlocked after the hashbin was free.

Since the hashbin of dongles should be empty (ie all dongle unregistered)
don't really need locking there, so just warn if we find anything...

diff -Nru a/net/irda/irda_device.c b/net/irda/irda_device.c
--- a/net/irda/irda_device.c	Mon Oct  6 22:25:01 2003
+++ b/net/irda/irda_device.c	Mon Oct  6 22:25:01 2003
@@ -90,6 +90,7 @@
 		printk(KERN_WARNING "IrDA: Can't allocate dongles hashbin!\n");
 		return -ENOMEM;
 	}
+	spin_lock_init(&dongles->hb_spinlock);
 
 	tasks = hashbin_new(HB_LOCK);
 	if (tasks == NULL) {
@@ -104,14 +105,20 @@
 	return 0;
 }
 
+static void __exit leftover_dongle(void *arg)
+{
+	struct dongle_reg *reg = arg;
+	printk(KERN_WARNING "IrDA: Dongle type %x not unregistered\n",
+	       reg->type);
+}
+
 void __exit irda_device_cleanup(void)
 {
 	IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
 
 	hashbin_delete(tasks, (FREE_FUNC) __irda_task_delete);
-	spin_lock(&dongles->hb_spinlock);
-	hashbin_delete(dongles, NULL);
-	spin_unlock(&dongles->hb_spinlock);
+
+	hashbin_delete(dongles, leftover_dongle);
 }
 
 /*

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spinlock badness in last dongle changes.
  2003-10-07  5:26 [PATCH] spinlock badness in last dongle changes Stephen Hemminger
@ 2003-10-07 15:29 ` David S. Miller
  2003-10-08  2:03 ` Jean Tourrilhes
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2003-10-07 15:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: jt, netdev

On Mon, 6 Oct 2003 22:26:31 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> A couple of locking problems happened when converted from using
> hashbin lock outside of irqueue.  First, the lock was never initialized;
> Second, the lock was being unlocked after the hashbin was free.
> 
> Since the hashbin of dongles should be empty (ie all dongle unregistered)
> don't really need locking there, so just warn if we find anything...

Applied, thanks Stephen.

Jean didn't express his opinion, but if he doesn't like the change
we can just put the fix he prefers on top.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spinlock badness in last dongle changes.
  2003-10-07  5:26 [PATCH] spinlock badness in last dongle changes Stephen Hemminger
  2003-10-07 15:29 ` David S. Miller
@ 2003-10-08  2:03 ` Jean Tourrilhes
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Tourrilhes @ 2003-10-08  2:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: davem, netdev

On Mon, Oct 06, 2003 at 10:26:31PM -0700, Stephen Hemminger wrote:
> On 2.6.0-test6 bk latest, rmmod of irda hangs on SMP...
> 
> A couple of locking problems happened when converted from using
> hashbin lock outside of irqueue.  First, the lock was never initialized;
> Second, the lock was being unlocked after the hashbin was free.
> 
> Since the hashbin of dongles should be empty (ie all dongle unregistered)
> don't really need locking there, so just warn if we find anything...

	I've recompiled my kernel with this patch and the trouble
modprobing the dongle driver went away.
	Thanks !

	Jean

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-08  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-07  5:26 [PATCH] spinlock badness in last dongle changes Stephen Hemminger
2003-10-07 15:29 ` David S. Miller
2003-10-08  2:03 ` Jean Tourrilhes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).