Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5554395pxu; Tue, 22 Dec 2020 22:27:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwaw7Fbmh5iQHhmqFZUzeGQ6UaCSjdJMn2cr9GzASAx8DQbprTTk9DshFpXIuMlakvl/K9 X-Received: by 2002:aa7:d2d3:: with SMTP id k19mr9195407edr.28.1608704820272; Tue, 22 Dec 2020 22:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608704820; cv=none; d=google.com; s=arc-20160816; b=F0B8x4VYssXx95MWxNK/fc080rbw4wkTDRTb8ADSkzwPrGyb2rWnYTELprGwjZAAWS WAZ0/PH3nkyXDmj0cyhiybs4+LNTOpWhSS/43E6D0cR+K9AVDcagQItCWpgE3+pk1Zhp a10BjJ0dQ6PN2wAFZXOaLzA/grm1lyCF5f7rDkEylgDoWRDjNT9fMs1nN7n3v8sZcLmD wEzu6uSx63nt+Cy4fQZX9NAPcw7HzZ/d+jpZUXUULsFeVxfAJaDNZa2yboz7PaLKCODc P3Th0aByJ7fM8x9MDyNwL0avDKb3AJpgzLilDCnHW7BHR+0WX2uuIxjTGSah2Oj9kCje Zypw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QiwH8ao3HelKgvVCUMgmqCqlcpNzwtvsd407+B9/1NY=; b=orORStki7KokV+nHlMYyy1UeY2lO67/TISVGF1MCEbO/Xz37sENEqIcdRtxWKlgq/C 9eGaivuVWMBDoxDY+ebCdlXPoT8iRZFa0krLRLYEPYrlqGDrinoB5zpg4tzNq7RDeEc4 OQMusGUZaSd4lrTteNC2AQidwhd7QDG30ieKu+93kXf60Wl4aQkFgeVZQmZ7OrAVdyhT DtbphS+69eGCTyEqw1CBJ5MO7e3qZtmgNmFp5i/m9wy6uV2wapU9g+lpZcn1XT6yyAWS AAn976MFOfHFOWMR5HgPIc3XFGI7LYRjZbb5J/omEUJdDRBPhjf6Fawn60r0G3/xjaEh cUvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=eYnQiqzk; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si2612425ejs.503.2020.12.22.22.26.38; Tue, 22 Dec 2020 22:27:00 -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=@gmail.com header.s=20161025 header.b=eYnQiqzk; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727377AbgLWGZE (ORCPT + 99 others); Wed, 23 Dec 2020 01:25:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbgLWGZE (ORCPT ); Wed, 23 Dec 2020 01:25:04 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF0C5C0613D3 for ; Tue, 22 Dec 2020 22:24:23 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id f14so2494887pju.4 for ; Tue, 22 Dec 2020 22:24:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QiwH8ao3HelKgvVCUMgmqCqlcpNzwtvsd407+B9/1NY=; b=eYnQiqzkc8vzQwlMvfZzfj7syy7MJ1XFHJjiVNkeZHNg3jyRjKCiR+TPpvalS6M2Pc 2xsl6Gln5wx027ZKiQpWimcwigEU0tvBHl2sdCYyWupq0P/uHegXExkviWowQ6WYJqbc HnZDPjn7+nTnvg4racg/ahs7PvAhDet12LBwQ5S9DljuYWzxzbdmOKP8UpBlZb2ZMB/2 czxBL0Ow4GAsTFSR4f4WsKJ1dRYlZJ1FVLB4U/Nv/PrzefztSxTNI6TggEQHGmF65uX6 AXqzmq5KeNYX1Zp0T8TVIwXBpJX6aMmhAU1R2AC5h6DKxrEFY+HrcLFTxiDkOGEPcWCW S0Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QiwH8ao3HelKgvVCUMgmqCqlcpNzwtvsd407+B9/1NY=; b=Q7bJshPB8bLyEVf8KVLcK/49zFZcbv8klnODyxkkBsXhb8ddX5N4zDKiFvsUMOU4JD qkQhI3L3mX6zUKEEjXHkf3XgG5OE5yGCp9q15/smdDo9y6bh2zdcqZyMv4XjjaLi12MU tE8Y+dJzjPeUAMgAIX5s8mqY6E7E866o6O8W4nsg9s+xzOLXtVnRWlGUiYDdHqHbCJRb OQZObFWOOo+PYrnvwh1CtgyQGZ8tqqD5TLbHneMtCpjF7scDiCLWasK0z6MKQUaokJxm rsM1ymcXd6YFc9/PasVXn08SzUqR373OrATB6Lo8KzrzIFB4z8Z0lFwY3rRauNGhZwlZ K1UQ== X-Gm-Message-State: AOAM531slkbc0X0gJNM6TyfA9lvy6Wiqlfdsy+B3Bi8s74ZNpcktsr2d wYzWywUB9sRb58SpuolKPeQggtYEZuI= X-Received: by 2002:a17:90a:12c4:: with SMTP id b4mr25060313pjg.234.1608704663193; Tue, 22 Dec 2020 22:24:23 -0800 (PST) Received: from ZB-PF0YQ8ZU.360buyad.local ([137.116.162.235]) by smtp.gmail.com with ESMTPSA id y6sm1480667pjl.0.2020.12.22.22.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 22:24:22 -0800 (PST) From: Zhenzhong Duan To: linux-kernel@vger.kernel.org Cc: zhongjiang@huawei.com, joe@perches.com, konrad.wilk@oracle.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, iommu@lists.linux-foundation.org, dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, Zhenzhong Duan Subject: [PATCH] x86/iommu: Fix two minimal issues in check_iommu_entries() Date: Wed, 23 Dec 2020 14:24:12 +0800 Message-Id: <20201223062412.343-1-zhenzhong.duan@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org check_iommu_entries() checks for cyclic dependency in iommu entries and fixes the cyclic dependency by setting x->depend to NULL. But this repairing isn't correct if q is in front of p, there will be "EXECUTION ORDER INVALID!" report following. Fix it by NULLing whichever in the front. The second issue is about the report of exectuion order reverse, the order is reversed incorrectly in the report, fix it. Signed-off-by: Zhenzhong Duan --- arch/x86/kernel/pci-iommu_table.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/pci-iommu_table.c b/arch/x86/kernel/pci-iommu_table.c index 2e9006c..40c8249 100644 --- a/arch/x86/kernel/pci-iommu_table.c +++ b/arch/x86/kernel/pci-iommu_table.c @@ -60,7 +60,10 @@ void __init check_iommu_entries(struct iommu_table_entry *start, printk(KERN_ERR "CYCLIC DEPENDENCY FOUND! %pS depends on %pS and vice-versa. BREAKING IT.\n", p->detect, q->detect); /* Heavy handed way..*/ - x->depend = NULL; + if (p > q) + q->depend = NULL; + else + p->depend = NULL; } } @@ -68,7 +71,7 @@ void __init check_iommu_entries(struct iommu_table_entry *start, q = find_dependents_of(p, finish, p); if (q && q > p) { printk(KERN_ERR "EXECUTION ORDER INVALID! %pS should be called before %pS!\n", - p->detect, q->detect); + q->detect, p->detect); } } } -- 1.8.3.1