linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Merlijn B.W. Wajer" <merlijn@archive.org>
To: "Merlijn B.W. Wajer" <merlijn@wizzup.org>,
	Christoph Hellwig <hch@infradead.org>,
	James Bottomley <jejb@linux.ibm.com>
Cc: linux-scsi@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: sr: get rid of sr global mutex
Date: Mon, 24 Feb 2020 22:20:47 +0100	[thread overview]
Message-ID: <9d50ecd4-9fd1-6865-5509-a5ef119828df@archive.org> (raw)
In-Reply-To: <33da5f81-ad37-05fd-d765-8bd997995dd2@archive.org>

Hi Martin,

Just wanted to check if you planned to apply this v2 (you tried to apply
v1 but it didn't compile, so I rebased it onto 5.7/scsi-queue as you
requested). Please let me know if there's anything you'd like to see
changed.

Regards,
Merlijn

On 18/02/2020 20:21, Merlijn B.W. Wajer wrote:
> Hi,
> 
> On 18/02/2020 18:31, Christoph Hellwig wrote:
>> On Tue, Feb 18, 2020 at 09:28:34AM -0800, James Bottomley wrote:
>>> On Tue, 2020-02-18 at 09:23 -0800, Christoph Hellwig wrote:
>>>> On Tue, Feb 18, 2020 at 09:20:28AM -0800, James Bottomley wrote:
>>>>>>> Replace the global mutex with per-sr-device mutex.
>>>>>>
>>>>>> Do we actually need the lock at all?  What is protected by it?
>>>>>
>>>>> We do at least for cdrom_open.  It modifies the cdi structure with
>>>>> no other protection and concurrent modification would at least
>>>>> screw up the use counter which is not atomic.  Same reasoning for
>>>>> cdrom_release.
>>>>
>>>> Wouldn't the right fix to add locking to cdrom_open/release instead
>>>> of having an undocumented requirement for the callers?
>>>
>>> Yes ... but that's somewhat of a bigger patch because you now have to
>>> reason about the callbacks within cdrom.  There's also the question of
>>> whether you can assume ops->generic_packet() has its own concurrency
>>> protections ... it's certainly true for SCSI, but is it for anything
>>> else?  Although I suppose you can just not care and run the internal
>>> lock over it anyway.
>>
>> We have 4 instances of struct cdrom_device_ops in the kernel, one of
>> which has a no-op generic_packet.  So I don't think this should be a
>> huge project.
> 
> The are two reasons I decided to make minor changes to fix the
> performance regression.
> 
> First, being able to send the patch to the various stable branches once
> merged. For people working with many CD drives attached to one station,
> this is a pretty big deal, so I tried to keep the patch simple. It fixes
> the regression introduced in another commit.
> 
> Secondly, I don't have the hardware to test sophisticated or old setups,
> like some of the issues linked from my patch. I have SATA CD drives with
> USB->SATA bridges, no IDE, no PATA, etc. So the testing I can do is
> relatively limited.
> 
> Perhaps I or someone else can work on removing the usage of the locks,
> but as it stands I think this addresses the performance issue present in
> the current kernel, and removing locks and the associated testing
> required with that is something I am not entirely comfortable doing.
> 
> Cheers,
> Merlijn
> 

  parent reply	other threads:[~2020-02-24 21:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 14:39 [PATCH v2] scsi: sr: get rid of sr global mutex Merlijn Wajer
2020-02-18 17:12 ` Christoph Hellwig
2020-02-18 17:20   ` James Bottomley
2020-02-18 17:23     ` Christoph Hellwig
2020-02-18 17:28       ` James Bottomley
2020-02-18 17:31         ` Christoph Hellwig
2020-02-18 19:21           ` Merlijn B.W. Wajer
2020-02-18 19:46             ` Arnd Bergmann
2020-02-24 21:20             ` Merlijn B.W. Wajer [this message]
     [not found] <9d50ecd4-9fd1-6865-5509-a5ef119828df () archive ! org>
2020-03-06 22:43 ` Simon Arlott

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=9d50ecd4-9fd1-6865-5509-a5ef119828df@archive.org \
    --to=merlijn@archive.org \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=merlijn@wizzup.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).