On 29/01/2015 16:25, Peter Maydell wrote:
On 16 January 2015 at 17:19, <fred.kon...@greensocs.com> wrote:
From: KONRAD Frederic <fred.kon...@greensocs.com>
spinlock is only used in two cases:
* cpu-exec.c: to protect TranslationBlock
* mem_helper.c: for lock helper in target-i386 (which seems broken).
It's a pthread_mutex_t in user-mode so better using QemuMutex directly in this
case.
It allows as well to reuse tb_lock mutex of TBContext in case of multithread
TCG.
Signed-off-by: KONRAD Frederic <fred.kon...@greensocs.com>
---
cpu-exec.c | 15 +++++++++++----
include/exec/exec-all.h | 4 ++--
linux-user/main.c | 6 +++---
target-i386/mem_helper.c | 16 +++++++++++++---
tcg/i386/tcg-target.c | 8 ++++++++
5 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index a4f0eff..1e7513c 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -335,7 +335,9 @@ int cpu_exec(CPUArchState *env)
SyncClocks sc;
/* This must be volatile so it is not trashed by longjmp() */
+#if defined(CONFIG_USER_ONLY)
volatile bool have_tb_lock = false;
+#endif
This work should be removing ifdefs indicating differences between
handling of user-only and softmmu regarding locking and threads,
not adding new ones.
-- PMM
True,
I tried to go step by step to be able to use tb_lock and remove spinlock
(which is
qemu_mutex_lock with ifdefs) to avoid a big patch with a lot of changes.
The ifdefs should be removed later in the series (I think).
Fred