On Mon, 2016-03-21 at 11:28 +0100, Paolo Bonzini wrote: > > On 21/03/2016 11:05, Huaitong Han wrote: > > + if (vmx->guest_pkru_valid) > > + write_pkru(vmx->guest_pkru); > > This can be __write_pkru. Yes > > > atomic_switch_perf_msrs(vmx); > > debugctlmsr = get_debugctlmsr(); > > > > @@ -8734,6 +8743,18 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) > > vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); > > > > /* > > + * eager fpu is enabled if PKEY is supported and CR4 is switched > > + * back on host, so it is safe to read guest PKRU from current > > + * XSAVE. > > + */ > > + vmx->guest_pkru = read_pkru(); > > + if (vmx->guest_pkru != vmx->host_pkru) { > > + vmx->guest_pkru_valid = true; > > + write_pkru(vmx->host_pkru); > > + } else > > + vmx->guest_pkru_valid = false; > > Should this code instead be enclosed in > > if (boot_cpu_has(X86_FEATURE_OSPKE)) > > and use __read_pkru/__write_pkru? Yes > > Paolo ��.n��������+%������w��{.n�����o�^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