public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: reinette chatre <reinette.chatre@intel.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ipw3945-devel@lists.sourceforge.net"
	<ipw3945-devel@lists.sourceforge.net>,
	Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH] iwlwifi: do not cancel delayed work inside spin_lock_irqsave
Date: Mon, 18 May 2009 14:18:40 -0700	[thread overview]
Message-ID: <1242681520.32358.605.camel@rc-desk> (raw)
In-Reply-To: <1242674520-26331-1-git-send-email-linville@tuxdriver.com>

Hi John,

On Mon, 2009-05-18 at 12:22 -0700, John W. Linville wrote:
> From: Reinette Chatre <reinette.chatre@intel.com>
> 
> Calling cancel_delayed_work() from inside
> spin_lock_irqsave, introduces a potential deadlock.
> 
> As explained by Johannes Berg <johannes@sipsolutions.net>
> 
> A - lock
> T - timer
> 
> phase                   CPU 1           CPU 2
> ---------------------------------------------
> 
> some place that calls
> cancel_timer_sync()
> (which is the | code)
>                                         lock-irq(A)
> |                                       "lock-irq"(T)
> |                                       "unlock"(T)
> |                                       wait(T)
>                                         unlock(A)
> 
> timer softirq
>                         "lock"(T)
>                         run(T)
>                         "unlock"(T)
> 
> irq handler
>           lock(A)
>           unlock(A)
> 
> Now all that again, interleaved, leading to deadlock:
> 
>                                         lock-irq(A)
>                         "lock"(T)
>                          run(T)
> IRQ during or maybe
> before run(T) -->        lock(A)
>                                         "lock-irq"(T)
>                                         wait(T)
> 
> We fix this by moving the call to cancel_delayed_work() into workqueue.
> There are cases where the work may not actually be queued or running
> at the time we are trying to cancel it, but cancel_delayed_work() is
> able to deal with this.
> 
> Also cleanup iwl_set_mode related to this call. This function
> (iwl_set_mode) is only called when bringing interface up and there will
> thus not be any scanning done. No need to try to cancel scanning.
> 
> Fixes http://bugzilla.kernel.org/show_bug.cgi?id=13224, which was also
> reported at http://marc.info/?l=linux-wireless&m=124081921903223&w=2 .
> 
> Tested-by: Miles Lane <miles.lane@gmail.com>
> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
> Acked-by: Zhu Yi <yi.zhu@intel.com>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
> Did not apply to 2.6.30-rc6 as posted -- please verify my fix-up!

I am very sorry - this patch was created against and tested with an
earlier rc release. Thank you very much for fixing it up. It looks good.

Reinette



      reply	other threads:[~2009-05-18 21:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15 23:13 [PATCH 0/3] iwlwifi driver updates 05/15/2009 Reinette Chatre
2009-05-15 23:13 ` [PATCH 1/3] iwlwifi: drop struct iwl3945_hw_key Reinette Chatre
2009-05-15 23:13   ` [PATCH 2/3] iwlwifi: drop iwl3945_tid_data Reinette Chatre
2009-05-15 23:13     ` [PATCH 3/3] iwlwifi: do not cancel delayed work inside spin_lock_irqsave Reinette Chatre
2009-05-15 23:13       ` [PATCH v2.6.30] " Reinette Chatre
2009-05-18 19:22         ` [PATCH] " John W. Linville
2009-05-18 21:18           ` reinette chatre [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=1242681520.32358.605.camel@rc-desk \
    --to=reinette.chatre@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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