All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: Sagi Grimberg <sagig@dev.mellanox.co.il>
Cc: Wenbo Wang <wenbo.wang@memblaze.com>, Jens Axboe <axboe@fb.com>,
	Wenbo Wang <mail_weber_wang@163.com>,
	"Wenwei.Tao" <wenwei.tao@memblaze.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended
Date: Tue, 2 Feb 2016 14:46:48 +0000	[thread overview]
Message-ID: <20160202144648.GA10728@localhost.localdomain> (raw)
In-Reply-To: <56B0BE26.6070208@dev.mellanox.co.il>

On Tue, Feb 02, 2016 at 04:33:10PM +0200, Sagi Grimberg wrote:
> Hey Keith,
> 
> >>First of all, I think we need to cancel all
> >>inflight requests before nvme_dev_unmap.
> >
> >IO cancelling is where it is because it protects against host memory
> >corruption. If you're going to mess with the ordering, just make sure
> >the PCI device is disabled from bus mastering first.
> 
> Little help? :)
> 
> What corruption is the ordering protecting against?

Sure thing. :)

We free the transfer buffers when a command is cancelled. The controller,
however, may still own the command and may try to write to them. We
have to fence the controller off from being able to do that, so we can't
cancel inflight commands while the PCI device is still bus master enabled.

In a perfect world, we could trust in disabling with NVMe registers,
but sometimes we can't rely on that.

This was commit 07836e659c81ec6b0d683dfbf7958339a22a7b69, which might
explain the scenario a little better, and was reported by end user.

WARNING: multiple messages have this Message-ID (diff)
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended
Date: Tue, 2 Feb 2016 14:46:48 +0000	[thread overview]
Message-ID: <20160202144648.GA10728@localhost.localdomain> (raw)
In-Reply-To: <56B0BE26.6070208@dev.mellanox.co.il>

On Tue, Feb 02, 2016@04:33:10PM +0200, Sagi Grimberg wrote:
> Hey Keith,
> 
> >>First of all, I think we need to cancel all
> >>inflight requests before nvme_dev_unmap.
> >
> >IO cancelling is where it is because it protects against host memory
> >corruption. If you're going to mess with the ordering, just make sure
> >the PCI device is disabled from bus mastering first.
> 
> Little help? :)
> 
> What corruption is the ordering protecting against?

Sure thing. :)

We free the transfer buffers when a command is cancelled. The controller,
however, may still own the command and may try to write to them. We
have to fence the controller off from being able to do that, so we can't
cancel inflight commands while the PCI device is still bus master enabled.

In a perfect world, we could trust in disabling with NVMe registers,
but sometimes we can't rely on that.

This was commit 07836e659c81ec6b0d683dfbf7958339a22a7b69, which might
explain the scenario a little better, and was reported by end user.

  reply	other threads:[~2016-02-02 14:47 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 15:42 [PATCH] NVMe: do not touch sq door bell if nvmeq has been suspended Wenbo Wang
2016-02-01 15:42 ` Wenbo Wang
2016-02-01 15:59 ` Busch, Keith
2016-02-01 15:59   ` Busch, Keith
2016-02-01 16:17   ` Wenbo Wang
2016-02-01 16:17     ` Wenbo Wang
2016-02-01 16:54 ` Jens Axboe
2016-02-01 16:54   ` Jens Axboe
2016-02-02  7:15   ` Wenbo Wang
2016-02-02 12:41     ` Sagi Grimberg
2016-02-02 12:41       ` Sagi Grimberg
2016-02-02 14:27       ` Keith Busch
2016-02-02 14:27         ` Keith Busch
2016-02-02 14:33         ` Sagi Grimberg
2016-02-02 14:33           ` Sagi Grimberg
2016-02-02 14:46           ` Keith Busch [this message]
2016-02-02 14:46             ` Keith Busch
2016-02-02 17:20             ` Sagi Grimberg
2016-02-02 17:20               ` Sagi Grimberg
2016-02-03  0:49               ` Wenbo Wang
2016-02-02 17:25     ` Keith Busch
2016-02-02 17:25       ` Keith Busch
2016-02-03  0:19       ` Wenbo Wang
2016-02-03 14:41     ` Keith Busch
2016-02-03 14:41       ` Keith Busch
2016-02-03 16:35       ` Wenbo Wang
2016-02-03 16:38         ` Keith Busch
2016-02-03 16:38           ` Keith Busch
2016-02-06 14:32           ` Wenbo Wang
2016-02-07 13:41             ` Sagi Grimberg
2016-02-07 13:41               ` Sagi Grimberg
2016-02-08 15:01             ` Keith Busch
2016-02-08 15:01               ` Keith Busch
2016-02-09 11:22               ` Wenbo Wang
2016-02-09 22:55                 ` Keith Busch
2016-02-09 22:55                   ` Keith Busch

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=20160202144648.GA10728@localhost.localdomain \
    --to=keith.busch@intel.com \
    --cc=axboe@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mail_weber_wang@163.com \
    --cc=sagig@dev.mellanox.co.il \
    --cc=wenbo.wang@memblaze.com \
    --cc=wenwei.tao@memblaze.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.