All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user
@ 2022-06-27  8:49 abhimanyu.saini
  2022-06-27 15:03 ` Andrew Rybchenko
  2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
  0 siblings, 2 replies; 6+ messages in thread
From: abhimanyu.saini @ 2022-06-27  8:49 UTC (permalink / raw)
  To: dev
  Cc: chenbo.xia, maxime.coquelin, andrew.rybchenko, stable,
	Abhimanyu Saini, Vijay Kumar Srivastava

From: Abhimanyu Saini <absaini@amd.com>

When DPDK app is running in the VF, it sometimes rings the doorbell
before dev_config has had a chance to complete and hence it misses
the event. As workaround, ring the doorbell when vDPA reports the
notify_area to QEMU.

Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")
Cc: stable@dpdk.org

Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
Signed-off-by: Abhimanyu Saini <absaini@amd.com>
---
 drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index b3d9b6c..63aa52d 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -794,6 +794,8 @@
 	int vfio_dev_fd;
 	efx_rc_t rc;
 	unsigned int bar_offset;
+	volatile void *doorbell;
+	struct rte_pci_device *pci_dev;
 	struct rte_vdpa_device *vdpa_dev;
 	struct sfc_vdpa_ops_data *ops_data;
 	struct vfio_region_info reg = { .argsz = sizeof(reg) };
@@ -856,6 +858,18 @@
 	sfc_vdpa_info(dev, "vDPA ops get_notify_area :: offset : 0x%" PRIx64,
 		      *offset);
 
+	pci_dev = sfc_vdpa_adapter_by_dev_handle(dev)->pdev;
+	doorbell = (uint8_t *)pci_dev->mem_resource[reg.index].addr + *offset;
+
+	/*
+	 * virtio-net driver in VM sends queue notifications before
+	 * vDPA has a chance to setup the queues and notification area,
+	 * and hence the HW misses these doorbell notifications.
+	 * Since, it is safe to send duplicate doorbell, send another
+	 * doorbell from vDPA driver as workaround for this timing issue.
+	 */
+	rte_write16(qid, doorbell);
+
 	return 0;
 }
 
-- 
1.8.3.1


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

* Re: [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user
  2022-06-27  8:49 [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user abhimanyu.saini
@ 2022-06-27 15:03 ` Andrew Rybchenko
  2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2022-06-27 15:03 UTC (permalink / raw)
  To: abhimanyu.saini, dev
  Cc: chenbo.xia, maxime.coquelin, stable, Abhimanyu Saini,
	Vijay Kumar Srivastava

When you send a new version, please, don't forget to specify
-v <next-version-number> on part format and use --in-reply-to
with the first mail ID. See contributors guidelines.

Also, new version should make it clear what is changed. See below.

On 6/27/22 11:49, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <absaini@amd.com>
> 
> When DPDK app is running in the VF, it sometimes rings the doorbell
> before dev_config has had a chance to complete and hence it misses
> the event. As workaround, ring the doorbell when vDPA reports the
> notify_area to QEMU.
> 
> Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")

Above seems to be wrong. Nearby code is added later, so, it should be:

Fixes: 630be406dcbf ("vdpa/sfc: get queue notify area info")


> Cc: stable@dpdk.org
> 
> Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
> Signed-off-by: Abhimanyu Saini <absaini@amd.com>
> ---

Version changelog here.

>   drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
> index b3d9b6c..63aa52d 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
> @@ -794,6 +794,8 @@
>   	int vfio_dev_fd;
>   	efx_rc_t rc;
>   	unsigned int bar_offset;
> +	volatile void *doorbell;
> +	struct rte_pci_device *pci_dev;
>   	struct rte_vdpa_device *vdpa_dev;
>   	struct sfc_vdpa_ops_data *ops_data;
>   	struct vfio_region_info reg = { .argsz = sizeof(reg) };
> @@ -856,6 +858,18 @@
>   	sfc_vdpa_info(dev, "vDPA ops get_notify_area :: offset : 0x%" PRIx64,
>   		      *offset);
>   
> +	pci_dev = sfc_vdpa_adapter_by_dev_handle(dev)->pdev;
> +	doorbell = (uint8_t *)pci_dev->mem_resource[reg.index].addr + *offset;
> +
> +	/*
> +	 * virtio-net driver in VM sends queue notifications before
> +	 * vDPA has a chance to setup the queues and notification area,
> +	 * and hence the HW misses these doorbell notifications.
> +	 * Since, it is safe to send duplicate doorbell, send another
> +	 * doorbell from vDPA driver as workaround for this timing issue.
> +	 */
> +	rte_write16(qid, doorbell);
> +
>   	return 0;
>   }
>   


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

