Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp547859ybv; Sat, 22 Feb 2020 09:04:18 -0800 (PST) X-Google-Smtp-Source: APXvYqyWzlxUIT9PlMyGlmZj/QygbCm91ekRsHd00mjiG+wvzFoKzZFyMe1eIW9FUITM6I9sherD X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr34853520otn.22.1582391058123; Sat, 22 Feb 2020 09:04:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582391058; cv=none; d=google.com; s=arc-20160816; b=01RKvsUCPLrWpm+ZxmcfyIP5+fn6dvUFw0QO9dL317ddLHcqOks5tsRDFX3RV0kwS4 rlsyqK71kKafRxKgzdxVIBowAoFy8LjnnR3mIG/dwMqjmBVebgHudmLWTkfCFQVUXGqq Q3uTPX6xHJp9AaWSH/vFTtp7NgrEwBK4xt8RyCj2bFUiKqo8J+PwyyNd7qIxfWHkGdRX G0Gh18P/TAJC4rZjw4A6ZqxChY+oo4qDp5cU/rzOoT8esZWaBmN8L9DRfSwaerU+icq8 W196pz5FQ9uhz5m0jPV1m+VGEKfrjledT3YG/yt7Ue8TQw3ow4NYZzXCpsyFYKH5wG+/ SZFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XO/sXJfBbNEYg2i8BDzFxjIgOlJB//vgC4CZTQZkcBA=; b=zc3S9eg++4mkbEA6D5wZC0MZhCEwFfvk/E/JvLN2jjWzvIy2gFICfSSuhZ+ImdNrBZ prjxNI7wZLztyOZTy8x5nPt0hEXn8SWOJ35+Sdb/59ai5AiWOLuiKwx0iJArhOtC9o9J k+6TDCQ7LbuXvFIhJE1TWShcpRU2UezrxeU/zxgXgpJtPPE7NYsCIzkv/NUroEtimGNm XrzKqqbUJODPpKQ446Pzg+GqfXVgdmM7ByJGx+rADGh8GLHjE1ITZeXME7+6N34hSExG 3yFZwIceSsbBN+byHsHIDQyfzF1L7ckPdOyu5BlPxOQ2TAWN/qc0Ru1M+N6XU2E6gz0y aiEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PJmGn2jA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v11si3507526otp.279.2020.02.22.09.04.05; Sat, 22 Feb 2020 09:04:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PJmGn2jA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726791AbgBVRD4 (ORCPT + 99 others); Sat, 22 Feb 2020 12:03:56 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:38966 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbgBVRD4 (ORCPT ); Sat, 22 Feb 2020 12:03:56 -0500 Received: by mail-pf1-f193.google.com with SMTP id 84so2980506pfy.6 for ; Sat, 22 Feb 2020 09:03:56 -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=XO/sXJfBbNEYg2i8BDzFxjIgOlJB//vgC4CZTQZkcBA=; b=PJmGn2jApbOjslqr8jSDJI6wgkUPvtJw+T1CKTeT7HgtsLJPEzjkhoAJt0d5kMaAg1 1wUpg4ZzCivc9q/Ma0ZnjuzyhAiYmmC83H1XBgFzQ8IlM25FN0pqjduiRNAijPxfVBKO ZdwNLf++C3filmTuiH4b5cPn3Tb0PH7nKLMh8dqGwvrHpTY7tR3iUEOqZLIPJkhN5onm GPlV8ugIs/Hp3NfC0ZcUTkmNAedBOgXOg/+UD+7j/jYwEo6Dl0ZLTIFoxNGsgM1h0rI8 OOdJBAYJaUYXVINQYY+xhJHOKvliSwRdQEshUKSZ2azB2KzwUNjPR3byMUa9afzAQztK 0klg== 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=XO/sXJfBbNEYg2i8BDzFxjIgOlJB//vgC4CZTQZkcBA=; b=P1b4gVj0w9gRto3XPqSPHGPrzW98nwPzMpoFo3eIIWNcvbD93e0tRaB0SS7npdUNlK UetLTWJ8HptrmB1gprCZdysVNleArNbtTWhMHimgceRUEWiPeAn0if7pUI3BRjxodEOS wx2G/NGH+MayIgMyd1QSIvIIpPYbh+oi9Doe5yaVJeE6dbtG2JuGyiGOFdIvVgQStVk8 JaJS4IEa3xfz8UfD8Bdi33aFvXw/KvHkTeQEiPX2JwWKNxZ68yDuySbrGeOs3PHzzzS5 10lqd5H+BncoLThrJ8BEKmROY9Tce2FCG0Yk8Gk9rQgI47xi9KzOmuaCehbYq2vm2is7 4Drw== X-Gm-Message-State: APjAAAXOv47WlQN2pxwuVRW45KEBdCU+j9awEfEu77l1ZA4/mJU42Kci WSqo03WmpSy9opvEXuoKV0M= X-Received: by 2002:a63:5d47:: with SMTP id o7mr10454009pgm.327.1582391035691; Sat, 22 Feb 2020 09:03:55 -0800 (PST) Received: from localhost.localdomain ([103.87.57.201]) by smtp.googlemail.com with ESMTPSA id z64sm7286220pfz.23.2020.02.22.09.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 09:03:55 -0800 (PST) From: Amol Grover To: Allison Randal , Greg Kroah-Hartman , Andrew Morton , Lu Baolu , Thomas Gleixner , Qian Cai , Deepa Dinamani Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH] iommu: dmar: Fix RCU list debugging warnings Date: Sat, 22 Feb 2020 22:33:33 +0530 Message-Id: <20200222170333.10570-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dmar_drhd_units is traversed using list_for_each_entry_rcu() outside of an RCU read side critical section but under the protection of dmar_global_lock. Hence add corresponding lockdep expression to silence the following false-positive warnings: [ 1.603975] ============================= [ 1.603976] WARNING: suspicious RCU usage [ 1.603977] 5.5.4-stable #17 Not tainted [ 1.603978] ----------------------------- [ 1.603980] drivers/iommu/intel-iommu.c:4769 RCU-list traversed in non-reader section!! [ 1.603869] ============================= [ 1.603870] WARNING: suspicious RCU usage [ 1.603872] 5.5.4-stable #17 Not tainted [ 1.603874] ----------------------------- [ 1.603875] drivers/iommu/dmar.c:293 RCU-list traversed in non-reader section!! Tested-by: Madhuparna Bhowmik Signed-off-by: Amol Grover --- include/linux/dmar.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/dmar.h b/include/linux/dmar.h index f64ca27dc210..712be8bc6a7c 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h @@ -69,8 +69,9 @@ struct dmar_pci_notify_info { extern struct rw_semaphore dmar_global_lock; extern struct list_head dmar_drhd_units; -#define for_each_drhd_unit(drhd) \ - list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) +#define for_each_drhd_unit(drhd) \ + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ + dmar_rcu_check()) #define for_each_active_drhd_unit(drhd) \ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ @@ -81,7 +82,8 @@ extern struct list_head dmar_drhd_units; if (i=drhd->iommu, drhd->ignored) {} else #define for_each_iommu(i, drhd) \ - list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ + list_for_each_entry_rcu(drhd, &dmar_drhd_units, list, \ + dmar_rcu_check()) \ if (i=drhd->iommu, 0) {} else static inline bool dmar_rcu_check(void) -- 2.24.1