All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] vp_vdpa: synchronize irq when free irq
  2023-06-30 10:36 [PATCH] vp_vdpa: synchronize irq when free irq Zhu Lingshan
@ 2023-06-30  8:02 ` Jason Wang
  2023-06-30  9:05   ` Zhu, Lingshan
  2023-06-30  8:34 ` Michael S. Tsirkin
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Wang @ 2023-06-30  8:02 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: virtualization, Cindy Lu, mst

On Fri, Jun 30, 2023 at 10:37 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote:
>
> This commits synchronizes irqs when free them

Need to explain why it is needed.

>
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> Tested-by: Cindy Lu <lulu@redhat.com>
> ---
>  drivers/vdpa/virtio_pci/vp_vdpa.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
> index 281287fae89f..d8ee3e68cd2d 100644
> --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
> +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
> @@ -116,6 +116,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>         for (i = 0; i < vp_vdpa->queues; i++) {
>                 if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
>                         vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR);
> +                       synchronize_irq(vp_vdpa->vring[i].irq);

Interestingly, we don't do this in virtio_pci_common.c and we only
synchronize during reset there.

Any reason makes vp_vdpa different?

Thanks

>                         devm_free_irq(&pdev->dev, vp_vdpa->vring[i].irq,
>                                       &vp_vdpa->vring[i]);
>                         vp_vdpa->vring[i].irq = VIRTIO_MSI_NO_VECTOR;
> @@ -124,6 +125,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>
>         if (vp_vdpa->config_irq != VIRTIO_MSI_NO_VECTOR) {
>                 vp_modern_config_vector(mdev, VIRTIO_MSI_NO_VECTOR);
> +               synchronize_irq(vp_vdpa->config_irq);
>                 devm_free_irq(&pdev->dev, vp_vdpa->config_irq, vp_vdpa);
>                 vp_vdpa->config_irq = VIRTIO_MSI_NO_VECTOR;
>         }
> --
> 2.39.3
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vp_vdpa: synchronize irq when free irq
  2023-06-30 10:36 [PATCH] vp_vdpa: synchronize irq when free irq Zhu Lingshan
  2023-06-30  8:02 ` Jason Wang
@ 2023-06-30  8:34 ` Michael S. Tsirkin
  2023-06-30  9:04   ` Zhu, Lingshan
  1 sibling, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2023-06-30  8:34 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: Cindy Lu, virtualization

On Fri, Jun 30, 2023 at 06:36:56PM +0800, Zhu Lingshan wrote:
> This commits synchronizes irqs when free them
> 
> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> Tested-by: Cindy Lu <lulu@redhat.com>
> ---
>  drivers/vdpa/virtio_pci/vp_vdpa.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
> index 281287fae89f..d8ee3e68cd2d 100644
> --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
> +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
> @@ -116,6 +116,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>  	for (i = 0; i < vp_vdpa->queues; i++) {
>  		if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
>  			vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR);
> +			synchronize_irq(vp_vdpa->vring[i].irq);
>  			devm_free_irq(&pdev->dev, vp_vdpa->vring[i].irq,
>  				      &vp_vdpa->vring[i]);
>  			vp_vdpa->vring[i].irq = VIRTIO_MSI_NO_VECTOR;
> @@ -124,6 +125,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>  
>  	if (vp_vdpa->config_irq != VIRTIO_MSI_NO_VECTOR) {
>  		vp_modern_config_vector(mdev, VIRTIO_MSI_NO_VECTOR);
> +		synchronize_irq(vp_vdpa->config_irq);
>  		devm_free_irq(&pdev->dev, vp_vdpa->config_irq, vp_vdpa);
>  		vp_vdpa->config_irq = VIRTIO_MSI_NO_VECTOR;


Weird, doesn't free_irq synchronize automatically?

>  	}
> -- 
> 2.39.3

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vp_vdpa: synchronize irq when free irq
  2023-06-30  8:34 ` Michael S. Tsirkin
@ 2023-06-30  9:04   ` Zhu, Lingshan
  0 siblings, 0 replies; 5+ messages in thread
From: Zhu, Lingshan @ 2023-06-30  9:04 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Cindy Lu, virtualization



On 6/30/2023 4:34 PM, Michael S. Tsirkin wrote:
> On Fri, Jun 30, 2023 at 06:36:56PM +0800, Zhu Lingshan wrote:
>> This commits synchronizes irqs when free them
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> Tested-by: Cindy Lu <lulu@redhat.com>
>> ---
>>   drivers/vdpa/virtio_pci/vp_vdpa.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
>> index 281287fae89f..d8ee3e68cd2d 100644
>> --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
>> +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
>> @@ -116,6 +116,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>>   	for (i = 0; i < vp_vdpa->queues; i++) {
>>   		if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
>>   			vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR);
>> +			synchronize_irq(vp_vdpa->vring[i].irq);
>>   			devm_free_irq(&pdev->dev, vp_vdpa->vring[i].irq,
>>   				      &vp_vdpa->vring[i]);
>>   			vp_vdpa->vring[i].irq = VIRTIO_MSI_NO_VECTOR;
>> @@ -124,6 +125,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>>   
>>   	if (vp_vdpa->config_irq != VIRTIO_MSI_NO_VECTOR) {
>>   		vp_modern_config_vector(mdev, VIRTIO_MSI_NO_VECTOR);
>> +		synchronize_irq(vp_vdpa->config_irq);
>>   		devm_free_irq(&pdev->dev, vp_vdpa->config_irq, vp_vdpa);
>>   		vp_vdpa->config_irq = VIRTIO_MSI_NO_VECTOR;
>
> Weird, doesn't free_irq synchronize automatically?
Oh, I see free_irq calls __syncronize_hardirq internally

Thanks
>
>>   	}
>> -- 
>> 2.39.3

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vp_vdpa: synchronize irq when free irq
  2023-06-30  8:02 ` Jason Wang
@ 2023-06-30  9:05   ` Zhu, Lingshan
  0 siblings, 0 replies; 5+ messages in thread
