Wanpeng Li
2bc73d9141
KVM: Fix leak vCPU's VMCS value into other pCPU
...
commit 17e433b543 upstream.
After commit d73eb57b80 (KVM: Boost vCPUs that are delivering interrupts), a
five years old bug is exposed. Running ebizzy benchmark in three 80 vCPUs VMs
on one 80 pCPUs Skylake server, a lot of rcu_sched stall warning splatting
in the VMs after stress testing:
INFO: rcu_sched detected stalls on CPUs/tasks: { 4 41 57 62 77} (detected by 15, t=60004 jiffies, g=899, c=898, q=15073)
Call Trace:
flush_tlb_mm_range+0x68/0x140
tlb_flush_mmu.part.75+0x37/0xe0
tlb_finish_mmu+0x55/0x60
zap_page_range+0x142/0x190
SyS_madvise+0x3cd/0x9c0
system_call_fastpath+0x1c/0x21
swait_active() sustains to be true before finish_swait() is called in
kvm_vcpu_block(), voluntarily preempted vCPUs are taken into account
by kvm_vcpu_on_spin() loop greatly increases the probability condition
kvm_arch_vcpu_runnable(vcpu) is checked and can be true, when APICv
is enabled the yield-candidate vCPU's VMCS RVI field leaks(by
vmx_sync_pir_to_irr()) into spinning-on-a-taken-lock vCPU's current
VMCS.
This patch fixes it by checking conservatively a subset of events.
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Radim Krčmář <rkrcmar@redhat.com >
Cc: Christian Borntraeger <borntraeger@de.ibm.com >
Cc: Marc Zyngier <Marc.Zyngier@arm.com >
Cc: stable@vger.kernel.org
Fixes: 98f4a1467 (KVM: add kvm_arch_vcpu_runnable() test to kvm_vcpu_on_spin() loop)
Signed-off-by: Wanpeng Li <wanpengli@tencent.com >
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-08-16 10:12:53 +02:00
..
2019-01-22 21:40:33 +01:00
2018-12-01 09:37:29 +01:00
2019-03-27 14:14:39 +09:00
2018-08-18 15:55:59 -07:00
2018-09-30 08:49:55 -07:00
2019-02-12 19:46:57 +01:00
2019-05-31 06:46:24 -07:00
2019-03-13 14:02:35 -07:00
2019-05-22 07:37:41 +02:00
2019-08-09 17:52:33 +02:00
2019-06-25 11:35:53 +08:00
2018-11-27 16:13:05 +01:00
2019-04-17 08:38:46 +02:00
2018-10-12 15:25:17 +01:00
2019-05-08 07:21:54 +02:00
2019-02-27 10:08:52 +01:00
2018-09-03 16:10:40 +01:00
2019-08-04 09:30:56 +02:00
2018-08-23 13:44:43 -07:00
2018-09-28 18:04:06 -07:00
2019-07-03 13:14:46 +02:00
2019-01-26 09:32:34 +01:00
2019-08-06 19:06:50 +02:00
2018-08-22 08:08:27 -07:00
2018-08-30 14:18:03 +01:00
2019-04-20 09:16:05 +02:00
2019-03-05 17:58:50 +01:00
2018-08-22 10:52:46 -07:00
2019-05-31 06:46:00 -07:00
2018-08-17 16:20:27 -07:00
2019-06-09 09:17:11 +02:00
2019-04-17 08:38:51 +02:00
2018-08-31 14:48:56 -06:00
2019-08-04 09:30:57 +02:00
2019-01-31 08:14:41 +01:00
2019-07-03 13:14:48 +02:00
2019-05-25 18:23:48 +02:00
2019-08-16 10:12:38 +02:00
2019-08-09 17:52:34 +02:00
2019-08-09 17:52:34 +02:00
2019-04-05 22:33:03 +02:00
2018-08-17 16:20:32 -07:00
2019-08-06 19:06:52 +02:00
2019-08-06 19:06:52 +02:00
2018-11-13 11:08:25 -08:00
2019-06-09 09:17:23 +02:00
2019-02-27 10:08:53 +01:00
2019-06-09 09:17:23 +02:00
2019-02-27 10:08:53 +01:00
2019-06-04 08:02:34 +02:00
2019-06-11 12:20:52 +02:00
2019-03-10 07:17:15 +01:00
2019-07-26 09:14:12 +02:00
2018-08-22 10:52:46 -07:00
2018-08-22 10:52:48 -07:00
2019-07-31 07:27:11 +02:00
2019-05-25 18:23:26 +02:00
2019-03-23 20:10:09 +01:00
2019-08-09 17:52:28 +02:00
2018-08-17 16:20:32 -07:00
2019-06-04 08:02:34 +02:00
2019-05-16 19:41:22 +02:00
2019-05-16 19:41:17 +02:00
2018-08-25 13:40:38 -07:00
2019-04-05 22:32:59 +02:00
2019-07-10 09:53:47 +02:00
2019-07-28 08:29:29 +02:00
2018-12-17 09:24:38 +01:00
2018-12-01 09:37:31 +01:00
2018-12-05 19:32:10 +01:00
2019-05-31 06:46:18 -07:00
2019-02-12 19:47:14 +01:00
2018-08-23 18:48:43 -07:00
2019-03-23 20:10:08 +01:00
2018-11-13 11:08:54 -08:00
2019-02-12 19:47:24 +01:00
2018-12-05 19:32:13 +01:00
2019-05-31 06:46:28 -07:00
2019-01-13 09:51:04 +01:00
2019-07-31 07:26:59 +02:00
2019-05-22 07:37:40 +02:00
2019-05-22 07:37:40 +02:00
2019-01-31 08:14:36 +01:00
2019-05-08 07:21:43 +02:00
2018-11-21 09:19:20 +01:00
2018-08-26 11:48:42 -07:00
2019-03-05 17:58:51 +01:00
2019-08-09 17:52:34 +02:00
2018-08-15 10:25:26 -07:00
2018-08-22 10:52:47 -07:00
2019-08-04 09:30:54 +02:00
2018-08-22 10:52:52 -07:00
2019-03-05 17:58:45 +01:00
2019-04-05 22:33:09 +02:00
2019-07-28 08:29:29 +02:00
2018-08-16 19:36:55 +02:00
2019-06-04 08:02:34 +02:00
2019-06-04 08:02:34 +02:00
2018-08-17 16:20:30 -07:00
2019-04-20 09:15:59 +02:00
2019-07-21 09:03:11 +02:00
2019-03-23 20:09:48 +01:00
2018-08-18 11:44:53 -07:00
2019-04-27 09:36:37 +02:00
2019-08-16 10:12:53 +02:00
2018-08-24 13:20:33 -07:00
2019-06-09 09:17:19 +02:00
2018-08-15 10:25:26 -07:00
2018-12-29 13:37:59 +01:00
2019-04-17 08:38:51 +02:00
2018-08-22 10:52:45 -07:00
2019-01-13 09:51:04 +01:00
2018-09-13 15:18:04 -10:00
2018-09-13 15:18:04 -10:00
2019-05-04 09:20:11 +02:00
2018-08-22 10:52:44 -07:00
2018-10-09 08:30:51 +02:00
2018-09-05 14:36:53 +02:00
2019-06-09 09:17:23 +02:00
2019-05-31 06:46:05 -07:00
2019-01-09 17:38:42 +01:00
2018-12-05 19:31:59 +01:00
2019-02-23 09:07:25 +01:00
2019-04-27 09:36:30 +02:00
2019-06-04 08:02:34 +02:00
2019-06-04 08:02:34 +02:00
2018-09-23 21:55:24 -07:00
2018-08-23 16:03:58 -07:00
2018-11-21 09:19:20 +01:00
2018-08-17 16:20:29 -07:00
2018-08-22 10:52:45 -07:00
2018-11-13 11:08:24 -08:00
2019-06-09 09:17:24 +02:00
2018-08-23 18:48:44 -07:00
2019-05-31 06:46:30 -07:00
2018-08-17 16:20:28 -07:00
2018-08-23 18:48:43 -07:00
2018-09-03 19:05:13 -07:00
2019-05-25 18:23:38 +02:00
2018-08-22 10:52:45 -07:00
2019-07-28 08:29:28 +02:00
2018-12-01 09:37:34 +01:00
2019-05-04 09:20:11 +02:00
2018-08-22 10:52:46 -07:00
2019-03-23 20:10:04 +01:00
2019-06-11 12:20:52 +02:00
2019-01-09 17:38:33 +01:00
2018-12-05 19:32:03 +01:00
2019-06-15 11:54:10 +02:00
2018-08-22 18:17:29 +02:00
2019-07-26 09:14:07 +02:00
2019-04-05 22:32:56 +02:00
2019-04-05 22:32:56 +02:00
2019-08-04 09:30:56 +02:00
2018-08-15 10:25:26 -07:00
2018-10-02 14:38:02 -07:00
2018-08-20 09:22:45 -07:00
2018-08-22 10:52:43 -07:00
2018-11-13 11:08:45 -08:00
2019-06-04 08:02:30 +02:00
2019-05-25 18:23:20 +02:00
2019-04-03 06:26:28 +02:00
2019-05-31 06:46:16 -07:00
2018-08-16 12:14:42 -07:00
2019-03-13 14:02:35 -07:00
2019-04-17 08:38:45 +02:00
2018-10-12 12:35:02 +02:00
2019-04-20 09:16:05 +02:00
2018-08-23 18:48:44 -07:00
2018-08-18 11:44:53 -07:00
2018-12-29 13:37:55 +01:00
2018-11-13 11:08:51 -08:00
2019-06-17 19:51:56 +02:00
2018-08-22 15:11:35 +02:00
2019-05-31 06:46:29 -07:00
2018-09-03 13:26:44 +02:00
2018-10-17 15:35:29 -04:00
2018-12-08 12:59:07 +01:00
2018-12-13 09:16:15 +01:00
2018-09-12 14:58:47 -07:00
2019-05-08 07:21:44 +02:00
2018-08-23 18:48:44 -07:00
2018-08-16 09:57:20 -07:00
2018-09-13 17:58:30 +02:00
2019-02-27 10:09:01 +01:00
2019-04-17 08:38:52 +02:00
2018-09-13 15:18:04 -10:00
2018-09-13 15:18:04 -10:00
2019-07-14 08:11:21 +02:00
2018-11-13 11:08:42 -08:00