]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nvme: avoid cqe corruption when update at the same time as read
authorMarta Rybczynska <mrybczyn@kalray.eu>
Sun, 18 Dec 2016 18:21:19 +0000 (10:21 -0800)
committerDhaval Giani <dhaval.giani@oracle.com>
Sat, 21 Jan 2017 00:22:14 +0000 (19:22 -0500)
commit4369f33dfdd50a5011922d45830e2b69ba4067ce
tree863ac30b15385b3b5e73619e1efbecffbb2896ef
parent75502b9da27d7be3132b9eb3b7da52eae48c3556
nvme: avoid cqe corruption when update at the same time as read

Make sure the CQE phase (validity) is read before the rest of the
structure. The phase bit is the highest address and the CQE
read will happen on most platforms from lower to upper addresses
and will be done by multiple non-atomic loads. If the structure
is updated by PCI during the reads from the processor, the
processor may get a corrupted copy.

The addition of the new nvme_cqe_valid function that verifies
the validity bit also allows refactoring of the other CQE read
sequences.

Signed-off-by: Marta Rybczynska <marta.rybczynska@kalray.eu>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit d783e0bd02e700e7a893ef4fa71c69438ac1c276)

Orabug: 24960824
Conflicts:
    nvme_poll() function is not available in UEK4QU2. Resolved
the conflicts around nvme poll function.

Signed-off-by: Ashok Vairavan <ashok.vairavan@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/nvme/host/pci.c