From: Zhu, Lingshan @ 2023-06-30  9:05 UTC (permalink / raw)
  To: Jason Wang; +Cc: virtualization, Cindy Lu, mst



On 6/30/2023 4:02 PM, Jason Wang wrote:
> On Fri, Jun 30, 2023 at 10:37 AM Zhu Lingshan <lingshan.zhu@intel.com> wrote:
>> This commits synchronizes irqs when free them
> Need to explain why it is needed.
>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> Tested-by: Cindy Lu <lulu@redhat.com>
>> ---
>>   drivers/vdpa/virtio_pci/vp_vdpa.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
>> index 281287fae89f..d8ee3e68cd2d 100644
>> --- a/drivers/vdpa/virtio_pci/vp_vdpa.c
>> +++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
>> @@ -116,6 +116,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>>          for (i = 0; i < vp_vdpa->queues; i++) {
>>                  if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
>>                          vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR);
>> +                       synchronize_irq(vp_vdpa->vring[i].irq);
> Interestingly, we don't do this in virtio_pci_common.c and we only
> synchronize during reset there.
>
> Any reason makes vp_vdpa different?
As Michael point out, free_irq calls synchronize_irq internally.
And this vp_vdpa_free irq is called in the reset routine.
So I think we don't need to sync it here.
>
> Thanks
>
>>                          devm_free_irq(&pdev->dev, vp_vdpa->vring[i].irq,
>>                                        &vp_vdpa->vring[i]);
>>                          vp_vdpa->vring[i].irq = VIRTIO_MSI_NO_VECTOR;
>> @@ -124,6 +125,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
>>
>>          if (vp_vdpa->config_irq != VIRTIO_MSI_NO_VECTOR) {
>>                  vp_modern_config_vector(mdev, VIRTIO_MSI_NO_VECTOR);
>> +               synchronize_irq(vp_vdpa->config_irq);
>>                  devm_free_irq(&pdev->dev, vp_vdpa->config_irq, vp_vdpa);
>>                  vp_vdpa->config_irq = VIRTIO_MSI_NO_VECTOR;
>>          }
>> --
>> 2.39.3
>>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] vp_vdpa: synchronize irq when free irq
@ 2023-06-30 10:36 Zhu Lingshan
  2023-06-30  8:02 ` Jason Wang
  2023-06-30  8:34 ` Michael S. Tsirkin
  0 siblings, 2 replies; 5+ messages in thread
From: Zhu Lingshan @ 2023-06-30 10:36 UTC (permalink / raw)
  To: mst, jasowang; +Cc: Cindy Lu, virtualization

This commits synchronizes irqs when free them

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
Tested-by: Cindy Lu <lulu@redhat.com>
---
 drivers/vdpa/virtio_pci/vp_vdpa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
index 281287fae89f..d8ee3e68cd2d 100644
--- a/drivers/vdpa/virtio_pci/vp_vdpa.c
+++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
@@ -116,6 +116,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
 	for (i = 0; i < vp_vdpa->queues; i++) {
 		if (vp_vdpa->vring[i].irq != VIRTIO_MSI_NO_VECTOR) {
 			vp_modern_queue_vector(mdev, i, VIRTIO_MSI_NO_VECTOR);
+			synchronize_irq(vp_vdpa->vring[i].irq);
 			devm_free_irq(&pdev->dev, vp_vdpa->vring[i].irq,
 				      &vp_vdpa->vring[i]);
 			vp_vdpa->vring[i].irq = VIRTIO_MSI_NO_VECTOR;
@@ -124,6 +125,7 @@ static void vp_vdpa_free_irq(struct vp_vdpa *vp_vdpa)
 
 	if (vp_vdpa->config_irq != VIRTIO_MSI_NO_VECTOR) {
 		vp_modern_config_vector(mdev, VIRTIO_MSI_NO_VECTOR);
+		synchronize_irq(vp_vdpa->config_irq);
 		devm_free_irq(&pdev->dev, vp_vdpa->config_irq, vp_vdpa);
 		vp_vdpa->config_irq = VIRTIO_MSI_NO_VECTOR;
 	}
-- 
2.39.3

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-30  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30 10:36 [PATCH] vp_vdpa: synchronize irq when free irq Zhu Lingshan
2023-06-30  8:02 ` Jason Wang
2023-06-30  9:05   ` Zhu, Lingshan
2023-06-30  8:34 ` Michael S. Tsirkin
2023-06-30  9:04   ` Zhu, Lingshan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.