[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <26dd1676-ff63-4940-9b0d-d7097950c1e5@redhat.com>
Date: Thu, 10 Dec 2020 17:11:02 +0800
From: Jason Wang <jasowang@...hat.com>
To: Eli Cohen <elic@...dia.com>, mst@...hat.com,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org
Cc: lulu@...hat.com, maxime.coquelin@...hat.com
Subject: Re: [PATCH v1] vdpa/mlx5: Use write memory barrier after updating CQ
index
On 2020/12/9 下午10:00, Eli Cohen wrote:
> Make sure to put dma write memory barrier after updating CQ consumer
> index so the hardware knows that there are available CQE slots in the
> queue.
>
> Failure to do this can cause the update of the RX doorbell record to get
> updated before the CQ consumer index resulting in CQ overrun.
>
> Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
> Signed-off-by: Eli Cohen <elic@...dia.com>
> ---
> V0 -> V1
> Use dma_wmb() instead of wmb()
Acked-by: Jason Wang <jasowang@...hat.com>
>
> drivers/vdpa/mlx5/net/mlx5_vnet.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index db87abc3cb60..43b0069ff8b1 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -479,6 +479,11 @@ static int mlx5_vdpa_poll_one(struct mlx5_vdpa_cq *vcq)
> static void mlx5_vdpa_handle_completions(struct mlx5_vdpa_virtqueue *mvq, int num)
> {
> mlx5_cq_set_ci(&mvq->cq.mcq);
> +
> + /* make sure CQ cosumer update is visible to the hardware before updating
> + * RX doorbell record.
> + */
> + dma_wmb();
> rx_post(&mvq->vqqp, num);
> if (mvq->event_cb.callback)
> mvq->event_cb.callback(mvq->event_cb.private);
Powered by blists - more mailing lists