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?



The following reply was made to PR kern/58043; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Paul Goyette <paul%whooppee.com@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/58043: kernel crash in assert_sleepable() in -current, dk(4) driver?
Date: Sat, 16 Mar 2024 16:27:25 +0000

 This is a multi-part message in MIME format.
 --=_jGdl80rZzbJ3AV6nW+2j7DYaEAx46dnv
 
 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?
 
 --=_jGdl80rZzbJ3AV6nW+2j7DYaEAx46dnv
 Content-Type: text/plain; charset="ISO-8859-1"; name="nvme"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="nvme.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, voi=
 d *cookie,
  	dmap =3D ccb->ccb_dmamap;
  	error =3D 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) {
 
 --=_jGdl80rZzbJ3AV6nW+2j7DYaEAx46dnv--
 


Home | Main Index | Thread Index | Old Index