From patchwork Fri Jul 10 08:23:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvise Rigo X-Patchwork-Id: 493684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DF38F1402BF for ; Fri, 10 Jul 2015 18:24:45 +1000 (AEST) Received: from localhost ([::1]:43543 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDTbv-0001jv-PL for incoming@patchwork.ozlabs.org; Fri, 10 Jul 2015 04:24:43 -0400 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) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MrhjlEQpmVk2aEptYRRhqbTtH5KpzAlb4SmmF2OfaOo=; b=AdC8QbdyoPBFi5K5awy+HpRhA6Pjd5AePpjhWRehn2SLCmvswc+PmC/cu3VODyrfUv YASfQJ3BaMz+l/onDbhpQSU7gamdRzdxQzMoF8sOtcsCdlaQvxxv/lhOzrwVre7BJtRU +gO4eeD8S9O3WPm7yxnny0kO7gb1h7s6ASDH+8pbjcq8jErMoLVb1s2/Fq/zRjOFH46k Bgp6paflfODKHMukwsSRD42i0ou9qWZxL1DXLHM7yxgJaJYcQUH1BO+jWOXXmc+NAS4l MRG9d8xrO1B85IilndeTGsVHpHXXUqdnXnvCPgz9FaCkMM/2YWn66dkWlixMAg8Wfg6a o9sA== X-Gm-Message-State: ALoCoQmg/EcGeAEjLfk6qU0hIHGky20PCO+B+svUbcI7wxohO+Er+uhOr1EhXh1Iuagebt1YMjaS X-Received: by 10.180.97.7 with SMTP id dw7mr3998888wib.74.1436516507202; Fri, 10 Jul 2015 01:21:47 -0700 (PDT) Received: from linarch.home (LPuteaux-656-1-278-113.w80-15.abo.wanadoo.fr. [80.15.154.113]) by smtp.googlemail.com with ESMTPSA id ee1sm1785434wic.8.2015.07.10.01.21.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Jul 2015 01:21:46 -0700 (PDT) From: Alvise Rigo To: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com Date: Fri, 10 Jul 2015 10:23:44 +0200 Message-Id: <1436516626-8322-12-git-send-email-a.rigo@virtualopensystems.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1436516626-8322-1-git-send-email-a.rigo@virtualopensystems.com> References: <1436516626-8322-1-git-send-email-a.rigo@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.170 Cc: alex.bennee@linaro.org, jani.kokkonen@huawei.com, tech@virtualopensystems.com, claudio.fontana@huawei.com, pbonzini@redhat.com Subject: [Qemu-devel] [RFC v3 11/13] Introduce exit_flush_req and tcg_excl_access_lock X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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