From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YICdc-00031j-La for qemu-devel@nongnu.org; Mon, 02 Feb 2015 03:45:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YICdW-000692-K0 for qemu-devel@nongnu.org; Mon, 02 Feb 2015 03:45:44 -0500 Received: from greensocs.com ([193.104.36.180]:58265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YICdW-00068a-A3 for qemu-devel@nongnu.org; Mon, 02 Feb 2015 03:45:38 -0500 Message-ID: <54CF392F.2000806@greensocs.com> Date: Mon, 02 Feb 2015 09:45:35 +0100 From: Frederic Konrad MIME-Version: 1.0 References: <1421428797-23697-1-git-send-email-fred.konrad@greensocs.com> <1421428797-23697-4-git-send-email-fred.konrad@greensocs.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 03/10] replace spinlock by QemuMutex. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: mttcg@listserver.greensocs.com, "J. Kiszka" , Mark Burton , QEMU Developers , Alexander Graf , Paolo Bonzini On 29/01/2015 16:25, Peter Maydell wrote: > On 16 January 2015 at 17:19, wrote: >> From: KONRAD Frederic >> >> 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 >> --- >> 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