From: willy@linux.intel.com (Matthew Wilcox)
Subject: [PATCH] NVMe: Use CMB for the SQ if available
Date: Mon, 22 Jun 2015 10:48:05 -0400 [thread overview]
Message-ID: <20150622144805.GC1971@linux.intel.com> (raw)
In-Reply-To: <80B89753B40C5141A3E2D53FE7A2A8A9D03A71F1@NTXBOIMBX02.micron.com>
On Fri, Jun 19, 2015@10:47:04PM +0000, Sam Bradshaw (sbradshaw) wrote:
> > @@ -376,7 +394,12 @@ static int __nvme_submit_cmd(struct nvme_queue
> > *nvmeq, struct nvme_command *cmd) {
> > u16 tail = nvmeq->sq_tail;
> >
> > - memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
> > + if (nvmeq->cmb_mapped)
> > + memcpy_toio(&nvmeq->sq_cmds[tail], cmd,
> > + sizeof(*cmd));
> > + else
> > + memcpy(&nvmeq->sq_cmds[tail], cmd, sizeof(*cmd));
> > +
> > if (++tail == nvmeq->q_depth)
> > tail = 0;
> > writel(tail, nvmeq->q_db);
>
> I think a store fence is necessary between memcpy_toio() and the doorbell ring.
> This applies elsewhere in the patch as well.
>
> For example, we've seen rare cases where Haswells do not emit the whole SQE out
> of the write combine buffers before the doorbell write traverses PCIe. Other
> architectures may have a similar need.
That isn't supposed to happen. A write to an uncached area is supposed
to flush the WC buffers. See section 11.3 in the Intel SDM volume 3:
Write Combining (WC) ? System memory locations are not cached
(as with uncacheable memory) and coherency is not enforced by
the processor?s bus coherency protocol. Speculative reads are
allowed. Writes may be delayed and combined in the write combining
buffer (WC buffer) to reduce memory accesses. If the WC buffer is
partially filled, the writes may be delayed until the next occurrence
of a serializing event; such as, an SFENCE or MFENCE instruction,
CPUID execution, a read or write to uncached memory, an interrupt
occurrence, or a LOCK instruction execution.
Of course, any CPU may have errata, but I'd like something a little
stronger than the assertion above before we put in an explicit fence.
next prev parent reply other threads:[~2015-06-22 14:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 21:45 [PATCH] NVMe: Use CMB for the SQ if available Jon Derrick
2015-06-19 22:47 ` Sam Bradshaw (sbradshaw)
2015-06-22 0:12 ` Jon Derrick
2015-06-22 14:48 ` Matthew Wilcox [this message]
2015-06-22 5:41 ` Christoph Hellwig
2015-06-22 15:06 ` Matthew Wilcox
2015-06-22 17:18 ` 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=20150622144805.GC1971@linux.intel.com \
--to=willy@linux.intel.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.