NetBSD-Bugs archive

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

Re: kern/58335 (Kernel panic when shutting down a virtual machine with Virtio devices)



Oops, corrected patch attached -- this one should actually build.
diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c
index 88afdd5e6d33..9fb155454a72 100644
--- a/sys/dev/pci/virtio_pci.c
+++ b/sys/dev/pci/virtio_pci.c
@@ -178,7 +178,7 @@ static bool	virtio_pci_msix_enabled(struct virtio_pci_softc *);
 
 CFATTACH_DECL3_NEW(virtio_pci, sizeof(struct virtio_pci_softc),
     virtio_pci_match, virtio_pci_attach, virtio_pci_detach, NULL,
-    virtio_pci_rescan, NULL, 0);
+    virtio_pci_rescan, NULL, DVF_DETACH_SHUTDOWN);
 
 static const struct virtio_ops virtio_pci_ops_09 = {
 	.kick = virtio_pci_kick_09,
@@ -374,12 +374,19 @@ virtio_pci_detach(device_t self, int flags)
 		for (i = 0; i < __arraycount(psc->sc_bars_iot); i++) {
 			if (psc->sc_bars_iosize[i] == 0)
 				continue;
+			printf("%s:%d: unmap space %p handle %p size %zu\n",
+			    __func__, __LINE__, psc->sc_bars_iot[i],
+			    (void *)psc->sc_bars_ioh[i],
+			    psc->sc_bars_iosize[i]);
 			bus_space_unmap(psc->sc_bars_iot[i],
 			    psc->sc_bars_ioh[i], psc->sc_bars_iosize[i]);
 			psc->sc_bars_iosize[i] = 0;
 		}
 	} else {
 		if (psc->sc_iosize) {
+			printf("%s:%d: unmap space %p handle %p size %zu\n",
+			    __func__, __LINE__, psc->sc_iot,
+			    (void *)psc->sc_ioh, psc->sc_iosize);
 			bus_space_unmap(psc->sc_iot, psc->sc_ioh,
 			    psc->sc_iosize);
 			psc->sc_iosize = 0;


Home | Main Index | Thread Index | Old Index