public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Arthur Marsh <arthur.marsh@internode.on.net>,
	Christoph Hellwig <hch@lst.de>,
	Matthew Dharm <mdharm-usb@one-eyed-alien.net>,
	USB list <linux-usb@vger.kernel.org>,
	SCSI development list <linux-scsi@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: CPU lock-ups with 4.12.0+ kernels related to usb_storage
Date: Wed, 12 Jul 2017 18:52:00 +0200	[thread overview]
Message-ID: <20170712165200.GA29145@lst.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1707121152211.2118-100000@iolanthe.rowland.org>

On Wed, Jul 12, 2017 at 12:10:02PM -0400, Alan Stern wrote:
> This is pretty conclusive.  The problem comes about because
> usb_stor_control_thread() calls scsi_mq_done() while holding
> shost->host_lock, and then scsi_eh_scmd_add() tries to acquire that
> same lock.
> 
> I don't know why this didn't show up in earlier kernels.  I guess some
> element of the call chain listed above must be new in 4.12.
> 
> Christoph, what's the best way to fix this?  Should usb-storage release
> the host lock before issuing the ->scsi_done callback?  If so, does
> that change need to be applied to any kernels before 4.12?

4.12 switched to blk-mq by default, and while the old code used
a softirq for completions, which is always a difference context
the blk-mq code might execute in the same context it's called in.

So yes, for that we'd need to drop host_lock.  But I wonder how
many more of these are lingering somewhere and if we can find
another workaround.

  reply	other threads:[~2017-07-12 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2b6dc4b0-71c8-28cb-383d-c01a9e896c7a@internode.on.net>
2017-07-12 16:10 ` CPU lock-ups with 4.12.0+ kernels related to usb_storage Alan Stern
2017-07-12 16:52   ` Christoph Hellwig [this message]
2017-07-13 17:00     ` Alan Stern
     [not found]       ` <Pine.LNX.4.44L0.1707131258190.1571-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2017-07-13 18:48         ` Arthur Marsh
     [not found]           ` <02c6c52e-d520-6d84-81e7-0b49dfae0ec9-CkBdp7X+a1oIQCUVoCVjmQ@public.gmane.org>
2017-07-17 20:15             ` Arthur Marsh
2017-07-26 15:47         ` Christoph Hellwig
2017-07-26 15:50           ` Alan Stern

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=20170712165200.GA29145@lst.de \
    --to=hch@lst.de \
    --cc=arthur.marsh@internode.on.net \
    --cc=axboe@kernel.dk \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=stern@rowland.harvard.edu \
    /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