[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v1 for-2-12 02/15] cpu-exec: fix missed CPU kick dur
From: |
David Hildenbrand |
Subject: |
[qemu-s390x] [PATCH v1 for-2-12 02/15] cpu-exec: fix missed CPU kick during interrupt injection |
Date: |
Mon, 11 Dec 2017 14:47:27 +0100 |
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>
---
accel/tcg/cpu-exec.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 9b544d88c8..dfba5ebd29 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -525,19 +525,15 @@ 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.
*/
- 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();
- }
+ /* Ensure zeroing happens before reading cpu->exit_request or
+ * cpu->interrupt_request. (also see cpu_exit())
+ */
+ smp_mb();
if (unlikely(atomic_read(&cpu->interrupt_request))) {
int interrupt_request;
--
2.14.3
- [qemu-s390x] [PATCH v1 for-2-12 00/15] s390x: flic rework, tcg flic support and tcg, David Hildenbrand, 2017/12/11
- [qemu-s390x] [PATCH v1 for-2-12 01/15] cpus: make pause_all_cpus() play with SMP on single threaded TCG, David Hildenbrand, 2017/12/11
- [qemu-s390x] [PATCH v1 for-2-12 02/15] cpu-exec: fix missed CPU kick during interrupt injection,
David Hildenbrand <=
- [qemu-s390x] [PATCH v1 for-2-12 03/15] s390x/tcg: deliver multiple interrupts in a row, David Hildenbrand, 2017/12/11
- [qemu-s390x] [PATCH v1 for-2-12 07/15] s390x/tcg: tolerate wrong wakeups due to floating interrupts, David Hildenbrand, 2017/12/11
- [qemu-s390x] [PATCH v1 for-2-12 05/15] s390x/tcg: simplify machine check handling, David Hildenbrand, 2017/12/11
- [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, David Hildenbrand, 2017/12/11
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, Cornelia Huck, 2017/12/12
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, Christian Borntraeger, 2017/12/12
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, Cornelia Huck, 2017/12/12
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, David Hildenbrand, 2017/12/12
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, Cornelia Huck, 2017/12/12
- Re: [qemu-s390x] [PATCH v1 for-2-12 06/15] s390x/flic: factor out injection of floating interrupts, Christian Borntraeger, 2017/12/13