Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2093346pxu; Sun, 6 Dec 2020 18:56:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyw5n2dMrPcGxJIA0ViU2roKqT6MNwNFGsrkoSQ/YXrdpdMXUeVBSc4xB6R6f/CFIfTMWtg X-Received: by 2002:a50:9354:: with SMTP id n20mr3044386eda.231.1607309768017; Sun, 06 Dec 2020 18:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607309768; cv=none; d=google.com; s=arc-20160816; b=lex/29e5jizg38lKI9GXnb5VUjPDBFWmR5sJl2upj2Bynw0IN4nqhGAQ0iKWB1EBH9 RWYSAqSzJP+xtVxKmIa5KZAy7rRVoGTznHjqiqgPVguHxUwS2J8rMiBG5T5TA2ntWgj+ MmHv2PZ1BzLkl+tgMkA07qpDiX566aThbqaPiYgeZKRfUIIcyHD78TpmoF0I5auMyS7K mNz2fpXHQb01OjHzctC88rQDfUQ6jhu+WhH0V0hWB7ZYuojo8uaC1CaSJBl7isP7DUpB RT0GYtu0IH1RycyG3nkG/ZXZbGlR1/abhOlESuN7m8n8C9lO+LMKEQJotitHv8jwEBky RQLQ== 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=LK1gkUDCVU2wXhLmdo9y4e2VFlC9AyfBMYWVi3JTuH0=; b=eXl/G1aSyUE8a+eJwJTXv0kJ0FXIBFCL05zyHBpz/Ead7Vp8zeNj0hhwUDnr+OFUtt /LVxwm+mHEr8fv5HukXINyZUStg5PkfQeRZOGcxpuJOG4dZa5g9vMEj55Ge3TUlI7U3N c0E5lk0bAOWCmETQaksDFEUNq+R4Sy2m5ZBxgwaG1j1KvrVlZIh5OuA+1sQWQxgjBJWF mOt4qqCvx2oeG1l6zP8FfNnpcekmwTJjA94CwcJTMR0E4W9Pkzoj4ARhqdFQc3FHsKSm FZ828mWYRbvDbVEyrNrlsSm03/5JFHgdyyW5y36LMnN7kGkrJsa/O4lEFt4ZhfcxEp/a XGgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="TT23swG/"; 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 r21si6793515ejo.100.2020.12.06.18.55.44; Sun, 06 Dec 2020 18:56:08 -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="TT23swG/"; 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 S1728457AbgLGCxT (ORCPT + 99 others); Sun, 6 Dec 2020 21:53:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23256 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgLGCxT (ORCPT ); Sun, 6 Dec 2020 21:53:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607309513; 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=LK1gkUDCVU2wXhLmdo9y4e2VFlC9AyfBMYWVi3JTuH0=; b=TT23swG/ZLhdn2bQM4s5FcY9hj/Qjt55Ae6s5mZdaut8q2QG3gZjoldTGVerlJXcnYvtDK DPOWOVuaUzpiJNHOgsUJVNJd8HNWv+Fk6FjVx0IJ8i3cliJBCzQJPYu8bO0F47S/lKHTm/ MsF65oSC5J62Gf/PrcaKh15xboEDaa4= 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-287-qTtKdB2CO4-FOUQ3lhPbRQ-1; Sun, 06 Dec 2020 21:51:51 -0500 X-MC-Unique: qTtKdB2CO4-FOUQ3lhPbRQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52ECC801B12; Mon, 7 Dec 2020 02:51:50 +0000 (UTC) Received: from [10.72.13.171] (ovpn-13-171.pek2.redhat.com [10.72.13.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8164E5D9DC; Mon, 7 Dec 2020 02:51:45 +0000 (UTC) Subject: Re: [PATCH] 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 References: <20201206105719.123753-1-elic@nvidia.com> From: Jason Wang Message-ID: Date: Mon, 7 Dec 2020 10:51:44 +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: <20201206105719.123753-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.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/6 下午6:57, Eli Cohen wrote: > 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: Ib0ae4c118cce524c9f492b32569179f3c1f04cc1 > Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices") > Signed-off-by: Eli Cohen > --- > 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