linux/arch/x86
Wanpeng Li 81484efacb KVM: async_pf: avoid async pf injection when in guest mode
commit 9bc1f09f6f upstream.

 INFO: task gnome-terminal-:1734 blocked for more than 120 seconds.
       Not tainted 4.12.0-rc4+ #8
 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
 gnome-terminal- D    0  1734   1015 0x00000000
 Call Trace:
  __schedule+0x3cd/0xb30
  schedule+0x40/0x90
  kvm_async_pf_task_wait+0x1cc/0x270
  ? __vfs_read+0x37/0x150
  ? prepare_to_swait+0x22/0x70
  do_async_page_fault+0x77/0xb0
  ? do_async_page_fault+0x77/0xb0
  async_page_fault+0x28/0x30

This is triggered by running both win7 and win2016 on L1 KVM simultaneously,
and then gives stress to memory on L1, I can observed this hang on L1 when
at least ~70% swap area is occupied on L0.

This is due to async pf was injected to L2 which should be injected to L1,
L2 guest starts receiving pagefault w/ bogus %cr2(apf token from the host
actually), and L1 guest starts accumulating tasks stuck in D state in
kvm_async_pf_task_wait() since missing PAGE_READY async_pfs.

This patch fixes the hang by doing async pf when executing L1 guest.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-09-15 18:30:09 +01:00
..
boot x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup 2017-08-26 02:14:36 +01:00
configs USB: remove CONFIG_USB_DEBUG from defconfig files 2014-05-28 09:40:45 -07:00
crypto crypto: ghash-clmulni: specify context size for ghash async algorithm 2015-09-29 16:44:46 +01:00
ia32 x86/entry/compat: Add missing CLAC to entry_INT80_32 2016-03-08 12:15:09 +00:00
include x86/vdso: Plug race between mapping and ELF header setup 2017-07-18 18:40:34 +01:00
kernel kvm: async_pf: fix rcu_irq_enter() with irqs enabled 2017-09-15 18:29:57 +01:00
kvm KVM: async_pf: avoid async pf injection when in guest mode 2017-09-15 18:30:09 +01:00
lguest asmlinkage, x86: Add explicit __visible to arch/x86/* 2014-05-05 16:07:44 -07:00
lib perf/x86: Fix copy_from_user_nmi() return if range is not ok 2015-09-30 13:20:53 +01:00
math-emu x86/ldt: Further fix FPU emulation 2015-09-03 13:29:55 +01:00
mm x86/mm/32: Set the '__vmalloc_start_set' flag in initmem_init() 2017-08-26 02:14:47 +01:00
net x86: bpf_jit: fix compilation of large bpf programs 2015-06-03 14:30:07 +01:00
oprofile x86, oprofile, nmi: Fix CPU hotplug callback registration 2014-03-20 13:43:43 +01:00
pci xen: do not re-use pirq number cached in pci device msi msg data 2017-07-18 18:40:05 +01:00
platform x86/platform/intel-mid: Correct MSI IRQ line for watchdog device 2017-07-18 18:40:11 +01:00
power x86/power/64: Fix kernel text mapping corruption during image restoration 2016-08-22 22:38:25 +01:00
realmode x86/build: Supress realmode.bin is up to date message 2014-04-16 15:17:24 +02:00
syscalls x86/syscalls/64: Add compat_sys_keyctl for 32-bit userspace 2016-11-20 01:17:03 +00:00
tools x86, build: replace Perl script with Shell script 2015-02-04 10:58:18 +00:00
um um: Fix PTRACE_POKEUSER on x86_64 2017-08-26 02:14:45 +01:00
vdso x86/vdso: Ensure vdso32_enabled gets set to valid values only 2017-07-18 18:40:34 +01:00
video x86: Use vga_default_device() when determining whether an fb is primary 2012-04-24 09:50:17 +01:00
xen x86/iopl/64: Properly context-switch IOPL on Xen PV 2016-04-11 09:54:23 +01:00
.gitignore x86/kprobes: Add arch/x86/tools/insn_sanity to .gitignore 2012-01-16 08:21:59 +01:00
Kbuild x86, realmode: realmode.bin infrastructure 2012-05-08 11:41:48 -07:00
Kconfig x86/watchdog: Fix Kconfig help text file path reference to lockup watchdog documentation 2017-09-15 18:29:50 +01:00
Kconfig.cpu Merge branch 'x86-nuke-platforms-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-04-02 13:15:58 -07:00
Kconfig.debug x86/efi: Dump the EFI page table 2014-03-04 16:17:17 +00:00
Makefile x86-64, build: Fix stack protector Makefile breakage with 32-bit userland 2014-05-07 14:14:44 -07:00
Makefile.um um: fix linker script generation 2012-04-09 13:59:00 -04:00
Makefile_32.cpu x86, 386 removal: Remove CONFIG_M386 from Kconfig 2012-11-29 13:23:01 -08:00