linux-next: manual merge of the kvm tree with the tip tree

From: Stephen Rothwell
Date: Tue May 26 2015 - 03:52:37 EST


Hi all,

Today's linux-next merge of the kvm tree got conflicts in
arch/x86/include/asm/kvm_host.h and arch/x86/kvm/x86.c between commit
0ee6a5172573 ("x86/fpu, kvm: Simplify fx_init()") (and a few others)
from the tip tree and commit d28bc9dd25ce ("KVM: x86: INIT and reset
sequences are different") from the kvm tree.

I fixed it up (since the former commit made fx_init() static, I just
removed the declaration and see below) and can carry the fix as
necessary (no action is required).

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc arch/x86/kvm/x86.c
index 989cfc01e2a5,457b908244f2..000000000000
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@@ -7002,11 -7088,19 +7089,13 @@@ int kvm_arch_vcpu_ioctl_set_fpu(struct
return 0;
}

- static void fx_init(struct kvm_vcpu *vcpu)
-int fx_init(struct kvm_vcpu *vcpu, bool init_event)
++static void fx_init(struct kvm_vcpu *vcpu, bool init_event)
{
- fpstate_init(&vcpu->arch.guest_fpu.state);
- int err;
-
- err = fpu_alloc(&vcpu->arch.guest_fpu);
- if (err)
- return err;
-
+ if (!init_event)
- fpu_finit(&vcpu->arch.guest_fpu);
++ fpstate_init(&vcpu->arch.guest_fpu.state);
+
if (cpu_has_xsaves)
- vcpu->arch.guest_fpu.state->xsave.xsave_hdr.xcomp_bv =
+ vcpu->arch.guest_fpu.state.xsave.header.xcomp_bv =
host_xcr0 | XSTATE_COMPACTION_ENABLED;

/*
@@@ -7038,16 -7140,25 +7127,25 @@@ void kvm_put_guest_fpu(struct kvm_vcpu
{
kvm_put_guest_xcr0(vcpu);

- if (!vcpu->guest_fpu_loaded)
+ if (!vcpu->guest_fpu_loaded) {
+ vcpu->fpu_counter = 0;
return;
+ }

vcpu->guest_fpu_loaded = 0;
- fpu_save_init(&vcpu->arch.guest_fpu);
+ copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu);
__kernel_fpu_end();
++vcpu->stat.fpu_reload;
- if (!vcpu->arch.eager_fpu)
- kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
-
+ /*
+ * If using eager FPU mode, or if the guest is a frequent user
+ * of the FPU, just leave the FPU active for next time.
+ * Every 255 times fpu_counter rolls over to 0; a guest that uses
+ * the FPU in bursts will revert to loading it on demand.
+ */
+ if (!use_eager_fpu()) {
+ if (++vcpu->fpu_counter < 5)
+ kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
+ }
trace_kvm_fpu(0);
}

@@@ -7346,7 -7450,9 +7445,7 @@@ int kvm_arch_vcpu_init(struct kvm_vcpu
goto fail_free_mce_banks;
}

- fx_init(vcpu);
- r = fx_init(vcpu, false);
- if (r)
- goto fail_free_wbinvd_dirty_mask;
++ fx_init(vcpu, false);

vcpu->arch.ia32_tsc_adjust_msr = 0x0;
vcpu->arch.pv_time_enabled = false;

Attachment: pgpzMMoju2C2B.pgp
Description: OpenPGP digital signature