From: James Bottomley <James.Bottomley@suse.de>
To: Tejun Heo <tj@kernel.org>
Cc: Prashant <0xfffff0@gmail.com>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: spinlock recursion in scsi_end_request() (kernel 2.6.24)
Date: Thu, 20 May 2010 10:29:41 -0500 [thread overview]
Message-ID: <1274369381.4458.2.camel@mulgrave.site> (raw)
In-Reply-To: <4BF54FAF.6020104@kernel.org>
On Thu, 2010-05-20 at 17:05 +0200, Tejun Heo wrote:
> Hello,
>
> On 05/20/2010 01:33 PM, Prashant wrote:
> > I have a question related to code which is almost same in the
> > current kernel. I don't know whether this is the right mailing list
> > for the following question.
>
> linux-scsi would probably fit better (cc'd).
>
> > When a sata drive is unplugged, its corresponding sdev's state is set
> > to SDEV_OFFLINE. Now if IO requests are still comming on the same device,
> > They will be killed by calling scsi_kill_request().
> >
> > 1) scsi_kill_request does following things:
> > i) Unlock request queue
> > ii) Increment host_busy count
> > iii) Lock request queue
> > iv) Calls __scsi_done()
> >
> > 2) __scsi_done() does following things:
> > i) set request completion data
> > ii) Calls blk_completion_request()
> >
> > 3) blk_completion_request() does following things:
> > i) Adds request->donelist to blk_cpu_done softirq queue
> > and raise the softirq (which is scsi_softirq_done)
> >
> > 4) next sequence is:
> > scsi_softirq_done >> scsi_finish_command >> scsi_device_unbusy()
> >
> > 5) scsi_device_unbusy() again locks the request_queue. This is the place where
> > we can get into the spinlock recursion.
> >
> > Is this correct? Please correct me if something is wrong.
>
> Raising softirq defers the work to another context and grabbing the
> same lock from softirq handler doesn't constitute a recursive locking.
> Please try to reproduce the problem on recent kernel w/ lockdep
> enabled.
Just to confirm what Tejun says: the design of the cmd -> done (i.e.
scsi_done) going through the block sofirq handler is specifically so it
can be called either locked or unlocked, so this can never be a
recursion.
James
prev parent reply other threads:[~2010-05-20 15:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 11:32 spinlock recursion in scsi_end_request() (kernel 2.6.24) Prashant
2010-05-20 10:02 ` Tejun Heo
2010-05-20 11:33 ` Prashant
2010-05-20 15:05 ` Tejun Heo
2010-05-20 15:29 ` James Bottomley [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=1274369381.4458.2.camel@mulgrave.site \
--to=james.bottomley@suse.de \
--cc=0xfffff0@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=tj@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 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).