Re: [PATCH] kvm: x86: Don't modify MSR_PLATFORM_INFO on vCPU reset

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

 



On Mon, Dec 10, 2018 at 10:09 PM Wanpeng Li <kernellwp@xxxxxxxxx> wrote:
>
> On Wed, 31 Oct 2018 at 03:25, Jim Mattson <jmattson@xxxxxxxxxx> wrote:
> >
> > If userspace has provided a different value for this MSR (e.g with the
> > turbo bits set), the userspace-provided value should survive a vCPU
> > reset. For backwards compatibility, MSR_PLATFORM_INFO is initialized
> > in kvm_arch_vcpu_setup.
> >
> > Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
> > Reviewed-by: Drew Schmitt <dasch@xxxxxxxxxx>
> > Cc: Abhiroop Dabral <adabral@xxxxxxxxxxxxxxxxxxxx>
> > ---
> >  arch/x86/kvm/x86.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 66d66d77caee..6ab3149bf9dc 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -8617,6 +8617,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
> >
> >  int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
> >  {
> > +       vcpu->arch.msr_platform_info = MSR_PLATFORM_INFO_CPUID_FAULT;
> >         kvm_vcpu_mtrr_init(vcpu);
> >         vcpu_load(vcpu);
> >         kvm_vcpu_reset(vcpu, false);
> > @@ -8719,7 +8720,6 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
> >                 kvm_pmu_reset(vcpu);
> >                 vcpu->arch.smbase = 0x30000;
> >
> > -               vcpu->arch.msr_platform_info = MSR_PLATFORM_INFO_CPUID_FAULT;
>
> I think you miss the init_event check?

No; I saw it. If userspace has provided a different value for this MSR
(e.g. if it has filled in the scalable bus frequency in bits 15:8),
that value should survive a full CPU reset as well as an INIT.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux