[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v5 01/24] cpu-exec: fix exception_index handling
From: |
Pavel Dovgalyuk |
Subject: |
[Qemu-devel] [RFC PATCH v5 01/24] cpu-exec: fix exception_index handling |
Date: |
Tue, 23 Jan 2018 11:53:25 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Function cpu_handle_interrupt calls cc->cpu_exec_interrupt to process
pending hardware interrupts. Under the hood cpu_exec_interrupt uses
cpu->exception_index to pass information to the internal function which
is usually common for exception and interrupt processing.
But this value is not reset after return and may be processed again
by cpu_handle_exception. This does not happen due to overwriting
the exception_index at the end of cpu_handle_interrupt.
But this branch may also overwrite the valid exception_index in some cases.
Therefore this patch:
1. resets exception_index just after the call to cpu_exec_interrupt
2. prevents overwriting the meaningful value of exception_index
Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
accel/tcg/cpu-exec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 280200f..9cc6972 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -585,6 +585,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
else {
if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
replay_interrupt();
+ cpu->exception_index = -1;
*last_tb = NULL;
}
/* The target hook may have updated the 'cpu->interrupt_request';
@@ -606,7 +607,9 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
if (unlikely(atomic_read(&cpu->exit_request)
|| (use_icount && cpu->icount_decr.u16.low + cpu->icount_extra == 0)))
{
atomic_set(&cpu->exit_request, 0);
- cpu->exception_index = EXCP_INTERRUPT;
+ if (cpu->exception_index == -1) {
+ cpu->exception_index = EXCP_INTERRUPT;
+ }
return true;
}
- [Qemu-devel] [RFC PATCH v5 00/24] replay additions, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 01/24] cpu-exec: fix exception_index handling,
Pavel Dovgalyuk <=
- [Qemu-devel] [RFC PATCH v5 02/24] block: implement bdrv_snapshot_goto for blkreplay, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 03/24] blkreplay: create temporary overlay for underlaying devices, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 04/24] replay: disable default snapshot for record/replay, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 05/24] replay: fix processing async events, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 06/24] replay: fixed replay_enable_events, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 07/24] replay: fix save/load vm for non-empty queue, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 08/24] replay: added replay log format description, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 09/24] replay: save prior value of the host clock, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 10/24] target/arm/arm-powertctl: drop BQL assertions, Pavel Dovgalyuk, 2018/01/23
- [Qemu-devel] [RFC PATCH v5 11/24] cpus: push BQL lock to qemu_*_wait_io_event, Pavel Dovgalyuk, 2018/01/23