Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kvmclock: Add functions to check if the host has stopped the vm

When a host stops or suspends a VM it will set a flag to show this. The
watchdog will use these functions to determine if a softlockup is real, or the
result of a suspended VM.

Signed-off-by: Eric B Munson <emunson@mgebm.net>
asm-generic changes Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>

authored by

Eric B Munson and committed by
Avi Kivity
3b5d56b9 eae3ee7d

+79
+1
arch/alpha/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/arm/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/avr32/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/blackfin/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/c6x/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/frv/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/h8300/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/hexagon/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+5
arch/ia64/include/asm/kvm_para.h
··· 26 26 return 0; 27 27 } 28 28 29 + static inline bool kvm_check_and_clear_guest_paused(void) 30 + { 31 + return false; 32 + } 33 + 29 34 #endif 30 35 31 36 #endif
+1
arch/m68k/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/microblaze/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/mips/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/mn10300/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/openrisc/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/parisc/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+5
arch/powerpc/include/asm/kvm_para.h
··· 206 206 return r; 207 207 } 208 208 209 + static inline bool kvm_check_and_clear_guest_paused(void) 210 + { 211 + return false; 212 + } 213 + 209 214 #endif /* __KERNEL__ */ 210 215 211 216 #endif /* __POWERPC_KVM_PARA_H__ */
+5
arch/s390/include/asm/kvm_para.h
··· 149 149 return 0; 150 150 } 151 151 152 + static inline bool kvm_check_and_clear_guest_paused(void) 153 + { 154 + return false; 155 + } 156 + 152 157 #endif 153 158 154 159 #endif /* __S390_KVM_PARA_H */
+1
arch/score/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/sh/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/sparc/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/tile/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/um/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+1
arch/unicore32/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+8
arch/x86/include/asm/kvm_para.h
··· 95 95 extern void kvmclock_init(void); 96 96 extern int kvm_register_clock(char *txt); 97 97 98 + #ifdef CONFIG_KVM_CLOCK 99 + bool kvm_check_and_clear_guest_paused(void); 100 + #else 101 + static inline bool kvm_check_and_clear_guest_paused(void) 102 + { 103 + return false; 104 + } 105 + #endif /* CONFIG_KVMCLOCK */ 98 106 99 107 /* This instruction is vmcall. On non-VT architectures, it will generate a 100 108 * trap that we will then rewrite to the appropriate instruction.
+21
arch/x86/kernel/kvmclock.c
··· 22 22 #include <asm/msr.h> 23 23 #include <asm/apic.h> 24 24 #include <linux/percpu.h> 25 + #include <linux/hardirq.h> 25 26 26 27 #include <asm/x86_init.h> 27 28 #include <asm/reboot.h> ··· 114 113 do_div(lpj, HZ); 115 114 preset_lpj = lpj; 116 115 } 116 + 117 + bool kvm_check_and_clear_guest_paused(void) 118 + { 119 + bool ret = false; 120 + struct pvclock_vcpu_time_info *src; 121 + 122 + /* 123 + * per_cpu() is safe here because this function is only called from 124 + * timer functions where preemption is already disabled. 125 + */ 126 + WARN_ON(!in_atomic()); 127 + src = &__get_cpu_var(hv_clock); 128 + if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { 129 + __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); 130 + ret = true; 131 + } 132 + 133 + return ret; 134 + } 135 + EXPORT_SYMBOL_GPL(kvm_check_and_clear_guest_paused); 117 136 118 137 static struct clocksource kvm_clock = { 119 138 .name = "kvm-clock",
+1
arch/xtensa/include/asm/kvm_para.h
··· 1 + #include <asm-generic/kvm_para.h>
+14
include/asm-generic/kvm_para.h
··· 1 + #ifndef _ASM_GENERIC_KVM_PARA_H 2 + #define _ASM_GENERIC_KVM_PARA_H 3 + 4 + 5 + /* 6 + * This function is used by architectures that support kvm to avoid issuing 7 + * false soft lockup messages. 8 + */ 9 + static inline bool kvm_check_and_clear_guest_paused(void) 10 + { 11 + return false; 12 + } 13 + 14 + #endif