From: Andrew Morton <akpm@linux-foundation.org>
To: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>,
Aaron Lu <aaron.lu@intel.com>, Jens Axboe <axboe@kernel.dk>,
linux-pm@vger.kernel.org, linux-scsi@vger.kernel.org,
stable@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: Fix possible sleep in invalid context
Date: Mon, 1 Jul 2013 15:30:15 -0700 [thread overview]
Message-ID: <20130701153015.9842a0b2d291e01105d853d0@linux-foundation.org> (raw)
In-Reply-To: <1372717451.2385.58.camel@dabdike>
On Mon, 01 Jul 2013 15:24:11 -0700 James Bottomley <James.Bottomley@hansenpartnership.com> wrote:
> > --- a/block/blk-core.c~block-fix-possible-sleep-in-invalid-context-fix
> > +++ a/block/blk-core.c
> > @@ -3159,15 +3159,14 @@ EXPORT_SYMBOL(blk_pre_runtime_resume);
> > */
> > void blk_post_runtime_resume(struct request_queue *q, int err)
> > {
> > + spin_lock_irq(q->queue_lock);
> > if (!err) {
> > - spin_lock_irq(q->queue_lock);
> > q->rpm_status = RPM_ACTIVE;
> > __blk_run_queue(q);
> > pm_runtime_mark_last_busy(q->dev);
> > spin_unlock_irq(q->queue_lock);
> > pm_request_autosuspend(q->dev);
> > } else {
> > - spin_lock_irq(q->queue_lock);
> > q->rpm_status = RPM_SUSPENDED;
> > spin_unlock_irq(q->queue_lock);
> > }
> > _
> >
> >
> > I wonder if we actually need locking around that second write to
> > q->rpm_status.
>
> Shouldn't: it's an int, which makes it a 32 bit quantity we believe to
> have atomic write properties on every platform.
Yes, but. If there's some other code path which does:
spin_lock(queue_lock);
x = q->rpm_status;
...
y = q->rpm_status;
...
<assumes x == y>
spin_unlock(queue_lock);
then it blows up if we make the suggested change. Stranger things have
happened...
next prev parent reply other threads:[~2013-07-01 22:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 15:28 [PATCH] block: Fix possible sleep in invalid context Sujit Reddy Thumma
2013-07-01 22:17 ` Andrew Morton
2013-07-01 22:24 ` James Bottomley
2013-07-01 22:30 ` Andrew Morton [this message]
2013-07-02 3:04 ` Aaron Lu
2013-07-02 3:27 ` Sujit Reddy Thumma
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=20130701153015.9842a0b2d291e01105d853d0@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=aaron.lu@intel.com \
--cc=axboe@kernel.dk \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sthumma@codeaurora.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