From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: simplify vmx_prepare_switch_to_{guest,host}
Date: Fri, 7 Jun 2019 10:47:53 -0700 [thread overview]
Message-ID: <20190607174753.GH9083@linux.intel.com> (raw)
In-Reply-To: <20190607173710.GG9083@linux.intel.com>
On Fri, Jun 07, 2019 at 10:37:10AM -0700, Sean Christopherson wrote:
> On Fri, Jun 07, 2019 at 07:08:21PM +0200, Paolo Bonzini wrote:
> > vmx->loaded_cpu_state can only be NULL or equal to vmx->loaded_vmcs,
> > so change it to a bool. Because the direction of the bool is
> > now the opposite of vmx->guest_msrs_dirty, change the direction of
> > vmx->guest_msrs_dirty so that they match.
> >
> > Finally, do not imply that MSRs have to be reloaded when
> > vmx->guest_sregs_loaded is false; instead, set vmx->guest_msrs_loaded
> > to false explicitly in vmx_prepare_switch_to_host.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> ...
>
> > @@ -1165,13 +1163,15 @@ static void vmx_prepare_switch_to_host(struct vcpu_vmx *vmx)
> > wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
> > #endif
> > load_fixmap_gdt(raw_smp_processor_id());
> > + vmx->guest_sregs_loaded = false;
> > + vmx->guest_msrs_loaded = false;
> > }
> >
> > #ifdef CONFIG_X86_64
> > static u64 vmx_read_guest_kernel_gs_base(struct vcpu_vmx *vmx)
> > {
> > preempt_disable();
> > - if (vmx->loaded_cpu_state)
> > + if (vmx->guest_sregs_loaded)
> > rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
>
> This is the hiccup with naming it sregs_loaded. The split bools is also
> kinda wonky since the 32->64 case is a one-off scenario. I think a
> cleaner solution would be to remove guest_msrs_dirty and refresh the MSRs
> directly from setup_msrs(). Then loaded_cpu_state -> loaded_guest_state
> can be a straight conversion from loaded_vmcs -> bool. I'll send patches.
Actually, would it be easier on your end if I do a v2 of the series that
would introduce vmx_sync_vmcs_host_state(), and splice these patch into it?
next prev parent reply other threads:[~2019-06-07 17:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-07 17:08 [PATCH] KVM: VMX: simplify vmx_prepare_switch_to_{guest,host} Paolo Bonzini
2019-06-07 17:37 ` Sean Christopherson
2019-06-07 17:47 ` Sean Christopherson [this message]
2019-06-07 18:13 ` Paolo Bonzini
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=20190607174753.GH9083@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.