x86, kvm: fix compilation for !CONFIG_PARAVIRT_SPINLOCKS or !CONFIG_SMP
Subsystems (3)
Paolo Bonzini
maintainerPATCH 1/1 x86, kvm: fix compilation for !CONFIG_PARAVIRT_SPINLOCKS or !CONFIG_SMP
The assembly version of __kvm_vcpu_is_preempted only works if CONFIG_SMP is defined, due to the use of __per_cpu_offset. It also uses the KVM_STEAL_TIME_preempted offset constant which is currently not defined if !CONFIG_PARAVIRT_SPINLOCKS. Fix both issues.
This is the delta between Li RongQing's v3 and v4
submissions.
Signed-off-by Paolo Bonzini <[email protected]>
--- arch/x86/kernel/asm-offsets_64.c | 4 ++-- arch/x86/kernel/kvm.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/asm-offsets_64.c +2 -2
@@ -5,7 +5,7 @@#include <asm/ia32.h> -#if defined(CONFIG_KVM_GUEST ) && defined(CONFIG_PARAVIRT_SPINLOCKS ) +#if defined(CONFIG_KVM_GUEST )#include <asm/kvm_para.h> #endif
@@ -20,7 +20,7 @@ int main(void)BLANK ();#endif -#if defined(CONFIG_KVM_GUEST ) && defined(CONFIG_PARAVIRT_SPINLOCKS ) +#if defined(CONFIG_KVM_GUEST )OFFSET (KVM_STEAL_TIME_preempted, kvm_steal_time, preempted);BLANK ();#endif
arch/x86/kernel/kvm.c +3 -1
@@ -752,7 +752,9 @@ static void kvm_crash_shutdown(struct pt_regs *regs) }#endif -#ifdef CONFIG_X86_32 +#if defined(CONFIG_X86_32 ) || !defined(CONFIG_SMP ) +bool __kvm_vcpu_is_preempted (long cpu); + __visible bool __kvm_vcpu_is_preempted(long cpu) {struct kvm_steal_time *src = &per_cpu (steal_time, cpu);
Signature · 1 line
2.31.1