mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>,
	Jim Mattson <jmattson@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kvm list <kvm@vger.kernel.org>,
	Sean Christopherson <sean.j.christopherson@intel.com>
Subject: Re: [PATCH] KVM: nVMX: cleanup and fix host 64-bit mode checks
Date: Thu, 26 Sep 2019 10:42:38 +0200	[thread overview]
Message-ID: <1543003a-9a2f-2a52-444a-d55bde6b8e2f@redhat.com> (raw)
In-Reply-To: <3460bd57-6fdd-f73c-9ce0-c97d4cc85f63@oracle.com>

On 26/09/19 01:55, Krish Sadhukhan wrote:
> 
> 
> On 09/25/2019 09:47 AM, Jim Mattson wrote:
>> On Wed, Sep 25, 2019 at 9:34 AM Paolo Bonzini <pbonzini@redhat.com>
>> wrote:
>>> KVM was incorrectly checking vmcs12->host_ia32_efer even if the "load
>>> IA32_EFER" exit control was reset.  Also, some checks were not using
>>> the new CC macro for tracing.
>>>
>>> Cleanup everything so that the vCPU's 64-bit mode is determined
>>> directly from EFER_LMA and the VMCS checks are based on that, which
>>> matches section 26.2.4 of the SDM.
>>>
>>> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
>>> Cc: Jim Mattson <jmattson@google.com>
>>> Cc: Krish Sadhukhan <krish.sadhukhan@oracle.com>
>>> Fixes: 5845038c111db27902bc220a4f70070fe945871c
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   arch/x86/kvm/vmx/nested.c | 53
>>> ++++++++++++++++++++---------------------------
>>>   1 file changed, 22 insertions(+), 31 deletions(-)
>>>
>>> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
>>> index 70d59d9304f2..e108847f6cf8 100644
>>> --- a/arch/x86/kvm/vmx/nested.c
>>> +++ b/arch/x86/kvm/vmx/nested.c
>>> @@ -2664,8 +2664,26 @@ static int nested_vmx_check_host_state(struct
>>> kvm_vcpu *vcpu,
>>>              CC(!kvm_pat_valid(vmcs12->host_ia32_pat)))
>>>                  return -EINVAL;
>>>
>>> -       ia32e = (vmcs12->vm_exit_controls &
>>> -                VM_EXIT_HOST_ADDR_SPACE_SIZE) != 0;
>>> +#ifdef CONFIG_X86_64
>>> +       ia32e = !!(vcpu->arch.efer & EFER_LMA);
>>> +#else
>>> +       if (CC(vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE))
>>> +               return -EINVAL;
>> This check is redundant, since it is checked in the else block below.
> 
> Should we be re-using is_long_mode() instead of duplicating the code ?

Of course!  I have already pushed the patch, but I will send a follow up.

Paolo


  reply	other threads:[~2019-09-26  8:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 16:34 Paolo Bonzini
2019-09-25 16:47 ` Jim Mattson
2019-09-25 23:55   ` Krish Sadhukhan
2019-09-26  8:42     ` Paolo Bonzini [this message]
2019-09-26 11:31 ` Liran Alon

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=1543003a-9a2f-2a52-444a-d55bde6b8e2f@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sean.j.christopherson@intel.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

all inboxes | Powered by JetHome®