2015-06-04 08:39:50

by Jiang Liu

[permalink] [raw]
Subject: [PATCH] virtio_pci: Clear stale cpumask when setting irq affinity

The cpumask vp_dev->msix_affinity_masks[info->msix_vector] may contain
staled information when vp_set_vq_affinity() gets called, so clear it
before setting the new cpu bit mask.

Signed-off-by: Jiang Liu <[email protected]>
---
drivers/virtio/virtio_pci_common.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index e894eb278d83..eba1b7ac7294 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -423,6 +423,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
if (cpu == -1)
irq_set_affinity_hint(irq, NULL);
else {
+ cpumask_clear(mask);
cpumask_set_cpu(cpu, mask);
irq_set_affinity_hint(irq, mask);
}
--
1.7.10.4


2015-06-04 12:55:35

by Michael S. Tsirkin

[permalink] [raw]
Subject: Re: [PATCH] virtio_pci: Clear stale cpumask when setting irq affinity

On Thu, Jun 04, 2015 at 04:41:44PM +0800, Jiang Liu wrote:
> The cpumask vp_dev->msix_affinity_masks[info->msix_vector] may contain
> staled information when vp_set_vq_affinity() gets called, so clear it
> before setting the new cpu bit mask.
>
> Signed-off-by: Jiang Liu <[email protected]>

I have queued this up.
Thanks!

> ---
> drivers/virtio/virtio_pci_common.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
> index e894eb278d83..eba1b7ac7294 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -423,6 +423,7 @@ int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
> if (cpu == -1)
> irq_set_affinity_hint(irq, NULL);
> else {
> + cpumask_clear(mask);
> cpumask_set_cpu(cpu, mask);
> irq_set_affinity_hint(irq, mask);
> }
> --
> 1.7.10.4