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

Re: [Xen-devel] hap_invlpg() vs INVLPGA

On 29/01/16 16:53, Jan Beulich wrote:
>>>> On 29.01.16 at 15:02, <chegger@xxxxxxxxx> wrote:
>> On 29/01/16 14:57, Egger, Christoph wrote:
>>> On 29/01/16 14:24, Jan Beulich wrote:
>>>> Christoph,
>>>> in commit dd6de3ab99 ("Implement Nested-on-Nested") you added
>>>> code to hap_invlpg() supposedly emulating INVLPGA. I've been
>>>> stumbling across this a number of times in the past, not being able
>>>> to make the connection between (a) VMX/EPT and INVLPGA and
>>>> (b) SVM's INVLPGA intercept and this function.
>>> When you boot Windows 7 as L1 guest and XP-Mode as L2 guest then
>>> L2 guest uses INVLPG instruction to invalidate a page and L1 guest
>>> handles this via using INVLPGA instruction.
>>> The INVLPG intercept flushes the nested hap p2m which is effectively
>>> a TLB flush to the L1 guest.
>> ... actually to the L2 guest. Sorry for the typo.
> So if the L1 guest does an INVLPGA, we should see an INVLPGA
> intercept, not an INVLPG one.

INVLPG intercept comes first from L2 then INVLPGA from L1.

>>> Then this intercept is injected into L1 guest.
> This, otoh, reads as if you imply we intercept the L2's INVLPG.
> Yet the INVLPG intercept gets cleared when the domain uses
> NPT (and your original change also didn't alter any intercept
> settings). Hence I'm still lost how hap_invlpg() can be reached
> in that case other than via emulating INVLPG in the instruction
> emulator.

svm_invlpg_intercept() and vmx_invlpg_intercept() call
paging_invlpg().  paging_invlpg() calls hap_invlpg()
as initialized in xen/arch/x86/mm/hap/hap.c

>>> The INVLPGA instruction enforces a new ASID.
>>> If the nested hap p2m is NULL then p2m_flush() should effectively
>>> be a noop but it may not crash the guest.
> s/may not/should not/ ?



Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.