Re: [CFT PATCH 2/2] KVM: x86: support XSAVES usage in the host

2014-11-24 Thread Paolo Bonzini
On 24/11/2014 03:10, Wanpeng Li wrote: > Hi Paolo, > On Fri, Nov 21, 2014 at 07:31:18PM +0100, Paolo Bonzini wrote: > [...] >> +u64 feature = valid & -valid; >> +int index = fls64(feature) - 1; >> +void *src = get_xsave_addr(xsave, feature); >> + >> +

Re: [CFT PATCH 2/2] KVM: x86: support XSAVES usage in the host

2014-11-23 Thread Wanpeng Li
Hi Paolo, On Fri, Nov 21, 2014 at 07:31:18PM +0100, Paolo Bonzini wrote: [...] >+ u64 feature = valid & -valid; >+ int index = fls64(feature) - 1; >+ void *src = get_xsave_addr(xsave, feature); >+ >+ if (src) { >+ u32 size, of

Re: [CFT PATCH 2/2] KVM: x86: support XSAVES usage in the host

2014-11-21 Thread Paolo Bonzini
On 21/11/2014 21:06, Andy Lutomirski wrote: >> > + cpuid_count(XSTATE_CPUID, index, >> > + &size, &offset, &ecx, &edx); >> > + memcpy(dest + offset, src, size); > Is this really the best way to do this? cpuid is serializing, so this

Re: [CFT PATCH 2/2] KVM: x86: support XSAVES usage in the host

2014-11-21 Thread Andy Lutomirski
On 11/21/2014 10:31 AM, Paolo Bonzini wrote: > Userspace is expecting non-compacted format for KVM_GET_XSAVE, but > struct xsave_struct might be using the compacted format. Convert > in order to preserve userspace ABI. > > Fixes: f31a9f7c71691569359fa7fb8b0acaa44bce0324 > Cc: Fenghua Yu > Cc: st