|
From: | Jason Wang |
Subject: | Re: [Qemu-devel] [PATCH RFC v3 11/14] intel_iommu: provide its own replay() callback |
Date: | Fri, 13 Jan 2017 17:26:06 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 2017年01月13日 11:06, Peter Xu wrote:
The default replay() don't work for VT-d since vt-d will have a huge default memory region which covers address range 0-(2^64-1). This will normally bring a dead loop when guest starts.
I think it just takes too much time instead of dead loop?
The solution is simple - we don't walk over all the regions. Instead, we jump over the regions when we found that the page directories are empty. It'll greatly reduce the time to walk the whole region.
Yes, the problem is memory_region_is_iommu_reply() not smart because: - It doesn't understand large page - try go over all possible iova So I'm thinking to introduce something like iommu_ops->iova_iterate() which 1) accept an start iova and return the next exist map 2) understand large page 3) skip unmapped iova
To achieve this, we provided a page walk helper to do that, invoking corresponding hook function when we found an page we are interested in. vtd_page_walk_level() is the core logic for the page walking. It's interface is designed to suite further use case, e.g., to invalidate a range of addresses. Signed-off-by: Peter Xu<address@hidden>
For intel iommu, since we intercept all map and unmap, a more tricky ieda is to we can record the mappings internally in something like a rbtree which could be iterated during replay. This saves possible guest io page table traversal, but drawback is it may not survive from OOM attacker.
Thanks
[Prev in Thread] | Current Thread | [Next in Thread] |