diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-12-12 09:57:30 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:12:00 -0500 |
commit | 5774f7c5fef2526bfa58eab628fbe91dce5e07b1 (patch) | |
tree | 38d0ab41a4b188572de1773574f1d506bb016234 /arch | |
parent | 18811f55d48e5f3ee70c4744c592f940022fa592 (diff) |
AMD IOMMU: add statistics about allocated io memory
Impact: see amount of allocated io memory in debugfs
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index a897c7246dca..69f367b033a2 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -74,6 +74,7 @@ DECLARE_STATS_COUNTER(cnt_free_coherent); | |||
74 | DECLARE_STATS_COUNTER(cross_page); | 74 | DECLARE_STATS_COUNTER(cross_page); |
75 | DECLARE_STATS_COUNTER(domain_flush_single); | 75 | DECLARE_STATS_COUNTER(domain_flush_single); |
76 | DECLARE_STATS_COUNTER(domain_flush_all); | 76 | DECLARE_STATS_COUNTER(domain_flush_all); |
77 | DECLARE_STATS_COUNTER(alloced_io_mem); | ||
77 | 78 | ||
78 | static struct dentry *stats_dir; | 79 | static struct dentry *stats_dir; |
79 | static struct dentry *de_isolate; | 80 | static struct dentry *de_isolate; |
@@ -110,6 +111,7 @@ static void amd_iommu_stats_init(void) | |||
110 | amd_iommu_stats_add(&cross_page); | 111 | amd_iommu_stats_add(&cross_page); |
111 | amd_iommu_stats_add(&domain_flush_single); | 112 | amd_iommu_stats_add(&domain_flush_single); |
112 | amd_iommu_stats_add(&domain_flush_all); | 113 | amd_iommu_stats_add(&domain_flush_all); |
114 | amd_iommu_stats_add(&alloced_io_mem); | ||
113 | } | 115 | } |
114 | 116 | ||
115 | #endif | 117 | #endif |
@@ -1246,6 +1248,8 @@ static dma_addr_t __map_single(struct device *dev, | |||
1246 | } | 1248 | } |
1247 | address += offset; | 1249 | address += offset; |
1248 | 1250 | ||
1251 | ADD_STATS_COUNTER(alloced_io_mem, size); | ||
1252 | |||
1249 | if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) { | 1253 | if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) { |
1250 | iommu_flush_tlb(iommu, dma_dom->domain.id); | 1254 | iommu_flush_tlb(iommu, dma_dom->domain.id); |
1251 | dma_dom->need_flush = false; | 1255 | dma_dom->need_flush = false; |
@@ -1282,6 +1286,8 @@ static void __unmap_single(struct amd_iommu *iommu, | |||
1282 | start += PAGE_SIZE; | 1286 | start += PAGE_SIZE; |
1283 | } | 1287 | } |
1284 | 1288 | ||
1289 | SUB_STATS_COUNTER(alloced_io_mem, size); | ||
1290 | |||
1285 | dma_ops_free_addresses(dma_dom, dma_addr, pages); | 1291 | dma_ops_free_addresses(dma_dom, dma_addr, pages); |
1286 | 1292 | ||
1287 | if (amd_iommu_unmap_flush || dma_dom->need_flush) { | 1293 | if (amd_iommu_unmap_flush || dma_dom->need_flush) { |