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<pet...@redhat.com>
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