From nobody Sun Sep 14 06:38:06 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D571C05027 for ; Thu, 26 Jan 2023 18:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbjAZS0k (ORCPT ); Thu, 26 Jan 2023 13:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjAZS0e (ORCPT ); Thu, 26 Jan 2023 13:26:34 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA0A0677A7 for ; Thu, 26 Jan 2023 10:26:33 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 216944B3; Thu, 26 Jan 2023 10:27:15 -0800 (PST) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2FF463F71E; Thu, 26 Jan 2023 10:26:32 -0800 (PST) From: Robin Murphy To: joro@8bytes.org, will@kernel.org Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, hch@lst.de, jgg@nvidia.com, baolu.lu@linux.intel.com Subject: [PATCH v2 3/8] iommu: Add lockdep annotations for group list iterators Date: Thu, 26 Jan 2023 18:26:18 +0000 Message-Id: <57cba0cf89556d586e554a9c64cbd28205d67c5c.1674753627.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.36.1.dirty In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Before we add any more common helpers for iterating or otherwise accessing the group device list, let's start the good habit of annotating their locking expectations for robustness. Signed-off-by: Robin Murphy Reviewed-by: Lu Baolu --- v2: New. Note that I've left the group_pasid helpers, since they're pretty much right next to where the relevant locking happens, and highly unlikely to be reused from anywhere else anyway. drivers/iommu/iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d48e5499e0fa..77f076030995 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1100,6 +1101,7 @@ static int iommu_group_device_count(struct iommu_grou= p *group) struct group_device *entry; int ret =3D 0; =20 + lockdep_assert_held(&group->mutex); list_for_each_entry(entry, &group->devices, list) ret++; =20 @@ -1112,6 +1114,7 @@ static int __iommu_group_for_each_dev(struct iommu_gr= oup *group, void *data, struct group_device *device; int ret =3D 0; =20 + lockdep_assert_held(&group->mutex); list_for_each_entry(device, &group->devices, list) { ret =3D fn(device->dev, data); if (ret) --=20 2.36.1.dirty