virtio_pci: Switch away from deprecated irq_set_affinity_hint
PATCH v2 1/1 virtio_pci: Switch away from deprecated irq_set_affinity_hint
Since commit 65c7cdedeb30 ("genirq: Provide new interfaces for affinity hints") irq_set_affinity_hint is being phased out.
Switch to new interfaces for setting and applying irq affinity hints.
---
v2:
- Leave cpumask_copy as is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:
https://lore.kernel.org/r/[email protected]
v1: https://lore.kernel.org/r/[email protected]
--- drivers/virtio/virtio_pci_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/virtio/virtio_pci_common.c +3 -3
@@ -242,7 +242,7 @@ void vp_del_vqs(struct virtio_device *vdev)if (v !=VIRTIO_MSI_NO_VECTOR ) {int irq =pci_irq_vector (vp_dev->pci_dev, v); -irq_set_affinity_hint (irq,NULL ); +irq_update_affinity_hint (irq,NULL );free_irq (irq, vq); } }
@@ -443,10 +443,10 @@ int vp_set_vq_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask) mask = vp_dev->msix_affinity_masks[info->msix_vector]; irq =pci_irq_vector (vp_dev->pci_dev, info->msix_vector);if (!cpu_mask) -irq_set_affinity_hint (irq,NULL ); +irq_update_affinity_hint (irq,NULL );else {cpumask_copy (mask, cpu_mask); -irq_set_affinity_hint (irq, mask); +irq_set_affinity_and_hint (irq, mask); } }return 0 ;
Signature · 6 lines
2.41.0 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 6 lines · Jakub Sitnicki
Since commit
65c7cdedeb30("genirq: Provide new interfaces for affinity hints")irq_set_affinity_hintis being phased out.Switch to new interfaces for setting and applying irq affinity hints.
Signed-off-by Jakub Sitnicki <[email protected]>
Thanks.
Quoted 40 lines
---
v2:
- Leavecpumask_copyas is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:https://lore.kernel.org/r/[email protected]v1: https://lore.kernel.org/r/[email protected]
--- drivers/virtio/virtio_pci_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/virtio/virtio_pci_common.c +3
-4@@ -242,7 +242,7 @@ void vp_del_vqs(struct virtio_device *vdev)if (v !=VIRTIO_MSI_NO_VECTOR ) {int irq =pci_irq_vector (vp_dev->pci_dev, v); -irq_set_affinity_hint (irq,NULL ); +irq_update_affinity_hint (irq,NULL );free_irq (irq, vq); } }@@ -443,10 +443,10 @@ int vp_set_vq_affinity(struct virtqueue *vq, const struct cpumask *cpu_mask) mask = vp_dev->msix_affinity_masks[info->msix_vector]; irq =pci_irq_vector (vp_dev->pci_dev, info->msix_vector);if (!cpu_mask) -irq_set_affinity_hint (irq,NULL ); +irq_update_affinity_hint (irq,NULL );else {cpumask_copy (mask, cpu_mask); -irq_set_affinity_hint (irq, mask); +irq_set_affinity_and_hint (irq, mask); } }return 0 ; --2.41.0
Quoted 11 lines · Jakub Sitnicki
Since commit
65c7cdedeb30("genirq: Provide new interfaces for affinity hints")irq_set_affinity_hintis being phased out.Switch to new interfaces for setting and applying irq affinity hints.
Signed-off-by Jakub Sitnicki <[email protected]>---
v2:
- Leavecpumask_copyas is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:https://lore.kernel.org/r/[email protected]
Just a note to the ^ - if we wanted to get rid of msix_affinity_masks, we could call irq_set_affinity directly, instead of calling it through irq_set_affinity[_and]_hint.
The hint wouldn't be available any more in /proc/irq/N/affinity_hint, but the same information can be gathered from /proc/irq/N/smp_affinity.
[...]
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 13 lines · Jakub Sitnicki
Quoted 11 lines · Jakub Sitnicki
Since commit
65c7cdedeb30("genirq: Provide new interfaces for affinity hints")irq_set_affinity_hintis being phased out.Switch to new interfaces for setting and applying irq affinity hints.
Signed-off-by Jakub Sitnicki <[email protected]>---
v2:
- Leavecpumask_copyas is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:https://lore.kernel.org/r/[email protected]
Quoted 8 lines
Just a note to the ^ - if we wanted to get rid of
msix_affinity_masks, we could callirq_set_affinitydirectly, instead of calling it through irq_set_affinity[_and]_hint.The hint wouldn't be available any more in
/proc/irq/N/affinity_hint, but the same information can be gathered from/proc/irq/N/smp_affinity.[...]
So we are potentially breaking some userspace - what's the value we gain? Is there some way we can make disable_irq/enable_irq work? That would have a lot of value.
There is an actual need for that in virtio for coco but we can't use these APIs with affinity managed IRQs.
Signature · 6 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Jakub Sitnicki
Quoted 11 lines · Jakub Sitnicki
Since commit
65c7cdedeb30("genirq: Provide new interfaces for affinity hints")irq_set_affinity_hintis being phased out.Switch to new interfaces for setting and applying irq affinity hints.
Signed-off-by Jakub Sitnicki <[email protected]>---
v2:
- Leavecpumask_copyas is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:https://lore.kernel.org/r/[email protected]Just a note to the ^ - if we wanted to get rid of
msix_affinity_masks, we could callirq_set_affinitydirectly, instead of calling it through irq_set_affinity[_and]_hint.The hint wouldn't be available any more in
/proc/irq/N/affinity_hint, but the same information can be gathered from/proc/irq/N/smp_affinity.
Quoted 8 lines
Quoted 1 line
[...]
So we are potentially breaking some userspace - what's the value we gain? Is there some way we can make disable_irq/enable_irq work? That would have a lot of value.
There is an actual need for that in virtio for coco but we can't use these APIs with affinity managed IRQs.
Sorry, that is beyond my ken today.
I saw the comment in vp_modern_disable_vq_and_reset:
/* For the case where vq has an exclusive irq, call synchronize_irq() to * wait for completion. * * note: We can't use disable_irq() since it conflicts with the affinity * managed IRQ that is used by some drivers. */
... but I fail to follow how the two conflict.
Perhaps Xuah could shed some light here.
Xuan Zhuo
reviewerQuoted 42 lines · Jakub Sitnicki
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Jakub Sitnicki
Quoted 11 lines · Jakub Sitnicki
Since commit
65c7cdedeb30("genirq: Provide new interfaces for affinity hints")irq_set_affinity_hintis being phased out.Switch to new interfaces for setting and applying irq affinity hints.
Signed-off-by Jakub Sitnicki <[email protected]>---
v2:
- Leavecpumask_copyas is. We can't pass pointer to stack memory as hint. Proposed a change to IRQ affinity interface to address this limitation:https://lore.kernel.org/r/[email protected]Just a note to the ^ - if we wanted to get rid of
msix_affinity_masks, we could callirq_set_affinitydirectly, instead of calling it through irq_set_affinity[_and]_hint.The hint wouldn't be available any more in
/proc/irq/N/affinity_hint, but the same information can be gathered from/proc/irq/N/smp_affinity.Quoted 8 lines
Quoted 1 line
[...]
So we are potentially breaking some userspace - what's the value we gain? Is there some way we can make disable_irq/enable_irq work? That would have a lot of value.
There is an actual need for that in virtio for coco but we can't use these APIs with affinity managed IRQs.Sorry, that is beyond my ken today.
I saw the comment in
vp_modern_disable_vq_and_reset:/* For the case where vq has an exclusive irq, call synchronize_irq() to * wait for completion. * * note: We can't use disable_irq() since it conflicts with the affinity * managed IRQ that is used by some drivers. */
Quoted 3 lines
... but I fail to follow how the two conflict.
Perhaps Xuah could shed some light here.
I forgot which device that manages the irq by it self. If we disable the irq, then the device will lost the irq, so we must not call disable_irq().
Thanks.