From: Avi Kivity on
On 05/14/2010 06:16 AM, Sheng Yang wrote:
> Convert KVM to use generic FPU API.
>
> Signed-off-by: Sheng Yang<sheng(a)linux.intel.com>
> ---
> arch/x86/include/asm/kvm_host.h | 18 +---------
> arch/x86/kvm/x86.c | 73 ++++++++++++---------------------------
> 2 files changed, 23 insertions(+), 68 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index ed48904..beba6f5 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -300,8 +300,7 @@ struct kvm_vcpu_arch {
> unsigned long mmu_seq;
> } update_pte;
>
> - struct i387_fxsave_struct host_fx_image;
> - struct i387_fxsave_struct guest_fx_image;
> + struct fpu host_fpu, guest_fpu;
>
>

Do we really need host_fpu? I think we can call unlazy_fpu() instead
and drop host_fpu completely. This might reduce the need for changes in
patch 1 (as well as generally improving the code).

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Avi Kivity on
On 05/17/2010 12:08 PM, Sheng Yang wrote:
> Convert KVM to use generic FPU API.
>
> void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
> {
> if (vcpu->guest_fpu_loaded)
> @@ -5156,7 +5134,7 @@ void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
>
> vcpu->guest_fpu_loaded = 1;
> unlazy_fpu(current);
> - kvm_fx_restore(&vcpu->arch.guest_fx_image);
> + fpu_restore_checking(&vcpu->arch.guest_fpu);
> trace_kvm_fpu(1);
> }
>

Do we need to do something on error here?

I think an error can only occur if userspace sets bad fpu state, so
maybe do the check in the ioctl.

In any case, unrelated to this patch.

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/