linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Vaibhav Nagarnaik <vnagarnaik@google.com>
Cc: Abbas Companywala <acompany@google.com>,
	Bart Van Assche <bvanassche@google.com>,
	linux-nvme@lists.infradead.org, Jens Axboe <axboe@fb.com>,
	Eric Gouriou <egouriou@google.com>,
	Christoph Hellwig <hch@lst.de>, "Mihai R." <dizzy@google.com>,
	Sagi Grimberg <sagi@grimberg.me>
Subject: Re: NVMe PCI driver ignores SQHD from completion entries
Date: Sat, 5 Oct 2019 08:27:24 -0600	[thread overview]
Message-ID: <20191005142722.GA30437@keith-busch> (raw)
In-Reply-To: <CAL26m8+WdjrKvnXDZdP4d2ekznfORDUV2Td6U6-DY9gcOqoOUA@mail.gmail.com>

On Fri, Oct 04, 2019 at 11:27:30AM -0700, Vaibhav Nagarnaik wrote:
> According to NVMe spec:
> A Submission Queue entry has been consumed by the controller when a
> Completion Queue entry is posted that indicates that the Submission
> Queue Head Pointer has moved past the slot in which that Submission
> Queue entry was placed.
> 
> Which means, the driver needs to verify SQ Head Pointer value reported
> in the completion entries before considering a particular SQ entry
> reusable. Otherwise it's undefined behavior.

The spec allows the controller to process and complete commands out of
order, but the controller must fetch those commands in order. It's in the
"Theory of Operation" section 1.4.

Checking SQ head is required only if the host might submit more commands
than there are entries. The Linux nvme driver allocates enough tags
for the depth of the queue, leaving one entry empty, so having a tag
available means the next sq entry must be available.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2019-10-05 14:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04 18:27 NVMe PCI driver ignores SQHD from completion entries Vaibhav Nagarnaik
2019-10-05 14:27 ` Keith Busch [this message]
2019-10-08  0:32   ` Vaibhav Nagarnaik
2019-10-08 15:59     ` Keith Busch
2019-10-08 17:45       ` James Smart

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=20191005142722.GA30437@keith-busch \
    --to=kbusch@kernel.org \
    --cc=acompany@google.com \
    --cc=axboe@fb.com \
    --cc=bvanassche@google.com \
    --cc=dizzy@google.com \
    --cc=egouriou@google.com \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=vnagarnaik@google.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).