lkml.org 
[lkml]   [2018]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectintel-iommu: Is this a bug?
Date
Hi,

I am analyzing network performance with intel-iommu enabled.
And found that running with iommu=pt, for every dma map/unmap it
executes this code:

/*
* At boot time, we don't yet know if devices will be 64-bit
capable.
* Assume that they will — if they turn out not to be, then we can
* take them out of the 1:1 domain later.
*/
if (!startup) {
/*
* If the device's dma_mask is less than the system's
memory
* size then this is not a candidate for identity mapping.
*/
u64 dma_mask = *dev->dma_mask;

if (dev->coherent_dma_mask &&
dev->coherent_dma_mask < dma_mask)
dma_mask = dev->coherent_dma_mask;

return dma_mask >= dma_get_required_mask(dev);
}


Do we really need this check for every dma/unmap?
Considering it should be only during startup, shouldn't it be,

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 582fd01..3c8f14e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2929,7 +2929,7 @@ static int iommu_should_identity_map(struct device
*dev, int startup)
* Assume that they will — if they turn out not to be, then we can
* take them out of the 1:1 domain later.
*/
- if (!startup) {
+ if (startup) {
/*
* If the device's dma_mask is less than the system's
memory
* size then this is not a candidate for identity mapping.

Thanks.

-Tushar

\
 
 \ /
  Last update: 2018-03-27 03:10    [W:0.687 / U:0.916 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site