lkml.org 
[lkml]   [2023]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/8] iommu: Add lockdep annotations for group list iterators
Date
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
\
 
 \ /
  Last update: 2023-03-26 23:57    [W:0.405 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site