Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1655206pxu; Sun, 6 Dec 2020 03:01:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqcHOyx3retmFAK2jJN0etrRA2X6I/OIKuOHZKounR6hIMsNr9KIPBYI1qJBjNs50pmy6U X-Received: by 2002:a17:906:94d4:: with SMTP id d20mr14620736ejy.475.1607252496474; Sun, 06 Dec 2020 03:01:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607252496; cv=none; d=google.com; s=arc-20160816; b=dPS412zLRGpc9iHaPoVX6IAttyPlbugsepbSCDlq06HgN4UuesB0f6r1TPOvcRA6uT 4sMxezoDH5I2Ko9frQMeJRU8Yj2TBegMKNwEvdM7WzbaWUmldP7mKyWcqqp9fCoRiPXp /0N4+pQx7UT4ZlrBys8x5uBoedxzwsc1KMO30ikgYjF+0KV5EwSJrQde+Y+y52ImVhRy 9lD+CUm+JM7aZlCs36FLS0ze/L0WV9BJduCYTQ8ptXaZXGTgcXu2u3EA708iTng4kJPv yuW9r4pP+COr9zVD9Q98sZTfYHl7xm3o709s4TctQ2BWtbLRy3A1GBiXvHUM1PmCITHI ngXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=Zkkbs03esi6gHdtbZwp7PNxhGdhjxkgmGEXLhNQpLr0=; b=Og2eGRJURHGUP5pvRTsisFC+lLsvLuBIpPA3Lhhxz1MiV3hLtiCdcWtIVIzyLwF34F PPoV5uduWnGgkl2xnCimnjC75pU+SgVe8wq6uDaJV9bRwHr+8vfWcxVxPeemLYi10PAg Iby96LGoe/L+/A4HVbtCwfPQTm26yqk7RGkd0lA44aooDSRkN96gHFiiSUTkh7zcsN8n yCw795KLp5sU23JpXR2CNu/mpJ3AOfgRbdIM7IsVuzjzA3EHsUiLLwcxHkoS9USMy0IV w5t/Shu8ULYzZppbFJkCx879ATZOyYLrNSkhTSbkDa0zZaOMFMsdMplqkMWxQFQAwYlq 5lnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=oxMIbOM1; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si3915161ejr.379.2020.12.06.03.01.12; Sun, 06 Dec 2020 03:01: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=@nvidia.com header.s=n1 header.b=oxMIbOM1; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbgLFK6K (ORCPT + 99 others); Sun, 6 Dec 2020 05:58:10 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:14353 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgLFK6K (ORCPT ); Sun, 6 Dec 2020 05:58:10 -0500 Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Sun, 06 Dec 2020 02:57:30 -0800 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Sun, 6 Dec 2020 10:57:27 +0000 Received: from vdi.nvidia.com (10.124.1.5) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1473.3 via Frontend Transport; Sun, 6 Dec 2020 10:57:26 +0000 From: Eli Cohen To: , , , CC: , Eli Cohen Subject: [PATCH] vdpa/mlx5: Use write memory barrier after updating CQ index Date: Sun, 6 Dec 2020 12:57:19 +0200 Message-ID: <20201206105719.123753-1-elic@nvidia.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1607252250; bh=Zkkbs03esi6gHdtbZwp7PNxhGdhjxkgmGEXLhNQpLr0=; h=From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:Content-Type; b=oxMIbOM1ZGAOqvpIWDghd7V91KJ6tRwv89/wtGHH+4XNWq0RyoK5rRvdDaqtasnPo rHcWj5icTYAsa11wqeOJ9Akyddi5FGZADSlkIy8TI+QfkMcufafPp4r3odDYGZk092 FIIHJlVu/LwOpGAyyRCfBQXeW3bnRp7fXKp+SFJDLlPGOf4YrTFnwMUM8wpACx8mTf Qn6Aw9pMsH/0TNbw1JNY35tYgQie2WU0W5bPUhPn4lwi6BwhVamMe09a77B1QBnMJx E+5W2E9b0Vv6KrnSSGzLCx48jPDaW+nGALr1OECDcgeL7gVA2P2pqJ/b2UJEnF6p9B Aro8pHyJewI3w== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); --=20 2.27.0