From patchwork Fri Oct 25 06:36:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 177641 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3252737ill; Fri, 25 Oct 2019 00:01:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnxEscnOYLGTwpNlKl3mj0QubECBmGs1/8XCCeVbUrsp9L9oRnOsOBMm53WvJOzGZXFHHf X-Received: by 2002:a0c:9adf:: with SMTP id k31mr1817992qvf.126.1571986915524; Fri, 25 Oct 2019 00:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571986915; cv=none; d=google.com; s=arc-20160816; b=RY8Lcht6Bp7Bd9vl1Wk1CsdY5Zeyl0f5rVrERmgKzEMfhaE/iUTkj9Nk4o9qHLFJ85 88yRT7TInh0+PyAuNpJMocf7BtAswvoMh+XFexLA/hNt+JJrCuiRrIAHfqFTSCpGUTBv 5PBzXknU2B5lPDZgwLPGYSnFXSIZBzqRDjuFDcAlPJyzjOj1d8rxcpKXp0viYotItVBi N1WLm6wZEdX8t/ueKFQX+DvBml35qACUsaQLW+Qnpwl0R1TkB8KzdmB/b7i/nqr/iRjz NGhkq3qTDn4hHyjTpDC0Cgn7lcdnINEOdzMqRjQTZ2tHAAlpPjQAeeefo+SdrWdJpdIt /Mbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=a+CNlZHOsvnPAzo+1k2Dke9GSSUrs8d4XRw46Zp2gXU=; b=klV3ydzfsTsxu884P3an/Iqj7W3zs/A9QdP8hCBkbS1BjjjMSTBHNbW5Qa9/tRAaOa ZKcZm/0HkffRsv/bUApDgYndgn3iKd44ecz0gbueBp2+lIWyrI7qjT/8Nb2VzS7Jmnuh lcfY2rEyWK8WMdkbuqn27I65ctiFjjU3eAjmJ2ZPGFxMLI9okkZQPxqZeGWijTVoWHGr vwuOCnnYeuLednfxyx0i4CIqB9wQ51Yjv3MACizXTrUaGe0mNek94GNghRitXx52DNOs VEvkYGpFVNR6a82f5CSA/C7Ch/1Fp6GjbvCHC9MB4GwuTIZSvUdilkIf0QZBwyEDtHXK BIJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eaVEqL4d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w19si761416qkj.333.2019.10.25.00.01.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Oct 2019 00:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eaVEqL4d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtbe-00048x-1v for patch@linaro.org; Fri, 25 Oct 2019 03:01:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36907) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNtMr-0007l9-D9 for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNtMp-00037q-NI for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:36 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37501) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNtMp-00037C-GT for qemu-devel@nongnu.org; Fri, 25 Oct 2019 02:46:35 -0400 Received: by mail-wr1-x430.google.com with SMTP id e11so947858wrv.4 for ; Thu, 24 Oct 2019 23:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a+CNlZHOsvnPAzo+1k2Dke9GSSUrs8d4XRw46Zp2gXU=; b=eaVEqL4dgXXp0wqHt21xpcwDfEqgH6Wc8jxwn2b1RM2bQ9mGZakHuwEJaiK3lkeBBd ljJ9epTY7OvH/NDMmP/hDld0Yt2ZNr9pkRVKP1K47BFn273Kpqa5EyJKWG7Vz4E8aAXh Wci5e1Ng8M0EKVP6BcddPxpGGq+PUACrZ/V15Y6VVfzg/hc0T5z0NvWL6ZPWhMvNJGyd mqKrYNDaoCyWgCevr2w3rjOmq48mUhdth50v5myfoLKZxLdL/mRRLG8gD7HqiJowwgHR 9BMoIe6Dj/2tBfbYgPuhmqDr47QO5xIh5+NJ5ZRbrGXZLPEePBatswaX/ndEP2QXID/3 EaPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a+CNlZHOsvnPAzo+1k2Dke9GSSUrs8d4XRw46Zp2gXU=; b=OLSQcZbllcGn9b8yHhWZiD1kRZqV0sOx5/gV4rbdjtWV7EkMVNQb/7O3seG/XVRadz OMVig/BFxScCZ3EPH6GuP7gK+g3uBbwnKKo73hSLwVk1B+EO8E0pMaGfohKDk+oqp9xv /kRByZPBeOHmGLI3JvlrVOcBA49gyN99Lm4vZCmKtKfWhyKHRYMrG37Q14hVmq5Jyj57 z/DuLFe8UsjM+FLS8eadK9CU/ONLIfU6L8z0yisUzsiSTGpJIEPn+87k3gj5bpp6WWsm DgN4m0eP08XScFSP4aQVbBenxRvmT8a5ce94Lefjkz3Rxfx1tbfk8yY2fwYfUT8K8b4M WFjw== X-Gm-Message-State: APjAAAWRLO6SUMpXwhc+RnbJWhj9Khp9gYTuQeM/805BEs7jLANxgdXh 5GUvBNcrwbvstfcwnuMCyPorEQ== X-Received: by 2002:a5d:498e:: with SMTP id r14mr1279313wrq.36.1571985993857; Thu, 24 Oct 2019 23:46:33 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id w8sm1779491wrr.44.2019.10.24.23.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 23:46:33 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 918D11FFAA; Fri, 25 Oct 2019 07:37:15 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v2 20/73] translate-all: use cpu_in_exclusive_work_context() in tb_flush Date: Fri, 25 Oct 2019 07:36:20 +0100 Message-Id: <20191025063713.23374-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191025063713.23374-1-alex.bennee@linaro.org> References: <20191025063713.23374-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , qemu-devel@nongnu.org, "Emilio G. Cota" , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" tb_flush will be called by the plugin module from a safe work environment. Prepare for that. Suggested-by: Alex Bennée Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 66d4bc4341a..0a08fcda3e8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1268,8 +1268,13 @@ void tb_flush(CPUState *cpu) { if (tcg_enabled()) { unsigned tb_flush_count = atomic_mb_read(&tb_ctx.tb_flush_count); - async_safe_run_on_cpu(cpu, do_tb_flush, - RUN_ON_CPU_HOST_INT(tb_flush_count)); + + if (cpu_in_exclusive_context(cpu)) { + do_tb_flush(cpu, RUN_ON_CPU_HOST_INT(tb_flush_count)); + } else { + async_safe_run_on_cpu(cpu, do_tb_flush, + RUN_ON_CPU_HOST_INT(tb_flush_count)); + } } }