Re: Random guest crashes since 5c34d002dcc7 ("virtio_pci: use shared interrupts for virtqueues")

From: Michael S. Tsirkin
Date: Mon Mar 27 2017 - 14:16:36 EST


On Mon, Mar 27, 2017 at 07:05:40PM +0200, Christoph Hellwig wrote:
> Hi Mike,
>
> does the patch below fix that issue for you?
>
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index df548a6fb844..fd1b06368b1f 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -176,7 +176,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs,
> if (err < 0)
> return err;
>
> - vp_dev->msix_vectors = nvectors;
> + vp_dev->msix_vectors = err; /* number of vectors allocated */
> vp_dev->msix_names = kmalloc_array(nvectors,
> sizeof(*vp_dev->msix_names), GFP_KERNEL);
> if (!vp_dev->msix_names)

Can this sometimes allocate less vectors than min number requested then?
I didn't realize.

In that case we probably should change if (err < 0)
to if (err != nvectors) and similarly for when we try
to get 2 vectors.


Mike, could you pls send lspci -vv that shows up after
boot?

--
MST