Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic nvme(4): If bp is null or bp->b_ci is not assigne...



details:   https://anonhg.NetBSD.org/src/rev/b3e6fd2121bf
branches:  trunk
changeset: 369737:b3e6fd2121bf
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Aug 30 01:13:10 2022 +0000

description:
nvme(4): If bp is null or bp->b_ci is not assigned, use curcpu().

curcpu() might be stale by the time we're done, but it's still safe
to pass it to cpu_index, and this is just used as a best-effort
mechanism to keep I/O on queues handled by the same CPU.

bp is not always provided, and bp->b_ci is not always assigned,
e.g. when dumping.  (If bp->b_ci is supposed to be always assigned,
then we need to audit all the paths into it to assign it in those
where it's not.)

Fixes dump on nvme.

diffstat:

 sys/dev/ic/nvme.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 5d132477c520 -r b3e6fd2121bf sys/dev/ic/nvme.c
--- a/sys/dev/ic/nvme.c Mon Aug 29 23:48:18 2022 +0000
+++ b/sys/dev/ic/nvme.c Tue Aug 30 01:13:10 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvme.c,v 1.64 2022/08/20 11:31:38 riastradh Exp $      */
+/*     $NetBSD: nvme.c,v 1.65 2022/08/30 01:13:10 riastradh Exp $      */
 /*     $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.64 2022/08/20 11:31:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.65 2022/08/30 01:13:10 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1867,7 +1867,7 @@
 nvme_ccb_get_bio(struct nvme_softc *sc, struct buf *bp,
     struct nvme_queue **selq)
 {
-       u_int cpuindex = cpu_index(bp->b_ci);
+       u_int cpuindex = cpu_index(bp->b_ci ? bp->b_ci : curcpu());
 
        /*
         * Find a queue with available ccbs, preferring the originating



Home | Main Index | Thread Index | Old Index