From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: "David S. Miller" <davem@redhat.com>,
irda-users@lists.sourceforge.net, netdev@oss.sgi.com
Subject: Re: [PATCH] (1/11) Irda dongle module owner support
Date: Thu, 2 Oct 2003 16:33:35 -0700 [thread overview]
Message-ID: <20031002233335.GA7945@bougret.hpl.hp.com> (raw)
In-Reply-To: <20031002152026.4bfd2c67.shemminger@osdl.org>
On Thu, Oct 02, 2003 at 03:20:26PM -0700, Stephen Hemminger wrote:
>
> IRDA dongle interface needed to be converted to have an owner field
> to avoid races on module unload.
Yep, this code was broken. At this point, we were supposed to
use the new dongle stuff of Martin, wich I think is correct, but it
didn't happened.
> Eliminated the use of hashbin locking because the dongle control
> code needed to do it's own locking to avoid races. This also closed
> the race between find and insert.
Yep, that's the right approach.
> The find/insert hashbin race may be a general problem with all the IRDA
> hashbin stuff.
This is clearly commented in the hashbin code (big block of
comments). Note that this problem is not a problem of hashbin
themselves, because there is only so much you can do there, but more
about how you use hashbins.
This is why over the last year a lot of critical IrDA code has
migrated to HB_NOLOCK or/and use external locking, and therefore the
situation is not as bad as it looks. Do a "grep hb_spinlock *" to
confirm this (or check my web page) ;-)
For the reason mentionned above, the dongle code and the task
code were not upgraded.
> IMHO the hashbin stuff should be replaced, it is full
> of dead incomplete code and done better by the list macros.
I somehow agree with that (check my comments on
hashbin.c). However, as the majority of locking issues have been
addressed during 2.5.X, it's not as critical, and as long as it
works...
> +static spinlock_t dongle_lock = SPIN_LOCK_UNLOCKED;
The usual IrDA convention is to reuse &dongle->hb_spinlock
rather than adding a new variable. Less bloat.
> + spin_lock(&dongle_lock);
I wonder if you need to lock BH as well. I'm not sure if all
the dongles call are guaranteed to come from user space. You don't want to introduce nasty deadlocks ;-)
> - ASSERT(!in_interrupt(), return NULL;);
Hum... My recollections is that calling request_module with
interrupt disable was guaranteed to crash. But that was with the "old"
module code.
I would prefer if you leave this stuff in, it helps debugging.
Have fun...
Jean
next prev parent reply other threads:[~2003-10-02 23:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-02 22:20 [PATCH] (1/11) Irda dongle module owner support Stephen Hemminger
2003-10-02 23:33 ` Jean Tourrilhes [this message]
2003-10-03 17:21 ` [PATCH] (1/11) Irda dongle module owner support (revised) Stephen Hemminger
2003-10-03 17:31 ` Jean Tourrilhes
2003-10-04 6:06 ` David S. Miller
2003-10-03 13:55 ` [PATCH] (1/11) Irda dongle module owner support David S. Miller
2003-10-06 23:23 ` Jean Tourrilhes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031002233335.GA7945@bougret.hpl.hp.com \
--to=jt@bougret.hpl.hp.com \
--cc=davem@redhat.com \
--cc=irda-users@lists.sourceforge.net \
--cc=jt@hpl.hp.com \
--cc=netdev@oss.sgi.com \
--cc=shemminger@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).