linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/vt-d: Remove unnecessary rcu_read_locks
@ 2019-05-20 13:41 Lukasz Odzioba
  2019-05-27 14:05 ` Joerg Roedel
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Odzioba @ 2019-05-20 13:41 UTC (permalink / raw)
  To: linux-kernel, iommu; +Cc: dwmw2, joro, lukasz.odzioba, grzegorz.andrejczuk

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>
---
 drivers/iommu/intel-iommu.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a209199..1b7ad80 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1911,9 +1911,7 @@ static void domain_exit(struct dmar_domain *domain)
 	struct page *freelist;
 
 	/* 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);
@@ -5254,9 +5252,7 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
 
 		old_domain = find_domain(dev);
 		if (old_domain) {
-			rcu_read_lock();
 			dmar_remove_one_dev_info(dev);
-			rcu_read_unlock();
 
 			if (!domain_type_is_vm_or_si(old_domain) &&
 			    list_empty(&old_domain->devices))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] iommu/vt-d: Remove unnecessary rcu_read_locks
  2019-05-20 13:41 [PATCH 1/1] iommu/vt-d: Remove unnecessary rcu_read_locks Lukasz Odzioba
@ 2019-05-27 14:05 ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2019-05-27 14:05 UTC (permalink / raw)
  To: Lukasz Odzioba; +Cc: linux-kernel, iommu, dwmw2, grzegorz.andrejczuk

On Mon, May 20, 2019 at 03:41:28PM +0200, Lukasz Odzioba wrote:
> 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>

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-27 14:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 13:41 [PATCH 1/1] iommu/vt-d: Remove unnecessary rcu_read_locks Lukasz Odzioba
2019-05-27 14:05 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).