linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] [SCSI] sr: fix multi-drive performance, remove BKL replacement
Date: Tue, 28 Feb 2012 17:22:28 +0100	[thread overview]
Message-ID: <20120228172228.78e22e14@stein> (raw)
In-Reply-To: <20120228170930.132f7c1e@stein>

On Feb 28 Stefan Richter wrote:
> On Feb 28 James Bottomley wrote:
> > On Tue, 2012-02-28 at 15:32 +0100, Stefan Richter wrote:
> > > Commit 2a48fc0ab242 "block: autoconvert trivial BKL users to private
> > > mutex" and other commits at the time mechanically swapped BKL for
> > > per-driver global mutexes.  If the sr driver is any indication, these
> > > replacements have still not been checked by anybody for their
> > > necessessity, removed where possible, or the sections they serialize
> > > reduced to a necessary minimum.
> > > 
> > > The sr_mutex in particular very noticably degraded performance of
> > > CD-DA ripping with multiple drives in parallel.  When several
> > > instances of "grip" are used with two or more drives, their GUIs
> > > became laggier, as did the KDE file manager GUI, and drive utilization
> > > was reduced.  (During ripping, drive lights flicker instead of staying
> > > on most of the time.)  IOW time to rip a stack of CDs was increased.
> > > I didn't measure this but it is highly noticeable.
> > > 
> > > On the other hand, I don't see what state sr_mutex would protect.
> > > So I removed it entirely and that works fine for me.
> > > 
> > I'm afraid you can't do that:  The problem is that we have an entangled
> > set of reference counts that need to be taken and released atomically.
> > If we don't surround them with a mutex you get undefined results from
> > racing last release with new acquire.  You can see this usage in sd.c.
> 
> While I do remove sr_mutex aroud scsi_cd_get/put() calls, these ones
> internally use another lock: sr_ref_mutex.  Always did, still do, since
> neither Arnd's mechanical BKL pushdown and BKL-to-mutex conversions
> patches nor my patch changed that.  This sr_ref_mutex also protects sr's
> reference counting outside of the three block_device_operations methods
> which I changed.
> 
> I suppose I could have mentioned right away in the changelog that the
> sr driver's own reference counting serialization remains in place, via that
> other mutex.

PS:
Entirely independently of this, it is important to remember that sr has
been and still is broken WRT hot removal/ hot unbinding of devices.
http://marc.info/?t=132484687700001
I haven't tried the last proposed patches from Jun'ichi Nomura or from Bart
Van Assche yet.  While I tested my BKL-replacement-removal patch, I made
sure to quit all processes that accessed /dev/sr*, including udisks-daemon,
every time before I unplugged a CD-ROM drive.  Or actually /almost/ every
time; sometimes I missed to kill udisks-daemon but was lucky enough not to
hit that bug in these sessions.
-- 
Stefan Richter
-=====-===-- --=- ===--
http://arcgraph.de/sr/

      parent reply	other threads:[~2012-02-28 16:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 14:32 [PATCH] [SCSI] sr: fix multi-drive performance, remove BKL replacement Stefan Richter
2012-02-28 15:00 ` James Bottomley
2012-02-28 16:09   ` Stefan Richter
2012-02-28 16:16     ` James Bottomley
2012-02-28 16:42       ` Arnd Bergmann
2012-02-28 16:57         ` James Bottomley
2012-02-28 17:11           ` Stefan Richter
2012-02-28 16:22     ` Stefan Richter [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=20120228172228.78e22e14@stein \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.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).