linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: "Hesse, Christian" <mail@earthworm.de>
Cc: James Ketrenos <jketreno@linux.intel.com>,
	linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net
Subject: Re: [ANNOUNCE] d80211 based driver for Intel PRO/Wireless 3945ABG
Date: Tue, 13 Feb 2007 01:47:09 -0500	[thread overview]
Message-ID: <1171349229.2326.91.camel@dv> (raw)
In-Reply-To: <200702111417.38336.mail@earthworm.de>

Hello!

On Sun, 2007-02-11 at 14:17 +0100, Hesse, Christian wrote:
> lsmod shows a use count of 4294967295 (2^32 - 1), no oopses or the like. This 
> is reproducable all the time.

Although I cannot reproduce the problem (I'm on current wireless-dev),
here's my interpretation.

The iwlwifi driver includes both a driver and a rate control algorithm.
It passes THIS_MODULE (i.e. a handle to itself) to the generic rate
control code, which locks the caller i.e. iwlwifi.  Therefore, iwlwifi
has locked itself in memory.

To counteract that, the driver "puts" the module, i.e. decreases its use
count after the rate control is registered.  Conversely, the module
"gets" itself when the rate control is unregistered.

One thing that is clearly wrong is that try_module_get() comes after
ieee80211_rate_control_unregister(), not before.  This means that the
use count would go negative between those calls.  If the kernel starts
checking for this, the driver is in trouble.

Further, why do we need this self-locking/unlocking trick?  The driver
can just set priv->rate_control.module to NULL and prevent self-locking.

It would only make sense to put THIS_MODULE there is the rate control
were implemented as a separate module, which it probably a good idea in
the long term.

But a simple fix would be just to get rid of all references to
THIS_MODULE and let the kernel do the right thing.

Most likely, your kernel doesn't use the priv->rate_control.module field
to lock the module, so it would help in your case.

Please try this patch:

diff --git a/origin/base.c b/origin/base.c
index 8f97491..62751e5 100644
--- a/origin/base.c
+++ b/origin/base.c
@@ -9771,8 +9771,6 @@ static void ipw_bg_alive_start(struct work_struct *work)
 			return;
 		}
 
-		module_put(THIS_MODULE);
-
 		mutex_lock(&priv->mutex);
 		priv->netdev_registered = 1;
 
@@ -11966,7 +11964,7 @@ static struct ieee80211_rate *ipw_get_tx_rate(void *priv_rate,
 static char* rate_scale_name = "iwlwifi rate-scale";
 void ipw_set_rate_scale_handlers(struct ipw_priv *priv)
 {
-	priv->rate_control.module = THIS_MODULE;
+	priv->rate_control.module = NULL;
 	priv->rate_control.name = rate_scale_name;
 	priv->rate_control.tx_status = ipw_rate_scale_tx_resp_handle;
 	priv->rate_control.get_rate = ipw_get_tx_rate;
@@ -12338,7 +12336,6 @@ static void ipw_pci_remove(struct pci_dev *pdev)
 
 	if (priv->netdev_registered) {
 		ieee80211_rate_control_unregister(&priv->rate_control);
-		try_module_get(THIS_MODULE);
 
 		ieee80211_unregister_hw(priv->ieee);
 	}

-- 
Regards,
Pavel Roskin


  reply	other threads:[~2007-02-13  6:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-09 21:12 [ANNOUNCE] d80211 based driver for Intel PRO/Wireless 3945ABG James Ketrenos
2007-02-09 22:14 ` Alon Bar-Lev
2007-02-09 22:26 ` Neil Brown
2007-02-09 21:52   ` James Ketrenos
2007-02-10  3:26     ` Nick Kossifidis
2007-02-09 22:37   ` Stefan Schmidt
2007-02-09 22:43 ` Pavel Roskin
2007-02-09 22:18   ` James Ketrenos
2007-02-09 23:17     ` Pavel Roskin
2007-02-09 22:45       ` James Ketrenos
2007-02-10  0:46 ` [ipw3945-devel] " Norbert Preining
2007-02-13 23:23   ` James Ketrenos
2007-02-10 13:23 ` Hesse, Christian
2007-02-10 14:25   ` Hesse, Christian
2007-02-12 16:32     ` [ipw3945-devel] " dragoran
2007-02-12 18:35     ` James Ketrenos
2007-02-13 12:18       ` Hesse, Christian
2007-02-11  0:55   ` Pavel Roskin
2007-02-11 13:17     ` Hesse, Christian
2007-02-13  6:47       ` Pavel Roskin [this message]
2007-02-13 10:41         ` Hesse, Christian
2007-02-11 13:19   ` Johannes Berg
2007-02-10 16:22 ` Theodore Tso
2007-02-10 16:39   ` John W. Linville
2007-02-10 17:53     ` [ipw3945-devel] " Pavel Roskin
2007-02-10 22:41       ` John W. Linville
2007-02-10 18:42   ` Michael Buesch
2007-02-13 13:58 ` Ismail Dönmez
2007-02-13 15:10   ` Jeff Chua
2007-02-13 16:57     ` Ismail Dönmez
2007-02-13 22:55       ` James Ketrenos
2007-02-13 18:13 ` Pavel Machek
2007-02-13 18:36   ` Johannes Berg
2007-02-13 23:18     ` James Ketrenos
2007-02-14  0:16   ` [ipw3945-devel] " James Ketrenos
2007-02-19 22:44     ` Pavel Machek
2007-02-21  6:23       ` iwlwifi warnings Stephen Hemminger
2007-02-21  7:32         ` Randy Dunlap
2007-02-21 19:38         ` Pavel Machek
2007-02-23  5:44           ` Pavel Roskin

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=1171349229.2326.91.camel@dv \
    --to=proski@gnu.org \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=jketreno@linux.intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mail@earthworm.de \
    /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).