From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDTZ8-0004xC-Um for qemu-devel@nongnu.org; Fri, 10 Jul 2015 04:21:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDTZ5-0001TA-PD for qemu-devel@nongnu.org; Fri, 10 Jul 2015 04:21:50 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:36604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDTZ5-0001SO-Jy for qemu-devel@nongnu.org; Fri, 10 Jul 2015 04:21:47 -0400 Received: by widjy10 with SMTP id jy10so8814758wid.1 for ; Fri, 10 Jul 2015 01:21:47 -0700 (PDT) From: Alvise Rigo Date: Fri, 10 Jul 2015 10:23:44 +0200 Message-Id: <1436516626-8322-12-git-send-email-a.rigo@virtualopensystems.com> In-Reply-To: <1436516626-8322-1-git-send-email-a.rigo@virtualopensystems.com> References: <1436516626-8322-1-git-send-email-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [RFC v3 11/13] Introduce exit_flush_req and tcg_excl_access_lock List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Cc: alex.bennee@linaro.org, jani.kokkonen@huawei.com, tech@virtualopensystems.com, claudio.fontana@huawei.com, pbonzini@redhat.com 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 Suggested-by: Claudio Fontana Signed-off-by: Alvise Rigo --- cputlb.c | 4 ++++ 1 file changed, 4 insertions(+) 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 -- 2.4.5