Messages in this thread Patch in this message | | | From | Robin Murphy <> | Subject | [PATCH v2 3/8] iommu: Add lockdep annotations for group list iterators | Date | Thu, 26 Jan 2023 18:26:18 +0000 |
| |
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
| |