Blob Blame History Raw
From: Lukasz Odzioba <lukasz.odzioba@intel.com>
Date: Mon, 20 May 2019 15:41:28 +0200
Subject: iommu/vt-d: Remove unnecessary rcu_read_locks
Git-commit: f780a8dc196db1c41b5da21ecfa27e83ee5fb776
Patch-mainline: v5.3-rc1
References: bsc#1140964

We use RCU's for rarely updated lists like iommus, rmrr, atsr units.

I'm not sure why domain_remove_dev_info() in domain_exit() was surrounded
by rcu_read_lock. Lock was present before refactoring in d160aca527,
but it was related to rcu list, not domain_remove_dev_info function.

dmar_remove_one_dev_info() doesn't touch any of those lists, so it doesn't
require a lock. In fact it is called 6 times without it anyway.

Fixes: d160aca5276d ("iommu/vt-d: Unify domain->iommu attach/detachment")

Signed-off-by: Lukasz Odzioba <lukasz.odzioba@intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/intel-iommu.c | 4 ----
 1 file changed, 4 deletions(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2013,9 +2013,7 @@ static void domain_exit(struct dmar_doma
 	}
 
 	/* Remove associated devices and clear attached or cached domains */
-	rcu_read_lock();
 	domain_remove_dev_info(domain);
-	rcu_read_unlock();
 
 	/* destroy iovas */
 	put_iova_domain(&domain->iovad);
@@ -5121,9 +5119,7 @@ static int intel_iommu_attach_device(str
 
 		old_domain = find_domain(dev);
 		if (old_domain) {
-			rcu_read_lock();
 			dmar_remove_one_dev_info(old_domain, dev);
-			rcu_read_unlock();
 
 			if (!domain_type_is_vm_or_si(old_domain) &&
 			     list_empty(&old_domain->devices))