All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Fix OSXSAVE after migration
@ 2010-12-08  2:49 Sheng Yang
  2010-12-08 10:33 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Sheng Yang @ 2010-12-08  2:49 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm, Sheng Yang, stable

CPUID's OSXSAVE is a mirror of CR4.OSXSAVE bit. We need to update the CPUID
after migration.

Cc: stable@kernel.org
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
---
 arch/x86/kvm/x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index ed373ba..51a2bce 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5585,6 +5585,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
 
 	mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4;
 	kvm_x86_ops->set_cr4(vcpu, sregs->cr4);
+	if (sregs->cr4 & X86_CR4_OSXSAVE)
+		update_cpuid(vcpu);
 	if (!is_long_mode(vcpu) && is_pae(vcpu)) {
 		load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3);
 		mmu_reset_needed = 1;
-- 
1.7.0.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: Fix OSXSAVE after migration
  2010-12-08  2:49 [PATCH] KVM: Fix OSXSAVE after migration Sheng Yang
@ 2010-12-08 10:33 ` Avi Kivity
  2010-12-09  1:17   ` Sheng Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2010-12-08 10:33 UTC (permalink / raw)
  To: Sheng Yang; +Cc: Marcelo Tosatti, kvm, stable

On 12/08/2010 04:49 AM, Sheng Yang wrote:
> CPUID's OSXSAVE is a mirror of CR4.OSXSAVE bit. We need to update the CPUID
> after migration.
>

Applied, thanks.

> @@ -5585,6 +5585,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>
>   	mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4;
>   	kvm_x86_ops->set_cr4(vcpu, sregs->cr4);
> +	if (sregs->cr4&  X86_CR4_OSXSAVE)
> +		update_cpuid(vcpu);
>   	if (!is_long_mode(vcpu)&&  is_pae(vcpu)) {
>   		load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3);
>   		mmu_reset_needed = 1;


We really should use kvm_set_crX() here.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: Fix OSXSAVE after migration
  2010-12-08 10:33 ` Avi Kivity
@ 2010-12-09  1:17   ` Sheng Yang
  2010-12-09 10:04     ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Sheng Yang @ 2010-12-09  1:17 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm, stable

On Wednesday 08 December 2010 18:33:43 Avi Kivity wrote:
> On 12/08/2010 04:49 AM, Sheng Yang wrote:
> > CPUID's OSXSAVE is a mirror of CR4.OSXSAVE bit. We need to update the
> > CPUID after migration.
> 
> Applied, thanks.
> 
> > @@ -5585,6 +5585,8 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu
> > *vcpu,
> > 
> >   	mmu_reset_needed |= kvm_read_cr4(vcpu) != sregs->cr4;
> >   	kvm_x86_ops->set_cr4(vcpu, sregs->cr4);
> > 
> > +	if (sregs->cr4&  X86_CR4_OSXSAVE)
> > +		update_cpuid(vcpu);
> > 
> >   	if (!is_long_mode(vcpu)&&  is_pae(vcpu)) {
> >   	
> >   		load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3);
> >   		mmu_reset_needed = 1;
> 
> We really should use kvm_set_crX() here.

Yeah, I suppose we use ops->set_cr4() here because we don't need to all kinds of 
check and operation for the value(which should already be done by other S/R code), 
so I just add update_cpuid() here.

--
regards
Yang, Sheng

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: Fix OSXSAVE after migration
  2010-12-09  1:17   ` Sheng Yang
@ 2010-12-09 10:04     ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-12-09 10:04 UTC (permalink / raw)
  To: Sheng Yang; +Cc: Marcelo Tosatti, kvm, stable

On 12/09/2010 03:17 AM, Sheng Yang wrote:
> >  >    	if (!is_long_mode(vcpu)&&   is_pae(vcpu)) {
> >  >    	
> >  >    		load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3);
> >  >    		mmu_reset_needed = 1;
> >
> >  We really should use kvm_set_crX() here.
>
> Yeah, I suppose we use ops->set_cr4() here because we don't need to all kinds of
> check and operation for the value(which should already be done by other S/R code),
> so I just add update_cpuid() here.
>

IIRC the reason is that there are ordering constraints for kvm_set_crX 
(and kvm_set_efer).  We should do a kvm_set_crs() which sets them all at 
once.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-09 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08  2:49 [PATCH] KVM: Fix OSXSAVE after migration Sheng Yang
2010-12-08 10:33 ` Avi Kivity
2010-12-09  1:17   ` Sheng Yang
2010-12-09 10:04     ` Avi Kivity

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.