[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/46] cpu-exec: fix missed CPU kick during interrupt
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 13/46] cpu-exec: fix missed CPU kick during interrupt injection |
Date: |
Wed, 20 Dec 2017 18:14:25 +0100 |
From: David Hildenbrand <address@hidden>
The conditional memory barrier not only looks strange but actually is
wrong.
On s390x, I can reproduce interrupts via cpu_interrupt() not leading to
a proper kick out of emulation every now and then. cpu_interrupt() is
especially used for inter CPU communication via SIGP (esp. external
calls and emergency interrupts).
With this patch, I was not able to reproduce. (esp. no stalls or hangs
in the guest).
My setup is s390x MTTCG with 16 VCPUs on 8 CPU host, running make -j16.
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
accel/tcg/cpu-exec.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9b544d8..4452cd9 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -525,19 +525,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
TranslationBlock **last_tb)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- int32_t insns_left;
/* Clear the interrupt flag now since we're processing
* cpu->interrupt_request and cpu->exit_request.
+ * Ensure zeroing happens before reading cpu->exit_request or
+ * cpu->interrupt_request (see also smp_wmb in cpu_exit())
*/
- insns_left = atomic_read(&cpu->icount_decr.u32);
- atomic_set(&cpu->icount_decr.u16.high, 0);
- if (unlikely(insns_left < 0)) {
- /* Ensure the zeroing of icount_decr comes before the next read
- * of cpu->exit_request or cpu->interrupt_request.
- */
- smp_mb();
- }
+ atomic_mb_set(&cpu->icount_decr.u16.high, 0);
if (unlikely(atomic_read(&cpu->interrupt_request))) {
int interrupt_request;
--
1.8.3.1
- [Qemu-devel] [PULL 02/46] qemu-thread: fix races on threads that exit very quickly, (continued)
- [Qemu-devel] [PULL 02/46] qemu-thread: fix races on threads that exit very quickly, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 03/46] qemu-pr-helper: miscellaneous fixes, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 04/46] contrib: add systemd unit files, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 06/46] scsi-block: Add share-rw option, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 05/46] Revert "docker: Enable features explicitly in test-full", Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 07/46] MAITAINERS: List Fam Zheng as reviewer for SCSI patches, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 09/46] hyperv: set partition-wide MSRs only on first vcpu, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 10/46] hyperv: ensure SINTx msrs are reset properly, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 08/46] x86/cpu: Enable new SSE/AVX/AVX512 cpu features, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 12/46] cpus: make pause_all_cpus() play with SMP on single threaded TCG, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 13/46] cpu-exec: fix missed CPU kick during interrupt injection,
Paolo Bonzini <=
- [Qemu-devel] [PULL 11/46] hyperv: make SynIC version msr constant, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 14/46] target/i386: Fix compiler warnings, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 15/46] baum: Truncate braille device size to 84x1, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 18/46] tests/boot-serial-test: Make sure that we check the timeout regularly, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 17/46] target/i386: Fix handling of VEX prefixes, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 19/46] tests/boot-serial-test: Add code to allow to specify our own kernel or bios, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 22/46] hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 21/46] tests/boot-serial-test: Add tests for microblaze boards, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 16/46] sockets: remove obsolete code that updated listen address, Paolo Bonzini, 2017/12/20
- [Qemu-devel] [PULL 20/46] tests/boot-serial-test: Add support for the mcf5208evb board, Paolo Bonzini, 2017/12/20