linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jason Yan <yanaijie@huawei.com>, Christoph Hellwig <hch@infradead.org>
Cc: martin.petersen@oracle.com, jejb@linux.vnet.ibm.com,
	Jens Axboe <axboe@kernel.dk>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	hare@suse.com, dan.j.williams@intel.com, jthumshirn@suse.de,
	Steffen Maier <maier@linux.ibm.com>
Subject: Re: [RFC PATCH] scsi: fix oops in scsi_uninit_cmd()
Date: Wed, 13 Mar 2019 16:51:17 -0700	[thread overview]
Message-ID: <1552521077.45180.119.camel@acm.org> (raw)
In-Reply-To: <10ea95ec-e259-3511-44c4-58e4d255eb9f@huawei.com>

On Thu, 2019-02-21 at 16:53 +0800, Jason Yan wrote:
> On 2019/2/20 23:18, Christoph Hellwig wrote:
> > [fullquote removed, please follow proper mail etiquette]
> > 
> > On Tue, Feb 19, 2019 at 08:56:28AM -0800, Bart Van Assche wrote:
> > > regression in the SCSI sd driver due to the switch from the legacy block
> > > layer to scsi-mq. The above patch introduces two atomic operations in the
> > > hot path and hence would introduce a performance regression. I think this
> > > can be avoided by making sure that sd_uninit_command() gets called before
> > > the request tag is freed. What changes would be required to make the block
> > > layer core call sd_uninit_command() before the request tag is freed? Would
> > > introducing prep_rq_fn and unprep_rq_fn callbacks in struct blk_mq_ops and
> > > making sure that the SCSI core sets these callback function pointers
> > > appropriately be sufficient? Would such a change allow to simplify the NVMe
> > > initiator driver? Are there any alternatives to this approach that are more
> > > elegant?
> > 
> > Additional indirect calls in the I/O fast path is something I'd rather
> > avoid.  But I don't fully understand the problem yet - where do
> > we release a disk reference from blk_update_request?  
> 
> When userspace close the fd after blk_update_request() and before
> scsi_mq_uninit_cmd(), a disk reference will be released. It is not the
> blk_update_request() directly released it.
> 
> close
>     ->sd_release
>        ->scsi_disk_put
>          ->scsi_disk_release
>            ->disk->private_data = NULL;
> 
> The userspace can close the fd because blk_update_request() returned the
> last IO , the userspace application does not have to stuck on read() or
> write(). The window is very small, but it can be reproduce every day
> in our testcases. So I'm very curious why. One possible explanation is
> that we enabled kernel preempt(CONFIG_PREEMPT).
> 
> And why can't we move that release to __blk_mq_end_request?

Hi Jason,

What is the current status of this issue?

Thanks,

Bart.

  reply	other threads:[~2019-03-13 23:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19  7:27 [RFC PATCH] scsi: fix oops in scsi_uninit_cmd() Jason Yan
2019-02-19 10:32 ` Steffen Maier
2019-02-19 16:56 ` Bart Van Assche
2019-02-20 15:18   ` Christoph Hellwig
2019-02-21  8:53     ` Jason Yan
2019-03-13 23:51       ` Bart Van Assche [this message]
2019-03-14  1:57         ` Jason Yan
2019-03-15  7:56       ` Ming Lei

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=1552521077.45180.119.camel@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=hare@suse.com \
    --cc=hch@infradead.org \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=maier@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=yanaijie@huawei.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;
as well as URLs for NNTP newsgroup(s).