]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-pci: dma read memory barrier for completions
authorKeith Busch <kbusch@kernel.org>
Fri, 8 May 2020 20:04:06 +0000 (13:04 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 12 May 2020 16:02:24 +0000 (18:02 +0200)
commit0a851b9d36a799f0ed02feb7f1cbb4f069ea79ce
tree849b398f5ec603aa97bc6a1f6e387bfa90a7ba82
parent296cb9b0ac54c7f54d209143a0e139b284817bcd
nvme-pci: dma read memory barrier for completions

Control dependencies do not guarantee load order across the condition,
allowing a CPU to predict and speculate memory reads.

Commit c7aecb936362 inlined verifying a new completion with its
handling. At least one architecture was observed to access the contents
out of order, resulting in the driver using stale data for the
completion.

Add a dma read barrier before reading the completion queue entry and
after the condition its contents depend on to ensure the read order is
determinsitic.

Reported-by: John Garry <john.garry@huawei.com>
Suggested-by: Will Deacon <will@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Tested-by: John Garry <john.garry@huawei.com>
Acked-by: Will Deacon <will@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c