From: Mike Travis <travis@sgi.com>
To: David Woodhouse <dwmw2@infradead.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Mike Habeck <habeck@sgi.com>,
iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] Intel iommu: Speed up processing of the identity_mapping function
Date: Tue, 29 Mar 2011 18:36:04 -0500 [thread overview]
Message-ID: <20110329233602.585251738@gulag1.americas.sgi.com> (raw)
In-Reply-To: <20110329233602.272459647@gulag1.americas.sgi.com>
[-- Attachment #1: speed-up-iommu_no_mapping --]
[-- Type: text/plain, Size: 1989 bytes --]
On Nahelem systems, there are 43 Host Bridges exposed to the kernel
for each System Socket. With a large socket count, and the pass
through option for iommu is set, too much time is spent in the
identity_mapping function, hunting though the iommu domains to
check if a specific device is "identity mapped".
Speed up the function by setting an "is_identity_mapped" flag in
the pci_dev struct, if this device is mapped to the static identity
domain.
Signed-off-by: Mike Travis <travis@sgi.com>
---
drivers/pci/intel-iommu.c | 11 +++++------
include/linux/pci.h | 1 +
2 files changed, 6 insertions(+), 6 deletions(-)
--- linux.orig/drivers/pci/intel-iommu.c
+++ linux/drivers/pci/intel-iommu.c
@@ -2102,11 +2102,7 @@ static int identity_mapping(struct pci_d
if (likely(!iommu_identity_mapping))
return 0;
-
- list_for_each_entry(info, &si_domain->devices, link)
- if (info->dev == pdev)
- return 1;
- return 0;
+ return pdev->is_identity_mapped;
}
static int domain_add_dev_info(struct dmar_domain *domain,
@@ -2138,6 +2134,7 @@ static int domain_add_dev_info(struct dm
list_add(&info->global, &device_domain_list);
pdev->dev.archdata.iommu = info;
spin_unlock_irqrestore(&device_domain_lock, flags);
+ pdev->is_identity_mapped = (domain == si_domain);
return 0;
}
@@ -3404,8 +3401,10 @@ static void domain_remove_one_dev_info(s
* update iommu count and coherency
*/
if (iommu == device_to_iommu(info->segment, info->bus,
- info->devfn))
+ info->devfn)) {
found = 1;
+ pdev->is_identity_mapped = 0;
+ }
}
if (found == 0) {
--- linux.orig/include/linux/pci.h
+++ linux/include/linux/pci.h
@@ -314,6 +314,7 @@ struct pci_dev {
unsigned int is_virtfn:1;
unsigned int reset_fn:1;
unsigned int is_hotplug_bridge:1;
+ unsigned int is_identity_mapped:1;
unsigned int __aer_firmware_first_valid:1;
unsigned int __aer_firmware_first:1;
pci_dev_flags_t dev_flags;
--
next prev parent reply other threads:[~2011-03-29 23:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-29 23:36 [PATCH 0/4] pci: Speed up processing of IOMMU related functions Mike Travis
2011-03-29 23:36 ` [PATCH 1/4] Intel pci: Remove Host Bridge devices from identity mapping Mike Travis
2011-03-30 17:51 ` Chris Wright
2011-03-30 18:30 ` Mike Travis
2011-03-30 19:15 ` Chris Wright
2011-03-30 19:25 ` Mike Travis
2011-03-30 19:57 ` Chris Wright
2011-03-29 23:36 ` Mike Travis [this message]
2011-03-30 19:19 ` [PATCH 2/4] Intel iommu: Speed up processing of the identity_mapping function Chris Wright
2011-03-30 19:29 ` Mike Travis
2011-03-31 0:33 ` [PATCH 2/4] Intel iommu: Speed up processing of the identity_mapping function v2 Mike Travis
2011-03-29 23:36 ` [PATCH 3/4] Intel pci: Limit dmar_init_reserved_ranges Mike Travis
2011-03-31 22:11 ` Mike Travis
2011-03-31 22:53 ` Chris Wright
2011-03-31 23:25 ` Mike Travis
2011-03-31 23:40 ` Mike Habeck
2011-03-31 23:56 ` Chris Wright
2011-04-01 1:05 ` Mike Habeck
2011-04-02 0:32 ` [PATCH 3/4 v2] intel-iommu: don't cache iova above 32bit caching boundary Chris Wright
2011-04-06 0:39 ` [PATCH 3/4 v3] " Chris Wright
2011-03-31 23:39 ` [PATCH 3/4] Intel pci: Limit dmar_init_reserved_ranges Chris Wright
2011-03-29 23:36 ` [PATCH 4/4] Intel pci: Use coherent DMA mask when requested Mike Travis
2011-03-30 18:02 ` Chris Wright
2011-04-01 2:57 ` FUJITA Tomonori
2011-04-07 19:47 ` [PATCH 1/4] Intel pci: Remove Host Bridge devices from identity mapping Mike Travis
2011-04-07 19:51 ` [PATCH 2/4] Intel iommu: Speed up processing of the identity_mapping function Mike Travis
2011-04-07 19:52 ` [PATCH 4/4] Intel pci: Use coherent DMA mask when requested Mike Travis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110329233602.585251738@gulag1.americas.sgi.com \
--to=travis@sgi.com \
--cc=dwmw2@infradead.org \
--cc=habeck@sgi.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®