kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jim Mattson <jmattson@google.com>
To: Nikita Leshenko <nikita.leshchenko@oracle.com>
Cc: kvm list <kvm@vger.kernel.org>,
	Liran Alon <liran.alon@oracle.com>,
	Krish Sadhukhan <krish.sadhukhan@oracle.com>
Subject: Re: [PATCH 1/2] KVM: nVMX: Always indicate HLT activity support in VMX_MISC MSR
Date: Thu, 22 Aug 2019 10:58:47 -0700	[thread overview]
Message-ID: <CALMp9eRkhDcK+uJwQ1NPnwBaEUyPcxDPBME3yDid6EvR=sUgRw@mail.gmail.com> (raw)
In-Reply-To: <20190819214650.41991-2-nikita.leshchenko@oracle.com>

On Mon, Aug 19, 2019 at 2:47 PM Nikita Leshenko
<nikita.leshchenko@oracle.com> wrote:
>
> Before this commit, userspace could disable the GUEST_ACTIVITY_HLT bit in
> VMX_MISC yet KVM would happily accept GUEST_ACTIVITY_HLT activity state in
> VMCS12. We can fix it by either failing VM entries with HLT activity state when
> it's not supported or by disallowing clearing this bit.
>
> The latter is preferable. If we go with the former, to disable
> GUEST_ACTIVITY_HLT userspace also has to make CPU_BASED_HLT_EXITING a "must be
> 1" control, otherwise KVM will be presenting a bogus model to L1.
>
> Don't fail writes that disable GUEST_ACTIVITY_HLT to maintain backwards
> compatibility.
>
> Reviewed-by: Liran Alon <liran.alon@oracle.com>
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Signed-off-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 46af3a5e9209..24734946ec75 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1102,6 +1102,14 @@ static int vmx_restore_vmx_misc(struct vcpu_vmx *vmx, u64 data)
>         if (vmx_misc_mseg_revid(data) != vmx_misc_mseg_revid(vmx_misc))
>                 return -EINVAL;
>
> +       /*
> +        * We always support HLT activity state. In the past it was possible to
> +        * turn HLT bit off (without actually turning off HLT activity state
> +        * support) so we don't fail vmx_restore_vmx_misc if this bit is turned
> +        * off.
> +        */
> +       data |= VMX_MISC_ACTIVITY_HLT;
> +
>         vmx->nested.msrs.misc_low = data;
>         vmx->nested.msrs.misc_high = data >> 32;
>

This change breaks live migration to an upgraded kernel, since it
doesn't allow the IA32_VMX_MISC MSR to be restored to its original
value. I think this warrants a quirk.

  parent reply	other threads:[~2019-08-22 17:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 21:46 [PATCH 0/2] KVM: nVMX: Improve HLT activity support Nikita Leshenko
2019-08-19 21:46 ` [PATCH 1/2] KVM: nVMX: Always indicate HLT activity support in VMX_MISC MSR Nikita Leshenko
2019-08-19 22:11   ` Sean Christopherson
2019-08-21 20:59     ` Jim Mattson
2019-08-21 22:22       ` Sean Christopherson
2019-08-21 23:01         ` Jim Mattson
2019-08-21 23:20           ` Sean Christopherson
2019-08-26 11:30       ` Nikita Leshenko
2019-08-22 17:58   ` Jim Mattson [this message]
2019-08-19 21:46 ` [PATCH 2/2] KVM: nVMX: Check guest activity state on vmentry of nested guests Nikita Leshenko
2019-08-19 22:44   ` Liran Alon
2019-08-19 23:35   ` Sean Christopherson

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='CALMp9eRkhDcK+uJwQ1NPnwBaEUyPcxDPBME3yDid6EvR=sUgRw@mail.gmail.com' \
    --to=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=nikita.leshchenko@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).