Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1531863ybv; Sun, 23 Feb 2020 08:57:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwl2yW21/R5BtDmngFZQUTYUlCL2242iiOnjvB4WKX093EU/EQjc2PhvsC86TwzSUMaimy7 X-Received: by 2002:aca:4e02:: with SMTP id c2mr10013022oib.142.1582477031475; Sun, 23 Feb 2020 08:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582477031; cv=none; d=google.com; s=arc-20160816; b=rzZRDCUUV0gTbh0PWnvo20kVwkr399lsYIRFAjXC3671nP1oMFTTRAkA+VpIqvqosD TKseffNlbz5C/KOlcnj2rB9Ir4Es6Kag5R0WwDA0K4YSO2Q6wJ5QRj6LfHeBcluBbxxT KieoiRkzBrZ92yxp0fIFUlv1R4DCEy+qAzNWSYhII3qqj6OJooNeK4mj2g4hqLuJGmHE zM07eNnQYUQb/yx4ilENeF4TKeGRQ3XVYshRfNKV2jlCJlcrKfS0PMMjVlq2qp1gPFdH Ms9VyUyY95XHOvefP7qiRD0bSFrMTtMPhBuTPhUqGZITPbr6A/DGwLfKPUb0h/buqnPA zfCQ== 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=ehB87vHT1mcJrKTwrMbWyUQDxwRGXiDIrTY6sHX6tpIX4D/QQYAaTN3YsPb5iVvfdP l4xQA4I6QwFWi3eqq/IDFpE6ivceVd/htMJQow0OU2RbdF/xQjY7iFIEiz6VoGixqKPv tUferUjdp9RyZzNF3DWDXn8pssQbrbEbmgs15y626T30tIXV4cBr+c4zlHx0YkpklM34 tc1HapLJu+NKygD0bM2gobX+RwpCSVnTOvq+/PXIkBB6Y5wnOc2K6+RhDq22WoCIpFKI 4NbYT6BQN70Q8zI8OXNuBoWQabme/tCVqvZs3mn6iRxx+4pxVwyyg45vitoWQAHGpqW4 FpOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rNxBBtQQ; 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 i6si5563463otj.24.2020.02.23.08.56.59; Sun, 23 Feb 2020 08:57:11 -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=rNxBBtQQ; 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 S1727027AbgBWQ43 (ORCPT + 99 others); Sun, 23 Feb 2020 11:56:29 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36884 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbgBWQ43 (ORCPT ); Sun, 23 Feb 2020 11:56:29 -0500 Received: by mail-pf1-f195.google.com with SMTP id p14so4033241pfn.4 for ; Sun, 23 Feb 2020 08:56:29 -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=rNxBBtQQ1h5eC9GnaO1XpnGSAjJa4rsyMbEEzEVTUc8l1CUM0ZZ3ngDfRF8PwBRzN2 Yji+hNUzryaURte9YdjZk86z6uPbnY1szJ5McZdvntrRy8r+P0Yv/JPWNq8V0SvaSvU6 vV6T1JAxzpg95RMTwg9bg3wyjvQLQpNNQdedXg6xEgpYy2zf9tvt2qUHhsDK0Vc9vkcu XtQiGCLdd6ucO56lFizA2Rlk9e+QkIK6hH1K3kGB6jemkc5I9nyn7vQjcLVS8ilTEjdo G+cuLea2aa1wuPomW/yi6JtUde3y2Bq8MDrA1rBqzpSk5V3MTQxx18F3ToUbeOz/V/Vs 0eoA== 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=DaoIjgPmoi7vRjdhZOHmh9CL8cRV9j0Z9d+F6bmi0bB3PpYGIFlf4g0Anm2j8Gb8WK FUMxsJoaP/5ZbPpp7ZS3bGXSsdr9W0mPQDukdOZTZH1SiFhWdYoosCMkpXzZ1kBhbKql N7612j0QEAv+sSx4N22ZgWIrxhEm6TRF/LJRAxO6s4kw9aFk6njPfrNU2FTCv3HyW3hR KccYa32nBVCo3OZgnS6O3V2Ody5++gTWJLVi/CKxyb6m2zWnTS2vBjhHeyMjyh6tYOlw FvAkg8YIfLSTE/ZzRqn8JVayBHzbrRZ+0fzztTb0W1Ho3zQVFRM+wR9fc1mwcYc0C/M1 aUmA== X-Gm-Message-State: APjAAAUSRVBL1YtHJjAXJ9MRrK/lwJyKrIpUPEvmE9cSVXUHSyI32B4J kpdO+It8+RWV1ehv/txG6AY= X-Received: by 2002:a63:d10c:: with SMTP id k12mr3913240pgg.392.1582476988971; Sun, 23 Feb 2020 08:56:28 -0800 (PST) Received: from localhost.localdomain ([103.87.57.33]) by smtp.googlemail.com with ESMTPSA id w8sm9482995pfn.186.2020.02.23.08.56.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2020 08:56:28 -0800 (PST) From: Amol Grover To: Allison Randal , Greg Kroah-Hartman , Andrew Morton , Lu Baolu , Thomas Gleixner , Qian Cai , Deepa Dinamani , Joerg Roedel Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH RESEND] iommu: dmar: Fix RCU list debugging warnings Date: Sun, 23 Feb 2020 22:25:39 +0530 Message-Id: <20200223165538.29870-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