2022-12-21 06:41:13

by Jason Wang

[permalink] [raw]
Subject: [PATCH] vdpa_sim: use weak barriers

vDPA simulators are software emulated device, so let's switch to use
weak barriers to avoid extra overhead in the driver.

Signed-off-by: Jason Wang <[email protected]>
---
drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index b071f0d842fb..eeaeaf43b476 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -68,7 +68,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];

vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features,
- VDPASIM_QUEUE_MAX, false,
+ VDPASIM_QUEUE_MAX, true,
(struct vring_desc *)(uintptr_t)vq->desc_addr,
(struct vring_avail *)
(uintptr_t)vq->driver_addr,
--
2.25.1


2022-12-21 09:25:48

by Stefano Garzarella

[permalink] [raw]
Subject: Re: [PATCH] vdpa_sim: use weak barriers

On Wed, Dec 21, 2022 at 02:21:46PM +0800, Jason Wang wrote:
>vDPA simulators are software emulated device, so let's switch to use
>weak barriers to avoid extra overhead in the driver.
>
>Signed-off-by: Jason Wang <[email protected]>
>---
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

I was going to propose the same :-)

Reviewed-by: Stefano Garzarella <[email protected]>

>
>diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>index b071f0d842fb..eeaeaf43b476 100644
>--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
>+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
>@@ -68,7 +68,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
> struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>
> vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features,
>- VDPASIM_QUEUE_MAX, false,
>+ VDPASIM_QUEUE_MAX, true,
> (struct vring_desc *)(uintptr_t)vq->desc_addr,
> (struct vring_avail *)
> (uintptr_t)vq->driver_addr,
>--
>2.25.1
>

2022-12-23 10:39:06

by Eugenio Perez Martin

[permalink] [raw]
Subject: Re: [PATCH] vdpa_sim: use weak barriers

On Wed, Dec 21, 2022 at 7:21 AM Jason Wang <[email protected]> wrote:
>
> vDPA simulators are software emulated device, so let's switch to use
> weak barriers to avoid extra overhead in the driver.
>
> Signed-off-by: Jason Wang <[email protected]>

Acked-by: Eugenio PĂ©rez <[email protected]>

Thanks!

> ---
> drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index b071f0d842fb..eeaeaf43b476 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -68,7 +68,7 @@ static void vdpasim_queue_ready(struct vdpasim *vdpasim, unsigned int idx)
> struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>
> vringh_init_iotlb(&vq->vring, vdpasim->dev_attr.supported_features,
> - VDPASIM_QUEUE_MAX, false,
> + VDPASIM_QUEUE_MAX, true,
> (struct vring_desc *)(uintptr_t)vq->desc_addr,
> (struct vring_avail *)
> (uintptr_t)vq->driver_addr,
> --
> 2.25.1
>