NetBSD-Bugs archive

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

Re: kern/58043: kernel crash in assert_sleepable() in -current, dk(4) driver?



Annoyingly, the part of the stack trace we really want here -- the
part which would tell us where something called pool_cache_get(_paddr)
-- has been obscured:

> 	assert_sleepable() at assert_sleepable+0x99
> 	pool_cache_get_paddr() at pool_cache_get_paddr+0x13c
> 	end() at ffffffff813ad275
> 	bdev_strategy() at bdev_strategy+0x81

My best guess from the rest of the stack trace:

> 	spec_strategy() at spec_strategy+0x6e
> 	VOP_STRATEGY() at VOP_STRATEGY+0x3c
> 	dkstart() at dkstart+0x13e
> 	dkiodone() at dkiodone+0xa6
> 	lddone() at lddone+0x10
> 	nvme_q_complete() at nvme_q_complete+0xff

is that the missing part looks something like this:

nvme_ns_dobio
ld_nvme_start
ld_diskstart
dk_start (note: not dkstart)
dk_strategy
ldstrategy

There's a call to bus_dmamap_load here which looks like, in this stack
trace, it will pass BUS_DMA_WAITOK because ld_nvme_start doesn't pass
NVME_NS_CTX_F_POLL.  I wonder whether this should unconditionally pass
BUS_DMA_NOWAIT instead?  After all, the dmamap is created with
BUS_DMA_ALLOCNOW so maybe there should be no need for allocation here.

(And I wonder whether maybe bus_dmamap_load should assert_sleepable if
you pass BUS_DMA_WAITOK, to shake out more of these paths early.)

Can you try the attached patch?
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c
index d41c88296dbd..29f877c01031 100644
--- a/sys/dev/ic/nvme.c
+++ b/sys/dev/ic/nvme.c
@@ -786,8 +786,7 @@ nvme_ns_dobio(struct nvme_softc *sc, uint16_t nsid, void *cookie,
 	dmap = ccb->ccb_dmamap;
 	error = bus_dmamap_load(sc->sc_dmat, dmap, data,
 	    datasize, NULL,
-	    (ISSET(flags, NVME_NS_CTX_F_POLL) ?
-	      BUS_DMA_NOWAIT : BUS_DMA_WAITOK) |
+	    BUS_DMA_NOWAIT |
 	    (ISSET(flags, NVME_NS_CTX_F_READ) ?
 	      BUS_DMA_READ : BUS_DMA_WRITE));
 	if (error) {


Home | Main Index | Thread Index | Old Index