public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Tianyu Lan <ltykernel@gmail.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Lan Tianyu <Tianyu.Lan@microsoft.com>,
	pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, hpa@zytor.com, x86@kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	michael.h.kelley@microsoft.com, kys@microsoft.com
Subject: Re: [PATCH] KVM/VMX: Check ept_pointer before flushing ept tlb
Date: Thu, 8 Nov 2018 14:12:51 +0800	[thread overview]
Message-ID: <d577eb84-a9bc-78c6-32e5-df59cb6d9dd5@gmail.com> (raw)
In-Reply-To: <8736sdupr2.fsf@vitty.brq.redhat.com>



On 11/7/2018 6:49 PM, Vitaly Kuznetsov wrote:
> Tianyu Lan <ltykernel@gmail.com> writes:
> 
>> Hi Vitaly:
>> 	Thanks for your review.
>>
>> On 11/6/2018 11:50 PM, Vitaly Kuznetsov wrote:
>>> ltykernel@gmail.com writes:
>>>
>>>> From: Lan Tianyu <Tianyu.Lan@microsoft.com>
>>>>
>>>> This patch is to initialize ept_pointer to INVALID_PAGE and check it
>>>> before flushing ept tlb. If ept_pointer is invalidated, bypass the flush
>>>> request.
>>>>
>>>
>>> To be honest I fail to understand the reason behind the patch: instead
>>> of doing one unneeded flush request with ept_pointer==0 (after vCPU is
>>> initialized) we now do the check every time. Could you please elaborate
>>> on why this is needed?
>>
>> The reason to introduce the check here is to avoid flushing ept tlb
>> without valid ept table. When nested guest boots up and only BP is
>> active, we should not do flush for APs and L1 hypervisor hasn't set
>> valid EPT table for APs.
> 
> Yes, I understand that but I'm trying to avoid additional checks on
> hotpath as during normal operation EPT pointer is always set.
>
> Could we just initialize ept_pointers_match to something like
> EPT_POINTERS_NOTSET and achive the same result?

vmx->ept_pointers_match presents match status of all vcpus' ept table. 
EPT_POINTER_NOSET should be per cpu status and so I select ept_pointer 
as check condition.

BTW, I think we may remove the check for match case which is normal 
status and all ept pointers should be set at that point. Mismatch status 
should be corner case when VM runs and this will not affect a lot.

      reply	other threads:[~2018-11-08  6:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 13:30 [PATCH] KVM/VMX: Check ept_pointer before flushing ept tlb ltykernel
2018-11-06 15:50 ` Vitaly Kuznetsov
2018-11-07  6:15   ` Tianyu Lan
2018-11-07 10:49     ` Vitaly Kuznetsov
2018-11-08  6:12       ` Tianyu Lan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d577eb84-a9bc-78c6-32e5-df59cb6d9dd5@gmail.com \
    --to=ltykernel@gmail.com \
    --cc=Tianyu.Lan@microsoft.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.h.kelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox