Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp184720rdh; Mon, 30 Oct 2023 19:20:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGbfTZ5/grQfikP8grZ6uyOnMONnD44j372xk+HtxYlPqFFgtGyv6nBmKSE14mh0B1umZF X-Received: by 2002:a05:6a20:869e:b0:17b:d39c:1d6 with SMTP id k30-20020a056a20869e00b0017bd39c01d6mr6733666pze.30.1698718842068; Mon, 30 Oct 2023 19:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698718842; cv=none; d=google.com; s=arc-20160816; b=kh/JTh1TEXeEidciNJMDUHbPpsxDR6kjxRyikUkcaMoymW3Kko5uHttgmuRIBaRGQc upbP9IPpcVCPcMzn5n3dsNDJyaWkh0VTvRrMasw2JmU5wF8V1OwRJOc4Lwk4TeJHDcgu o2kq5S72vwoekPUQuL7SJttT+54SjVPkYek6vMXzYWsCpf+QaqHXWShze66G7HTEuyNE FvCfb3EScmx1CzlFm0SaX80JLdpsZUi9FdyWfy8tpoxJqHRTlGf70+SzYtcC4a1Jsjyd LxcmKYA5bXi+WxW4jmvfT3iJKxTQlz2rTvpoDcrv+MZklgqJhT07fiJeuTmKgZK2alKh eFAQ== 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=YLT+0z5Hd0/f0myrnD1eJC6a0fukVISnMDvCx6STdHC0kFKjFKUeYt/xGYKagE2mPo Bei0gDUqmxNvblCjry45jIKS9bWkWeAe3RMC8duijZ7eYcZ/gKpdAMUtajU/7HrHfnOT p4UKXKVEL22a/YF9Xl8e3OM68qD4pcCDhCZV1HOrgfqK+LPuoS0Q1rsn8ZUv/b2jFUB/ xLzb5BpWs2S5npm0310vcCeEoSOhm7NGO/DxJuRZ5IqyzkbeWDFgErAHCdCpZ46Idbm0 y4SkMoAQXKWdCVw1pEuvMddzUOVNK/e03tEMhgYOCqmMRqNA27qKVmnG0/bMLUC/S84d LPnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id r21-20020a63ec55000000b005b918d9a3c2si312297pgj.868.2023.10.30.19.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 20CEB80B1FBA; Mon, 30 Oct 2023 19:20:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233342AbjJaCUc (ORCPT + 99 others); Mon, 30 Oct 2023 22:20:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbjJaCU1 (ORCPT ); Mon, 30 Oct 2023 22:20:27 -0400 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15A0E8; Mon, 30 Oct 2023 19:20:23 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=guanjun@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0VvFgelA_1698718819; Received: from localhost(mailfrom:guanjun@linux.alibaba.com fp:SMTPD_---0VvFgelA_1698718819) by smtp.aliyun-inc.com; Tue, 31 Oct 2023 10:20:20 +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 v2 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor Date: Tue, 31 Oct 2023 10:20:16 +0800 Message-Id: <20231031022017.1515471-2-guanjun@linux.alibaba.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231031022017.1515471-1-guanjun@linux.alibaba.com> References: <20231031022017.1515471-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:20:39 -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