* Re: spinlock recursion in scsi_end_request() (kernel 2.6.24)
[not found] ` <AANLkTilPaI-b4IUNfUnVKahK299fujgYTXsxC1BROw0L@mail.gmail.com>
@ 2010-05-20 15:05 ` Tejun Heo
2010-05-20 15:29 ` James Bottomley
0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2010-05-20 15:05 UTC (permalink / raw)
To: Prashant; +Cc: linux-ide, linux-scsi
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.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: spinlock recursion in scsi_end_request() (kernel 2.6.24)
2010-05-20 15:05 ` spinlock recursion in scsi_end_request() (kernel 2.6.24) Tejun Heo
@ 2010-05-20 15:29 ` James Bottomley
2010-05-21 15:19 ` Prashant
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2010-05-20 15:29 UTC (permalink / raw)
To: Tejun Heo; +Cc: Prashant, linux-ide, linux-scsi
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: spinlock recursion in scsi_end_request() (kernel 2.6.24)
2010-05-20 15:29 ` James Bottomley
@ 2010-05-21 15:19 ` Prashant
0 siblings, 0 replies; 3+ messages in thread
From: Prashant @ 2010-05-21 15:19 UTC (permalink / raw)
To: James Bottomley; +Cc: Tejun Heo, linux-scsi
On Thu, May 20, 2010 at 8:59 PM, James Bottomley
<James.Bottomley@suse.de> wrote:
> 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
>
Thanks for the explanation. I will let you know if this problem is reproduced
with the latest kernel.
Thanks,
Prashant
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-21 15:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <AANLkTilIYz-UITAugWx08u-AvKB5gI-E1M3LORZ55wro@mail.gmail.com>
[not found] ` <4BF508C8.9050405@kernel.org>
[not found] ` <AANLkTilPaI-b4IUNfUnVKahK299fujgYTXsxC1BROw0L@mail.gmail.com>
2010-05-20 15:05 ` spinlock recursion in scsi_end_request() (kernel 2.6.24) Tejun Heo
2010-05-20 15:29 ` James Bottomley
2010-05-21 15:19 ` Prashant
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).