* [PATCH v2] vdpa/sfc: handle sync issue between qemu and vhost-user
  2022-06-27  8:49 [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user abhimanyu.saini
  2022-06-27 15:03 ` Andrew Rybchenko
@ 2022-06-28  5:29 ` abhimanyu.saini
  2022-06-28  9:01   ` Andrew Rybchenko
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: abhimanyu.saini @ 2022-06-28  5:29 UTC (permalink / raw)
  To: dev
  Cc: chenbo.xia, maxime.coquelin, andrew.rybchenko, stable,
	Abhimanyu Saini, Vijay Kumar Srivastava

From: Abhimanyu Saini <absaini@amd.com>

When DPDK app is running in the VF, it sometimes rings the doorbell
before dev_config has had a chance to complete and hence it misses
the event. As workaround, ring the doorbell when vDPA reports the
notify_area to QEMU.

Fixes: 630be406dcbf ("vdpa/sfc: get queue notify area info")
Cc: stable@dpdk.org

Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
Signed-off-by: Abhimanyu Saini <absaini@amd.com>
---
v1:
* Update the commit id that this patch fixes

 drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index b3d9b6c..63aa52d 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -794,6 +794,8 @@
 	int vfio_dev_fd;
 	efx_rc_t rc;
 	unsigned int bar_offset;
+	volatile void *doorbell;
+	struct rte_pci_device *pci_dev;
 	struct rte_vdpa_device *vdpa_dev;
 	struct sfc_vdpa_ops_data *ops_data;
 	struct vfio_region_info reg = { .argsz = sizeof(reg) };
@@ -856,6 +858,18 @@
 	sfc_vdpa_info(dev, "vDPA ops get_notify_area :: offset : 0x%" PRIx64,
 		      *offset);
 
+	pci_dev = sfc_vdpa_adapter_by_dev_handle(dev)->pdev;
+	doorbell = (uint8_t *)pci_dev->mem_resource[reg.index].addr + *offset;
+
+	/*
+	 * virtio-net driver in VM sends queue notifications before
+	 * vDPA has a chance to setup the queues and notification area,
+	 * and hence the HW misses these doorbell notifications.
+	 * Since, it is safe to send duplicate doorbell, send another
+	 * doorbell from vDPA driver as workaround for this timing issue.
+	 */
+	rte_write16(qid, doorbell);
+
 	return 0;
 }
 
-- 
1.8.3.1


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

* Re: [PATCH v2] vdpa/sfc: handle sync issue between qemu and vhost-user
  2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
@ 2022-06-28  9:01   ` Andrew Rybchenko
  2022-06-30 12:56   ` Maxime Coquelin
  2022-07-01 13:58   ` Maxime Coquelin
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Rybchenko @ 2022-06-28  9:01 UTC (permalink / raw)
  To: abhimanyu.saini, dev
  Cc: chenbo.xia, maxime.coquelin, stable, Abhimanyu Saini,
	Vijay Kumar Srivastava

On 6/28/22 08:29, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <absaini@amd.com>
> 
> When DPDK app is running in the VF, it sometimes rings the doorbell
> before dev_config has had a chance to complete and hence it misses
> the event. As workaround, ring the doorbell when vDPA reports the
> notify_area to QEMU.
> 
> Fixes: 630be406dcbf ("vdpa/sfc: get queue notify area info")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
> Signed-off-by: Abhimanyu Saini <absaini@amd.com>

Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>


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

* Re: [PATCH v2] vdpa/sfc: handle sync issue between qemu and vhost-user
  2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
  2022-06-28  9:01   ` Andrew Rybchenko
@ 2022-06-30 12:56   ` Maxime Coquelin
  2022-07-01 13:58   ` Maxime Coquelin
  2 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2022-06-30 12:56 UTC (permalink / raw)
  To: abhimanyu.saini, dev
  Cc: chenbo.xia, andrew.rybchenko, stable, Abhimanyu Saini,
	Vijay Kumar Srivastava



On 6/28/22 07:29, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <absaini@amd.com>
> 
> When DPDK app is running in the VF, it sometimes rings the doorbell
> before dev_config has had a chance to complete and hence it misses
> the event. As workaround, ring the doorbell when vDPA reports the
> notify_area to QEMU.
> 
> Fixes: 630be406dcbf ("vdpa/sfc: get queue notify area info")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
> Signed-off-by: Abhimanyu Saini <absaini@amd.com>
> ---
> v1:
> * Update the commit id that this patch fixes
> 
>   drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


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

* Re: [PATCH v2] vdpa/sfc: handle sync issue between qemu and vhost-user
  2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
  2022-06-28  9:01   ` Andrew Rybchenko
  2022-06-30 12:56   ` Maxime Coquelin
@ 2022-07-01 13:58   ` Maxime Coquelin
  2 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2022-07-01 13:58 UTC (permalink / raw)
  To: abhimanyu.saini, dev
  Cc: chenbo.xia, andrew.rybchenko, stable, Abhimanyu Saini,
	Vijay Kumar Srivastava



On 6/28/22 07:29, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <absaini@amd.com>
> 
> When DPDK app is running in the VF, it sometimes rings the doorbell
> before dev_config has had a chance to complete and hence it misses
> the event. As workaround, ring the doorbell when vDPA reports the
> notify_area to QEMU.
> 
> Fixes: 630be406dcbf ("vdpa/sfc: get queue notify area info")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
> Signed-off-by: Abhimanyu Saini <absaini@amd.com>
> ---
> v1:
> * Update the commit id that this patch fixes
> 
>   drivers/vdpa/sfc/sfc_vdpa_ops.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


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

end of thread, other threads:[~2022-07-01 13:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27  8:49 [PATCH] vdpa/sfc: handle sync issue between qemu and vhost-user abhimanyu.saini
2022-06-27 15:03 ` Andrew Rybchenko
2022-06-28  5:29 ` [PATCH v2] " abhimanyu.saini
2022-06-28  9:01   ` Andrew Rybchenko
2022-06-30 12:56   ` Maxime Coquelin
2022-07-01 13:58   ` Maxime Coquelin

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.