public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <tluben@rogers.com>
To: Patrick Mansfield <patmans@us.ibm.com>
Cc: linux-scsi@vger.kernel.org,
	James Bottomley <James.Bottomley@steeleye.com>
Subject: Re: [PATCH] scsi-misc-2.5 remove scsi_device list_lock (take 2)
Date: Fri, 09 May 2003 13:46:10 -0400	[thread overview]
Message-ID: <3EBBE962.8090203@rogers.com> (raw)
In-Reply-To: <20030508215924.A28525@beaverton.ibm.com>

Patrick Mansfield wrote:
> 
> IMO I'm reducing the special case: use one lock to protect all of the
> scsi_device data.

I'm not sure how well this will play in the future.
With refcounts is there a need to lock *all* of the scsi_device
struct?  In this regard I think that the sdev lock is too general.

> Yes, but if we are already holding the lock and already blocking IRQ's
> getting another lock increases the hold time and the time IRQ's are
> blocked.

Yes, locally.  But if this approach makes you break the
infrastructure which you're striving to get, another lock
would make sense from design point of view.

Then also remember that spinlocks are supposed to be held for
the minimum amount of time -- so I'd rather see another
spinlock _and_ a better infrastructure design, rather than
one lock and a messy code structure.

> If we had a request function that took one req, and was called with no
> lock held the above would be fine (similiar in that we should not hold
> host_lock when we call the LLDD queuecommand in scsi_dispatch_cmd). I
> think it is best for now to match the current interface (infrastructure)
> and have only one lock so we do not release and acquire another lock in
> scsi_request_fn.
> 
> But, it would be interesting to further split the lock and see what happens.

I just think that it's not that great an idea to share
locks across subsystems.  Just as long as we stick to the rule
of holding _a_ sdev_lock for the smallest amount of time elsewhere
in SCSI Core, then obtaining it in scsi_request_fn while the
request_q lock (separate) is being held is not that big of a deal.

I.e. let the request_q lock lock the request_q, and sdev_lock
(possibly to be broken up) lock the device struct members
(or whatever is left/needed).  But I'd much rather see the use
of atomics (where possible) and bit ops.

> Not sure what you mean in the above - IMO we should use it to protect
> scsi_device data (not including sdev->siblings). If this is to general and
> we see contention, then it can be modified.

I'm thinking of properly setting up struct scsi_target { ... }, this will
eliminate sdev->siblings and will properly reflect SAM-3.

Furthermore, SANs will notify the LLDD when a device (target) appears
on the fabric, and then it's up to SCSI Core to obtain the devices (LUs)
of the target, via REPORT LUNS.

Is this worth it? (at this point)
 
> There are scsi_device fields (set in scsi_scan.c) that are invariant after
> scanning that don't need to be locked - like single_lun, borken, etc.
> online is not one of them.

... the more reason to un-generalize sdev_lock, use atomics (where possible)
and bit ops.

-- 
Luben




      reply	other threads:[~2003-05-09 17:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-07  0:59 [PATCH] scsi-misc-2.5 remove scsi_device list_lock (take 2) Patrick Mansfield
2003-05-08 17:18 ` Luben Tuikov
2003-05-08 23:40   ` Patrick Mansfield
2003-05-09  3:10     ` Luben Tuikov
2003-05-09  4:59       ` Patrick Mansfield
2003-05-09 17:46         ` Luben Tuikov [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=3EBBE962.8090203@rogers.com \
    --to=tluben@rogers.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.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