Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9091077pxu; Mon, 28 Dec 2020 06:25:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuJ+QUNr5ru2g2Io0X1fCEeoHxmwO89y+JmxrEUsVtwpgpmY5oqq0OP4iT1h1kGFZCWXAx X-Received: by 2002:a17:907:3f93:: with SMTP id hr19mr43197389ejc.235.1609165512410; Mon, 28 Dec 2020 06:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165512; cv=none; d=google.com; s=arc-20160816; b=Eh5f8qB0bLM08r+7Sf7//NUXd2tTL1XZL7KHqCKq0oy1Skco9oSyXF3IP81r0MvyX9 CKMhGjn+kYQi4zTAo1pJHczXa02ek9OmZB92lV+Sb6Q+Pl3A1CxT2/9YgiuovAP5AkMP AjQIubD9dJzUtGOq9VRvtgQuVKsblGxRyiD9NlPwNCH3j6KPSB8b+1WfkQVLAI8Xw+Yq VqVvhGs5MiUjtwwywm+9ZkLXrAqeb9KEOEsnQ/ljoNTSFO2PmvGJNcHo/R/O5edw99bf CxCvhgPeYXlpnG/BwNkdMg3kQFhXmQl2pFWwCU0PnCXAF73ypeZPS1aqEzfkc/UwjofH 8MCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tK6ldykC1uzh7JmchFiWY26RMdXvsUFVOyVMX/VBwt8=; b=FXnIukqxtZ7w88JJe0icD9ikXYGwByrEGluNjX7VgGSbDO64zaoxzxpI/XEjjYHoqY bxNXXdMepuxWEm4FWDMHovSrJb9xkROpG1WLNhLmnZQfyCKq6hH0HrYeJnCrzqt9fv9T mZ5dlv7ynPmCdILOkb3rihZAowFPxGzmqmPFuJGN0UvdAY7/SrhG0NmIS9xzqf4flzOU P9pl+Qhv4mwMtc5UGSSGIfzIQhOTZigvr6UlftLrY5K/j0KH/UyIrXSDj48QxCV1Zyep 0VpzfyalT5S1SCjAqBw2aJeDpHYZSSGKhno/gOZV4k6xJahrh6d3F/xLiigrailkOaoO a0dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vc7epCMY; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o20si6348351edi.262.2020.12.28.06.24.47; Mon, 28 Dec 2020 06:25:12 -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=@linuxfoundation.org header.s=korg header.b=vc7epCMY; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502690AbgL1OWf (ORCPT + 99 others); Mon, 28 Dec 2020 09:22:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:58200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502668AbgL1OWb (ORCPT ); Mon, 28 Dec 2020 09:22:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6E0B322B2C; Mon, 28 Dec 2020 14:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165310; bh=+b53wZI83On3aGmgbPMhWqXugTD39OtO0fF5cNEUbHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vc7epCMYW0uUesdzsujixAw6sw6lDYCD+5n1EMywV8H88hG5ZSYBnxOPKvqieuApb w+aV1tsyYAt16jkai7peinrvrap8EXmtOLuku1ms8XiymXLIUMyclNbVOBSWuAPfCN kTpR+txqMroIGcHDwG9/nfrwBxDJIQTIB4veeX5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 5.10 488/717] vdpa/mlx5: Use write memory barrier after updating CQ index Date: Mon, 28 Dec 2020 13:48:06 +0100 Message-Id: <20201228125044.344626701@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eli Cohen [ Upstream commit 83ef73b27eb2363f44faf9c3ee28a3fe752cfd15 ] 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 Link: https://lore.kernel.org/r/20201209140004.15892-1-elic@nvidia.com Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- 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 1fa6fcac82992..81b932f72e103 100644 --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c @@ -464,6 +464,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); -- 2.27.0