diff mbox

[RFC,v3,11/13] Introduce exit_flush_req and tcg_excl_access_lock

Message ID 1436516626-8322-12-git-send-email-a.rigo@virtualopensystems.com
State New
Headers show

Commit Message

Alvise Rigo July 10, 2015, 8:23 a.m. UTC
Introduce two new variables to synchronize the vCPUs during atomic
operations.

- exit_flush_request allows one vCPU to make an exclusive flush request for all
  the running vCPUs
- tcg_excl_access_lock is a mutex that protects all the sensible
  operations concerning atomic instruction emulation. Most of all, the
  mutex is used to protect the env->exclusive_protected_hwaddr (one
  mutex for all vCPUs).

Suggested-by: Jani Kokkonen <jani.kokkonen@huawei.com>
Suggested-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Alvise Rigo <a.rigo@virtualopensystems.com>
---
 cputlb.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/cputlb.c b/cputlb.c
index 9794e6b..66df41a 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -39,6 +39,10 @@  void qemu_mutex_unlock_iothread(void);
 /* statistics */
 int tlb_flush_count;
 
+/* For atomic instruction handling. */
+volatile int exit_flush_request = 0;
+QemuMutex tcg_excl_access_lock;
+
 /* NOTE:
  * If flush_global is true (the usual case), flush all tlb entries.
  * If flush_global is false, flush (at least) all tlb entries not