Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4633779pxu; Thu, 10 Dec 2020 01:17:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfV8rNiGJOUghdjp1t5IK3+sjgJA1dwMq8HwjH1eJAV9nP7oAqgJPyZ129THv/jGSd7PGO X-Received: by 2002:a05:6402:4cf:: with SMTP id n15mr5826560edw.241.1607591856437; Thu, 10 Dec 2020 01:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607591856; cv=none; d=google.com; s=arc-20160816; b=SLYOYRkvbRZ0S2voYLiQxz26+unflDnLS5bbb6LFuW1xkGHpz0IKENWRtEQnb1uAqE iu5C2kduxiKmt7GwfyQ2VrkJQiOXf0Ze4qiNfTQ+Weoj0fPNJlfOBVR2fhHb/ybpKzOI gbJi3tHzn9wMyfS1/bcRhCR0QAlYAoKIqoAzIZdNwDcKGp0rKTQXjjaJ4SGIBb+sOVMr OVcqniuwa51/drG5NOam4Wv66HAXP26Kz1ZgLeHAKjWBPKGRN4sSGREcvfbU/mKc/lmj 4fQSukb1uMvVICNBVIOBBFbrqHjRWhZOhs58QsUZpcfgNVpfdSwUnnh+olSpaCYq+aPJ +mpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gb3SbnRTo+3pkXXdNLxcd5ljhhUyYYdpcGHBH8tC1V0=; b=H/gXq6OgGt3iWqf0iAbtNyLAhCqBJx9ns7RCkmExSrBZAoeaQXUDjEOY/WXqmqWtUa SPMWrb3MkR0DJ82Zw/e6uyabXIIhRDr2x9Inx3G4jUSRU8VYCPtcCuN62/al9LyVHUYM kyoyVA9T5eySnXx4nYKf7qWgMQ5f6iWJZEGmxg1lSYHazMsGk0kwqfN69yemCRlWh2Gg rjHKxSde2+qBsDz+jfcCtZcwAsYergkJ+eOa5zpcYZsgEG4EdV4TgD/okbYyCEkrJtjh R7ocuqUy+VoSZvwCMKUbex7jBZ4Qji0X7EHdk62F2MyYX4L9juQ6zb6DXW5eccMUC3B7 lbRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZZbUb9Ue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd19si2318300edb.502.2020.12.10.01.17.13; Thu, 10 Dec 2020 01:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZZbUb9Ue; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728147AbgLJJMu (ORCPT + 99 others); Thu, 10 Dec 2020 04:12:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51798 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729811AbgLJJMp (ORCPT ); Thu, 10 Dec 2020 04:12:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607591476; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gb3SbnRTo+3pkXXdNLxcd5ljhhUyYYdpcGHBH8tC1V0=; b=ZZbUb9Ue/CRtXFx/SakRKa3/fp+9zpKu9Zuuq7RM2KRUc3NDyAcsHmCYTC/h1QpgegMbTM r649zVtTVBlNmrLGBTUdRV6oWIahL41XT65mniWtLrSBoKPJ5uu+8CkO3HNtgunmseD8RE EqaULq5KRgF7Ox6wyIuA47UvMn91nZI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-8hJn_FKvPdSa1KjmAx1-Xg-1; Thu, 10 Dec 2020 04:11:14 -0500 X-MC-Unique: 8hJn_FKvPdSa1KjmAx1-Xg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF953802B49; Thu, 10 Dec 2020 09:11:13 +0000 (UTC) Received: from [10.72.12.50] (ovpn-12-50.pek2.redhat.com [10.72.12.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD8E160BF1; Thu, 10 Dec 2020 09:11:03 +0000 (UTC) Subject: Re: [PATCH v1] vdpa/mlx5: Use write memory barrier after updating CQ index To: Eli Cohen , mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: lulu@redhat.com, maxime.coquelin@redhat.com References: <20201209140004.15892-1-elic@nvidia.com> From: Jason Wang Message-ID: <26dd1676-ff63-4940-9b0d-d7097950c1e5@redhat.com> Date: Thu, 10 Dec 2020 17:11:02 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201209140004.15892-1-elic@nvidia.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > V0 -> V1 > Use dma_wmb() instead of wmb() Acked-by: Jason Wang > > 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);