Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp189216rdh; Mon, 30 Oct 2023 19:37:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXo0sYrT2x/1l7MDrBBQknThp0h4BW2VLr8aSFdHQsJOMsMk0/2OOeKZQ1KuMVeHj+sKJ7 X-Received: by 2002:a05:6870:af8a:b0:1ea:c8a9:fce5 with SMTP id uz10-20020a056870af8a00b001eac8a9fce5mr14178181oab.38.1698719866097; Mon, 30 Oct 2023 19:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698719866; cv=none; d=google.com; s=arc-20160816; b=qO9g0JIdN66GtB5AEq9DEgrC3Q3Z746rfu3dETPiiV+6tN7cTFgMnaBVpX51POr7rY SsWktLK6o7lnK+sqqw6Ds7SqeAC4BCLYPH+yCY/95pABb56OeyDe6Ug4OzgRjwkXcQyw CcLI1R6e5f6GK7j9gPeV68qBrv4Uan3N9SFv00lAzrp/qqHaUG3u8QCkjHzrc7aYX+Hg jU78WGUiKBTz8RVM3dnQKwTRtxqrktccbmKGl3p5Sdh3ZMGBpuvRa3byeE7Ij1uKPgIn bF0jOR0oXpdwIQLQFuYDgO/wWU3rZiC6in4HR8nrhOqBLD1GHEKK8yAhIDDs61FUtkL0 lIsQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2+ZCd2Ukl3tdwspiNdzftO/ZiqT8EGhicvhl00o1cfk=; fh=QBHJhMFaY+lWbqr2wKEcOz8zsPIdmcjBYs3CtaAVoV4=; b=rlICba1d5yaGpOlfF5saSJEb6dAc8rwNGxCnnHkLUpoWOzmGv9+d/rwuA0iJoNOyHo 87o5bBy0eVaFDFRX1WKqqqm8uMs5M7c60MmAtp++XnQcyIDnI09DD28rSkDyUL4AfdDL UyZ9FbRVxrCu3TErE5gL3fhkifWHBobAq3x3KoeyJvXpRje3PZDspZhn5natyK1R1yNJ GBABryXpPRDRsgI8cPXeQIPlBWHjF/eUdq4/4TwjokxZEIaf5MKtts/jtIvyj+dk2yv/ 8kXkkYYCzzC95LSAoMKGhqYhRmK1zbzmZYt8YDfvCP03CkxrfS23aaZq06I0sUDrGHZj lBzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id w2-20020a636202000000b00578da80ac3dsi340298pgb.80.2023.10.30.19.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:37:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7FF7280412FC; Mon, 30 Oct 2023 19:37:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234793AbjJaChS (ORCPT + 99 others); Mon, 30 Oct 2023 22:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235192AbjJaChO (ORCPT ); Mon, 30 Oct 2023 22:37:14 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A88C5; Mon, 30 Oct 2023 19:37:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VvFqPhN_1698719822; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFqPhN_1698719822) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:37:03 +0800 From: 'Guanjun' To: dave.jiang@intel.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, tony.luck@intel.com, fenghua.yu@intel.com Cc: jing.lin@intel.com, ashok.raj@intel.com, sanjay.k.kumar@intel.com, megha.dey@intel.com, jacob.jun.pan@intel.com, yi.l.liu@intel.com, tglx@linutronix.de Subject: [PATCH v3 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor Date: Tue, 31 Oct 2023 10:36:59 +0800 Message-Id: <20231031023700.1515974-2-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031023700.1515974-1-guanjun@linux.alibaba.com> References: <20231031023700.1515974-1-guanjun@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:37:36 -0700 (PDT) From: Guanjun The int_handle field in hw descriptor should also be protected by wmb() before possibly triggering a DMA read. Fixes: ec0d64231615 (dmaengine: idxd: embed irq_entry in idxd_wq struct) Signed-off-by: Guanjun Reviewed-by: Dave Jiang Reviewed-by: Fenghua Yu --- drivers/dma/idxd/submit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c index c01db23e3333..3f922518e3a5 100644 --- a/drivers/dma/idxd/submit.c +++ b/drivers/dma/idxd/submit.c @@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) portal = idxd_wq_portal_addr(wq); - /* - * The wmb() flushes writes to coherent DMA data before - * possibly triggering a DMA read. The wmb() is necessary - * even on UP because the recipient is a device. - */ - wmb(); - /* * Pending the descriptor to the lockless list for the irq_entry * that we designated the descriptor to. @@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc) llist_add(&desc->llnode, &ie->pending_llist); } + /* + * The wmb() flushes writes to coherent DMA data before + * possibly triggering a DMA read. The wmb() is necessary + * even on UP because the recipient is a device. + */ + wmb(); + if (wq_dedicated(wq)) { iosubmit_cmds512(portal, desc->hw, 1); } else { -- 2.39.3