Re: [PATCH] vdpa/mlx5: Use write memory barrier after updating CQ index
flat view
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2020-12-08 13:55:00
Also in:
lkml
On Tue, Dec 08, 2020 at 11:15:00AM +0200, Eli Cohen wrote:
On Mon, Dec 07, 2020 at 10:51:44AM +0800, Jason Wang wrote:quoted
On 2020/12/6 下午6:57, Eli Cohen wrote:quoted
Make sure to put 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. Change-Id: Ib0ae4c118cce524c9f492b32569179f3c1f04cc1Michael, I left this gerrit ID by mistake. Can you remove it before merging?
No problem.
quoted
quoted
Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") Signed-off-by: Eli Cohen <redacted> --- 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 1f4089c6f9d7..295f46eea2a5 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c@@ -478,6 +478,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. + */ + wmb(); rx_post(&mvq->vqqp, num); if (mvq->event_cb.callback) mvq->event_cb.callback(mvq->event_cb.private);Acked-by: Jason Wang <redacted>
_______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization