From: jmatthew Date: Tue, 9 Feb 2021 01:50:10 +0000 (+0000) Subject: Add a barrier between reading the cqe flags and the command ID, which X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ee570821402ebda8e6230e9e2035c8409933bfc1;p=openbsd Add a barrier between reading the cqe flags and the command ID, which should ensure that we don't read a stale command ID and complete the wrong scsi io. powerpc64 base builds were crashing like this fairly regularly. ok deraadt@ dlg@ --- diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 2d0168899c3..602f93d1fb3 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.89 2020/10/15 13:22:13 krw Exp $ */ +/* $OpenBSD: nvme.c,v 1.90 2021/02/09 01:50:10 jmatthew Exp $ */ /* * Copyright (c) 2014 David Gwynne @@ -994,6 +994,8 @@ nvme_q_complete(struct nvme_softc *sc, struct nvme_queue *q) if ((flags & NVME_CQE_PHASE) != q->q_cq_phase) break; + membar_consumer(); + ccb = &sc->sc_ccbs[cqe->cid]; ccb->ccb_done(sc, ccb, cqe);