Patch "KVM: x86: fix backward migration with async_PF" has been added to the 4.15-stable tree
Subsystems (5)
This is a note to let you know that I've just added the patch titled
KVM: x86: fix backward migration with async_PF
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-x86-fix-backward-migration-with-async_pf.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fe2a3027e74e40a3ece3a4c1e4e51403090a907aMon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <[email protected]>
Date: Thu, 1 Feb 2018 22:16:21 +0100
Subject: KVM: x86: fix backward migration with async_PF
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Radim Krčmář <[email protected]>
commit fe2a3027e74e40a3ece3a4c1e4e51403090a907a upstream.
Guests on new hypersiors might set KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT bit when enabling async_PF, but this bit is reserved on old hypervisors, which results in a failure upon migration.
To avoid breaking different cases, we are checking for CPUID feature bit before enabling the feature and nothing else.
--- Documentation/virtual/kvm/cpuid.txt | 4 ++++ Documentation/virtual/kvm/msr.txt | 3 ++- arch/x86/include/uapi/asm/kvm_para.h | 1 + arch/x86/kernel/kvm.c | 8 ++++---- arch/x86/kvm/cpuid.c | 3 ++- 5 files changed, 13 insertions(+), 6 deletions(-)
Documentation/virtual/kvm/cpuid.txt +4 -0
@@ -54,6 +54,10 @@ KVM_FEATURE_PV_UNHALT || || || before enabling paravirtualized || || spinlock support. ------------------------------------------------------------------------------ +KVM_FEATURE_ASYNC_PF_VMEXIT || 10 || paravirtualized async PF VM exit + || || can be enabled by setting bit 2 + || || when writing to msr 0x4b564d02 +------------------------------------------------------------------------------ KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side || || per-cpu warps are expected in || || kvmclock.
Documentation/virtual/kvm/msr.txt +2 -1
@@ -170,7 +170,8 @@ MSR_KVM_ASYNC_PF_EN: 0x4b564d02 when asynchronous page faults are enabled on the vcpu 0 when disabled. Bit 1 is 1 if asynchronous page faults can be injected when vcpu is in cpl == 0. Bit 2 is 1 if asynchronous page faults - are delivered to L1 as #PF vmexits. + are delivered to L1 as #PF vmexits. Bit 2 can be set only if + KVM_FEATURE_ASYNC_PF_VMEXIT is present in CPUID. First 4 byte of 64 byte memory location will be written to by the hypervisor at the time of asynchronous page fault (APF)
arch/x86/include/uapi/asm/kvm_para.h +1 -0
@@ -25,6 +25,7 @@#define KVM_FEATURE_STEAL_TIME 5#define KVM_FEATURE_PV_EOI 6#define KVM_FEATURE_PV_UNHALT 7 +#define KVM_FEATURE_ASYNC_PF_VMEXIT 10/* The last 8 bits are used to indicate how to interpret the flags field * in pvclock structure. If no bits are set, all flags are ignored.
arch/x86/kernel/kvm.c +4 -4
@@ -341,10 +341,10 @@ static void kvm_guest_cpu_init(void)#endif pa |=KVM_ASYNC_PF_ENABLED ; -/* Async page fault support for L1 hypervisor is optional */ -if (wrmsr_safe (MSR_KVM_ASYNC_PF_EN , - (pa |KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT ) &0xffffffff , pa >>32 ) <0 ) -wrmsrl (MSR_KVM_ASYNC_PF_EN , pa); +if (kvm_para_has_feature (KVM_FEATURE_ASYNC_PF_VMEXIT )) + pa |=KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT ; + +wrmsrl (MSR_KVM_ASYNC_PF_EN , pa);__this_cpu_write (apf_reason.enabled,1 );printk (KERN_INFO "KVM setup async PF for cpu %d\n" ,smp_processor_id ());
arch/x86/kvm/cpuid.c +2 -1
@@ -597,7 +597,8 @@ static inline int __do_cpuid_ent(struct (1 <<KVM_FEATURE_ASYNC_PF ) | (1 <<KVM_FEATURE_PV_EOI ) | (1 <<KVM_FEATURE_CLOCKSOURCE_STABLE_BIT ) | - (1 <<KVM_FEATURE_PV_UNHALT ); + (1 <<KVM_FEATURE_PV_UNHALT ) | + (1 <<KVM_FEATURE_ASYNC_PF_VMEXIT );if (sched_info_on ()) entry->eax |= (1 <<KVM_FEATURE_STEAL_TIME );
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/kvm-x86-fix-backward-migration-with-async_pf.patch