From: Robin Murphy <robin.murphy@arm.com>
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 [thread overview]
Message-ID: <57cba0cf89556d586e554a9c64cbd28205d67c5c.1674753627.git.robin.murphy@arm.com> (raw)
In-Reply-To: <cover.1674753627.git.robin.murphy@arm.com>
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 <robin.murphy@arm.com>
---
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 <linux/iommu.h>
#include <linux/idr.h>
#include <linux/err.h>
+#include <linux/lockdep.h>
#include <linux/pci.h>
#include <linux/pci-ats.h>
#include <linux/bitops.h>
@@ -1100,6 +1101,7 @@ static int iommu_group_device_count(struct iommu_group *group)
struct group_device *entry;
int ret = 0;
+ lockdep_assert_held(&group->mutex);
list_for_each_entry(entry, &group->devices, list)
ret++;
@@ -1112,6 +1114,7 @@ static int __iommu_group_for_each_dev(struct iommu_group *group, void *data,
struct group_device *device;
int ret = 0;
+ lockdep_assert_held(&group->mutex);
list_for_each_entry(device, &group->devices, list) {
ret = fn(device->dev, data);
if (ret)
--
2.36.1.dirty
next prev parent reply other threads:[~2023-01-26 18:26 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 18:26 [PATCH v2 0/8] iommu: The early demise of bus ops Robin Murphy
2023-01-26 18:26 ` [PATCH v2 1/8] iommu: Decouple iommu_present() from " Robin Murphy
2023-01-28 7:55 ` Baolu Lu
2023-01-30 17:31 ` Jason Gunthorpe
2023-01-30 18:21 ` Robin Murphy
2023-01-26 18:26 ` [PATCH v2 2/8] iommu: Validate that devices match domains Robin Murphy
2023-01-28 8:04 ` Baolu Lu
2023-01-30 15:59 ` Jason Gunthorpe
2023-01-26 18:26 ` Robin Murphy [this message]
2023-01-28 8:08 ` [PATCH v2 3/8] iommu: Add lockdep annotations for group list iterators Baolu Lu
2023-01-28 12:20 ` Baolu Lu
2023-01-30 14:59 ` Robin Murphy
2023-01-26 18:26 ` [PATCH v2 4/8] iommu: Factor out some helpers Robin Murphy
2023-01-28 8:12 ` Baolu Lu
2023-01-30 16:38 ` Jason Gunthorpe
2023-01-30 18:05 ` Robin Murphy
2023-01-30 18:20 ` Jason Gunthorpe
2023-01-30 23:33 ` Robin Murphy
2023-01-31 19:54 ` Jason Gunthorpe
2023-01-26 18:26 ` [PATCH v2 5/8] iommu: Switch __iommu_domain_alloc() to device ops Robin Murphy
2023-01-26 23:22 ` Jacob Pan
2023-01-27 11:42 ` Robin Murphy
2023-01-27 16:32 ` Jacob Pan
2023-01-28 8:21 ` Baolu Lu
2023-01-30 17:51 ` Jason Gunthorpe
2023-01-26 18:26 ` [PATCH v2 6/8] iommu/arm-smmu: Don't register fwnode for legacy binding Robin Murphy
2023-01-30 17:14 ` Jason Gunthorpe
2023-01-26 18:26 ` [PATCH v2 7/8] iommu: Retire bus ops Robin Murphy
2023-01-28 12:10 ` Baolu Lu
2023-01-28 12:55 ` kernel test robot
2023-01-30 14:20 ` Jason Gunthorpe
2023-01-30 17:09 ` Jason Gunthorpe
2023-01-26 18:26 ` [PATCH v2 8/8] iommu: Clean up open-coded ownership checks Robin Murphy
2023-01-30 17:10 ` Jason Gunthorpe
2023-01-30 6:45 ` [PATCH v2 0/8] iommu: The early demise of bus ops Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57cba0cf89556d586e554a9c64cbd28205d67c5c.1674753627.git.robin.murphy@arm.com \
--to=robin.murphy@arm.com \
--cc=baolu.lu@linux.intel.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®