virtualization/app-emulation/qemu/files/0.14.1/0022-fixing-smp-races.patch

35 lines
1.2 KiB
Diff
Raw Normal View History

From: Alexander Graf <agraf@suse.de>
fixes some SMP races
---
cpu-all.h | 2 +-
exec.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: qemu-0.14.1/cpu-all.h
===================================================================
--- qemu-0.14.1.orig/cpu-all.h
+++ qemu-0.14.1/cpu-all.h
@@ -775,7 +775,7 @@ void cpu_dump_statistics(CPUState *env,
void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
extern CPUState *first_cpu;
-extern CPUState *cpu_single_env;
+extern __thread CPUState *cpu_single_env;
#define CPU_INTERRUPT_HARD 0x02 /* hardware interrupt pending */
#define CPU_INTERRUPT_EXITTB 0x04 /* exit the current TB (use for x86 a20 case) */
Index: qemu-0.14.1/exec.c
===================================================================
--- qemu-0.14.1.orig/exec.c
+++ qemu-0.14.1/exec.c
@@ -112,7 +112,7 @@ RAMList ram_list = { .blocks = QLIST_HEA
CPUState *first_cpu;
/* current CPU in the current thread. It is only valid inside
cpu_exec() */
-CPUState *cpu_single_env;
+__thread CPUState *cpu_single_env;
/* 0 = Do not count executed instructions.
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */