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)



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

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: =?UTF-8?Q?Roddy_Gonz=C3=A1lez?= <roddy.gonzalez.89%gmail.com@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, kern-bug-people%NetBSD.org@localhost,
	netbsd-bugs%NetBSD.org@localhost, gnats-admin%NetBSD.org@localhost
Subject: Re: kern/58335 (Kernel panic when shutting down a virtual machine
	with Virtio devices)
Date: Fri, 28 Jun 2024 13:16:33 +0000

 This is a multi-part message in MIME format.
 --=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA
 Content-Type: text/plain; charset=utf-8
 Content-Transfer-Encoding: quoted-printable
 
 > Date: Fri, 28 Jun 2024 12:26:43 +0200
 > From: Roddy Gonz=C3=A1lez <roddy.gonzalez.89%gmail.com@localhost>
 >=20
 > I applied the patch and rebuilt. Same results.
 
 Great, thanks!  Unfortunately, I neglected to make it easy to confirm
 everything.  Once more, just to be sure it's running the code I
 intended to fix -- can you try the attached patch?
 
 No need to test with kern.detachall=3D1; that's a separate bug.
 
 --=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA
 Content-Type: text/plain; charset="ISO-8859-1"; name="virtio_shutdown_printf"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="virtio_shutdown_printf.patch"
 
 diff --git a/sys/dev/pci/virtio_pci.c b/sys/dev/pci/virtio_pci.c
 index 88afdd5e6d33..95a9fbfdcf47 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_s=
 oftc *);
 =20
  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);
 =20
  static const struct virtio_ops virtio_pci_ops_09 =3D {
  	.kick =3D virtio_pci_kick_09,
 @@ -374,12 +374,18 @@ virtio_pci_detach(device_t self, int flags)
  		for (i =3D 0; i < __arraycount(psc->sc_bars_iot); i++) {
  			if (psc->sc_bars_iosize[i] =3D=3D 0)
  				continue;
 +			printf("%s:%d: unmap space %p handle %p size %zu\n",
 +			    __func__, __LINE__, psc->sc_bars_iot[i],
 +			    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] =3D 0;
  		}
  	} else {
  		if (psc->sc_iosize) {
 +			printf("%s:%d: unmap space %p handle %p size %zu\n",
 +			    __func__, __LINE__, psc->sc_iot,
 +			    psc->sc_ioh, psc->sc_iosize);
  			bus_space_unmap(psc->sc_iot, psc->sc_ioh,
  			    psc->sc_iosize);
  			psc->sc_iosize =3D 0;
 
 --=_3LM3Qr5snjR6jwWdKR2eeC80vJ4rOpBA--
 


Home | Main Index | Thread Index | Old Index