[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 06/12] cpus: check cpu->running in cpu_get_icount
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v2 06/12] cpus: check cpu->running in cpu_get_icount_raw() |
Date: |
Wed, 5 Apr 2017 14:24:57 +0100 |
The lifetime of current_cpu is now the lifetime of the vCPU thread.
However get_icount_raw() can apply a fudge factor if called while code
is running to take into account the current executed instruction
count.
To ensure this is always the case we also check cpu->running.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
cpus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 4e48b9c4ad..18b1746770 100644
--- a/cpus.c
+++ b/cpus.c
@@ -229,7 +229,7 @@ int64_t cpu_get_icount_raw(void)
CPUState *cpu = current_cpu;
icount = timers_state.qemu_icount;
- if (cpu) {
+ if (cpu && cpu->running) {
if (!cpu->can_do_io) {
fprintf(stderr, "Bad icount read\n");
exit(1);
--
2.11.0
- [Qemu-devel] [PATCH v2 00/12] icount and misc MTTCG fixes for 2.9-rc4, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 02/12] scripts/qemu-gdb/timers.py: new helper to dump timer state, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 03/12] scripts/replay-dump.py: replay log dumper, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 05/12] cpus: remove icount handling from qemu_tcg_cpu_thread_fn, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 04/12] target/i386/misc_helper: wrap BQL around another IRQ generator, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 06/12] cpus: check cpu->running in cpu_get_icount_raw(),
Alex Bennée <=
- [Qemu-devel] [PATCH v2 01/12] scripts/qemugdb/mtree.py: fix up mtree dump, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 08/12] cpus: don't credit executed instructions before they have run, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 07/12] cpus: move icount preparation out of tcg_exec_cpu, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 09/12] cpus: introduce cpu_update_icount helper, Alex Bennée, 2017/04/05
- [Qemu-devel] [PATCH v2 12/12] replay: assert time only goes forward, Alex Bennée, 2017/04/05