From: Michael Buesch <mb@bu3sch.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
wireless <linux-wireless@vger.kernel.org>
Subject: Re: b43 WARN_ON
Date: Mon, 6 Apr 2009 13:55:58 +0200 [thread overview]
Message-ID: <200904061355.58533.mb@bu3sch.de> (raw)
In-Reply-To: <1239013529.13407.6.camel@johannes.local>
On Monday 06 April 2009 12:25:29 Johannes Berg wrote:
> Actually, I think the check is invalid, or rather, rfkill.registered
> needs to be set before registering the rfkill struct.
Would cause a wl->mutex deadlock.
> See, right now, and I'm not entirely happy with this, during
> rfkill_register I call the set_block callback. The reason I'm not really
> happy with that is that I said calling driver -> rfkill -> driver is
> bad, but on the other hand due to locking constraints across the
> subsystems the driver cannot take the same locks around rfkill_register
> as in the callbacks.
Exactly. ;)
> Additionally, the driver must be ready to service rfkill calls _before_
> rfkill_register() is called, everything else results in a race
> condition. Compare with the shared interrupt handlers, for instance.
The driver _is_ ready. It's just not ready to service recursive calls
due to the deadlock. That's what we protect against.
> The reason I call it during rfkill_register is that I need to sync the
> software state to the driver's block state, and that needs to be done
> somewhere. Doing that from a work struct would be possible, but wouldn't
> solve the locking constraints nor would it actually help since
> rfkill_register can potentially sleep, so the work could still be
> executed before rfkill_register returns -- the driver still needs to be
> able to handle rfkill callbacks before rfkill_register returns.
No. The mutex mechanism will make sure there's no deadlock and the scheduler will
schedule the threads in correct order, if you call set_block from the workqueue.
So I think doing the initial set_block from the workqueue asynchronously _would_ solve
the deadlock issue.
> Therefore, the warning is spurious, but because of a driver bug
> elsewhere -- I think the rfkill.registered = 1 assignment should be
> moved up to before rfkill_register() (and be = 0 again if that fails
> unexpectedly); I'll do that in my patch.
As I said. The driver cannot service callbacks while it's registering.
So the registered=1 must remain where it is.
Simply remove the warning, please.
--
Greetings, Michael.
prev parent reply other threads:[~2009-04-06 11:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-06 3:54 b43 WARN_ON Larry Finger
2009-04-06 10:12 ` Michael Buesch
2009-04-06 10:25 ` Johannes Berg
2009-04-06 11:55 ` Michael Buesch [this message]
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=200904061355.58533.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=Larry.Finger@lwfinger.net \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.