All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <elic@nvidia.com>,
	mst@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Cc: lulu@redhat.com, maxime.coquelin@redhat.com
Subject: Re: [PATCH v1] vdpa/mlx5: Use write memory barrier after updating CQ index
Date: Thu, 10 Dec 2020 17:11:02 +0800	[thread overview]
Message-ID: <26dd1676-ff63-4940-9b0d-d7097950c1e5@redhat.com> (raw)
In-Reply-To: <20201209140004.15892-1-elic@nvidia.com>


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@nvidia.com>
> ---
> V0 -> V1
> Use dma_wmb() instead of wmb()


Acked-by: Jason Wang <jasowang@redhat.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);


WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <elic@nvidia.com>,
	mst@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Cc: maxime.coquelin@redhat.com, lulu@redhat.com
Subject: Re: [PATCH v1] vdpa/mlx5: Use write memory barrier after updating CQ index
Date: Thu, 10 Dec 2020 17:11:02 +0800	[thread overview]
Message-ID: <26dd1676-ff63-4940-9b0d-d7097950c1e5@redhat.com> (raw)
In-Reply-To: <20201209140004.15892-1-elic@nvidia.com>


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@nvidia.com>
> ---
> V0 -> V1
> Use dma_wmb() instead of wmb()


Acked-by: Jason Wang <jasowang@redhat.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);

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

  reply	other threads:[~2020-12-10  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 14:00 [PATCH v1] vdpa/mlx5: Use write memory barrier after updating CQ index Eli Cohen
2020-12-10  9:11 ` Jason Wang [this message]
2020-12-10  9:11   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26dd1676-ff63-4940-9b0d-d7097950c1e5@redhat.com \
    --to=jasowang@redhat.com \
    --cc=elic@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.