On 24/12/2019 13:26, Roger Pau Monne wrote:
> There's no need to call paging_update_cr3 unless CR3 trapping is
> enabled, and that's only the case when using shadow paging or when
> requested for introspection purposes, otherwise there's no need to
> pause all the vCPUs of the domain in order to perform the flush.
>
> Check whether CR3 trapping is currently in use in order to decide
> whether the vCPUs should be paused, otherwise just perform the flush.
>
> Signed-off-by: Roger Pau Monné <[email protected]>

I agree that the existing logic poor, but this direction looks to be
even more fragile.

Instead, I think it would be better to follow the EPT invalidation
example; mark all vcpus as needing a tlb flush, and IPI the domain dirty
mask, having the return-to-guest path do the flushing.

This avoids all vcpu pausing/unpausing activities, and the cost of the
flush is incurred by the target vcpu, rather than the vcpu making the
hypercall accumulate the cost for everything, as well as a large amount
of remote VMCS accesses.

It can probably also remove the need for the flush_vcpu() callback which
is going to be expensive due to retpoline, and whose contents are trivial.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to