From: Mike Christie <michaelc@cs.wisc.edu>
To: Chris Leech <christopher.leech@intel.com>
Cc: Vasu Dev <vasu.dev@linux.intel.com>,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
Matthew Wilcox <matthew@wil.cx>,
linux-scsi <linux-scsi@vger.kernel.org>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
James Bottomley <James.Bottomley@suse.de>,
"devel@open-fcoe.org" <devel@open-fcoe.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [Open-FCoE] [RFC PATCH] scsi, fcoe, libfc: drop scsi host_lock use from fc_queuecommand
Date: Wed, 01 Sep 2010 18:38:26 -0500 [thread overview]
Message-ID: <4C7EE3F2.70409@cs.wisc.edu> (raw)
In-Reply-To: <20100901224503.GB4089@cleech-lnx.jf.intel.com>
On 09/01/2010 05:45 PM, Chris Leech wrote:
> On Wed, Sep 01, 2010 at 02:06:26PM -0700, Vasu Dev wrote:
>>>> It looks safe to me to call scsi_done() w/o host_lock held,
>>>
>>> Hmmmm, this indeed this appears to be safe now.. For some reason I had
>>> it in my head (and in TCM_Loop virtual SCSI LLD code as well) that
>>> host_lock needed to be held while calling struct scsi_cmnd->scsi_done().
>>>
>>> I assume this is some old age relic from the BLK days in the SCSI
>>> completion path, and the subsequent conversion. I still see a couple of
>>> ancient drivers in drivers/scsi/ that are still doing this, but I
>>> believe I stand corrected in that (all..?) of the modern in-use
>>> drivers/scsi code is indeed *not* holding host_lock while calling struct
>>> scsi_cmnd->scsi_done()..
>>>
>>
>> fcoe/libfc moved to scsi_done w/o holding scsi host_lock a while ago
>> around dec, 09 and it was done after discussion with Mathew and Chris
>> Leech from fcoe side at that time, they may have more to comment on
>> this.
>
> There's not a whole lot to comment on. Matthew Wilcox was helping me
> look for opportunities to reduce our host_lock use, and said he didn't
> think it was needed around scsi_done anymore. It held up under testing,
> so I submitted a patch.
>
The host_lock was not actually there for any scsi_done stuff. It was
probably lazy programming that it was held there. For that code, the
host_lock was held in fc_queuecommand for the rport check and for the
setting of the SCp.ptr and fsp->cmd, and it was held in the completion
path for the SCp.otr and fsp->cmd checks The rport check locking got
fixed recently and I was looking at the SCp.ptr and fsp->cmd and was
wondering if there could be a problem where one thread completes the IO
and sets those fields to NULL, but another thread could be completing it
too and it would see a scsi_cmnd that is not released and reallocated by
the other thread. So for example the fc_eh_abort code still grabs the
host_lock when calling CMD_SP and taking a ref and checking that the fsp
is not null.
If it is a problem then we should add some locking or some other atomic
magic. If it is not a problem then those checks could just be removed,
right?
next prev parent reply other threads:[~2010-09-01 23:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100831225338.25102.59500.stgit@localhost.localdomain>
2010-08-31 23:56 ` [Open-FCoE] [RFC PATCH] scsi, fcoe, libfc: drop scsi host_lock use from fc_queuecommand Nicholas A. Bellinger
2010-09-01 0:16 ` Nicholas A. Bellinger
2010-09-01 4:17 ` Mike Christie
[not found] ` <4C7DD3E8.9050700-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>
2010-09-01 7:57 ` Zou, Yi
2010-09-01 20:10 ` [Open-FCoE] " Nicholas A. Bellinger
[not found] ` <1283371821.32007.636.camel-Y1+j5t8j3WgjMeEPmliV8E/sVC8ogwMJ@public.gmane.org>
2010-09-01 21:06 ` Vasu Dev
2010-09-01 21:38 ` [Open-FCoE] " Nicholas A. Bellinger
2010-09-02 17:24 ` Vasu Dev
2010-09-02 19:48 ` Nicholas A. Bellinger
2010-09-03 22:38 ` Vasu Dev
[not found] ` <1283375187.30431.71.camel-B2RhF0yJhE275v1z/vFq2g@public.gmane.org>
2010-09-01 22:45 ` Chris Leech
2010-09-01 23:38 ` Mike Christie [this message]
2010-09-02 1:37 ` [Open-FCoE] " Mike Christie
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=4C7EE3F2.70409@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=James.Bottomley@suse.de \
--cc=christopher.leech@intel.com \
--cc=devel@open-fcoe.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=nab@linux-iscsi.org \
--cc=vasu.dev@linux.intel.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 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.