From: Ashok Vairavan Date: Mon, 13 Mar 2017 01:43:54 +0000 (-0700) Subject: Revert "nvme: avoid cqe corruption when update at the same time as read" X-Git-Tag: v4.1.12-102.0.20170601_1400~209 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=59b2987ebeb0fa22118f23e9cfd36d0e8dcd9d37;p=users%2Fjedix%2Flinux-maple.git Revert "nvme: avoid cqe corruption when update at the same time as read" This reverts commit 4369f33dfdd50a5011922d45830e2b69ba4067ce. --- diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index cbe8ad7ff4328..3ee056b8aa29d 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -956,13 +956,6 @@ out: return ret; } -/* We read the CQE phase first to check if the rest of the entry is valid */ -static inline bool nvme_cqe_valid(struct nvme_queue *nvmeq, u16 head, - u16 phase) -{ - return (le16_to_cpu(nvmeq->cqes[head].status) & 1) == phase; -} - static int nvme_process_cq(struct nvme_queue *nvmeq) { u16 head, phase; @@ -970,10 +963,12 @@ static int nvme_process_cq(struct nvme_queue *nvmeq) head = nvmeq->cq_head; phase = nvmeq->cq_phase; - while (nvme_cqe_valid(nvmeq, head, phase)) { + for (;;) { void *ctx; nvme_completion_fn fn; struct nvme_completion cqe = nvmeq->cqes[head]; + if ((le16_to_cpu(cqe.status) & 1) != phase) + break; nvmeq->sq_head = le16_to_cpu(cqe.sq_head); if (++head == nvmeq->q_depth) { head = 0; @@ -1016,9 +1011,10 @@ static irqreturn_t nvme_irq(int irq, void *data) static irqreturn_t nvme_irq_check(int irq, void *data) { struct nvme_queue *nvmeq = data; - if (nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase)) - return IRQ_WAKE_THREAD; - return IRQ_NONE; + struct nvme_completion cqe = nvmeq->cqes[nvmeq->cq_head]; + if ((le16_to_cpu(cqe.status) & 1) != nvmeq->cq_phase) + return IRQ_NONE; + return IRQ_WAKE_THREAD; } /*