[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v3 12/14] intel_iommu: do replay when contex

From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH RFC v3 12/14] intel_iommu: do replay when context invalidate
Date: Mon, 16 Jan 2017 16:28:10 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 2017年01月16日 16:18, Peter Xu wrote:
On Mon, Jan 16, 2017 at 03:52:10PM +0800, Jason Wang wrote:

On 2017年01月16日 15:43, Peter Xu wrote:
On Mon, Jan 16, 2017 at 01:53:54PM +0800, Jason Wang wrote:
On 2017年01月13日 11:06, Peter Xu wrote:
Before this one we only invalidate context cache when we receive context
entry invalidations. However it's possible that the invalidation also
contains a domain switch (only if cache-mode is enabled for vIOMMU).
So let's check for CM before replaying?
When CM is not set, there should have no device needs
IOMMU_NOTIFIER_MAP notifies. So IMHO it won't hurt if we replay here
(so the notifier_list will only contain UNMAP notifiers at most, and
sending UNMAP to those devices should not affect them at all).

If we check CM before replay, it'll be faster when guest change iommu
domain for a specific device. But after all this kind of operation is
extremely rare, while if we check CM bit, we have a "assumption" in
the code that MAP is depending on CM. In that case, to make the codes
cleaner, I'd slightly prefer not check it here. How do you think?
Ok, I think maybe it's better to add a comment here.
How about this?

+                /*
+                 * So a device is moving out of (or moving into) a
+                 * domain, a replay() suites here to notify all the
+                 * IOMMU_NOTIFIER_MAP registers about this change.
+                 * This won't bring bad even if we have no such
+                 * notifier registered - the IOMMU notification
+                 * framework will skip MAP notifications if that
+                 * happened.
+                 */


-- peterx

I'm fine with this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]