From patchwork Wed Jul 31 16:06:35 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: 11068609 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FD82746 for ; Wed, 31 Jul 2019 16:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D05F204FA for ; Wed, 31 Jul 2019 16:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7172622ADC; Wed, 31 Jul 2019 16:13:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 25194204FB for ; Wed, 31 Jul 2019 16:13:42 +0000 (UTC) Received: from localhost ([::1]:42394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsrET-0003D9-Gy for patchwork-qemu-devel@patchwork.kernel.org; Wed, 31 Jul 2019 12:13:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40372) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsr8h-00027q-G8 for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:07:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsr8e-0000kw-Rw for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:07:43 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:38113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hsr8e-0000ed-CP for qemu-devel@nongnu.org; Wed, 31 Jul 2019 12:07:40 -0400 Received: by mail-wm1-x342.google.com with SMTP id s15so38988665wmj.3 for ; Wed, 31 Jul 2019 09:07:27 -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=x7RGFDz62fM8+46VM8mYT+u7ako6VpEUPrNMjeMtALg=; b=rZ3qN8oqK9kJSDDW+QP2nyYQA6VsxAb55XFQtHdMPASlLfsdHxWIySIwZBiwYf5svf r7CugMnDuw1kLmx7QxXbiyHvQJBNb9Wg1BCYV8FrF2JGSZDtqKD9nvQG/Uq419ps4M8f hT/z3eVaBF3Kst6oBnZZYv6m0EK0DNBaDtOGvB8TzAbHh476EDHlwNRW/jpo1sTPIsTm agyxPPA+RQsHQSCFGQ1tzR6A2LYlIeRjoPnE5zbEx8T23S/nOHI0JUrFEJNr8U2wZDw8 x5Z1NBeX6N5j075VIrQwopKDbiGg0gg2T4z8XvqHK0M9sXBZ8MlsJnWEUie13qTFWGZf yTFw== 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=x7RGFDz62fM8+46VM8mYT+u7ako6VpEUPrNMjeMtALg=; b=IftYZD444X+3kafTxLcnfNRUsb/6lWxlWz6nZWblULDCrzJXlXtfR/qwqaLp+th7rU PCanA5qHAQY0TezNzcBOctGQeCXilOv5p9e7La9wyr1fdsKvz64VWONctUc5+Oo2X6hH Jl5aVou0ZE8094oDy3nJaJn6iStej/7tRUXrR0oo6C+DmZUIP1rK37W4ccojz4RnHbvt jSk2O0drZARb+mC335iLBhmcgoz15FOS0QxGWWmG4eFlXYYn7w1CFZJL8m2ZuCiIeHmC /83uekqKRdhWz53WUnZjDwpLMjLmYGqYbA9nxOVD8koQAmHXsNLnVN+Prd2l6IvoLjbb BIuw== X-Gm-Message-State: APjAAAXO2EsqMaQjHLzP9GPTmuWS96YGVesIRVHoerxEaKWNp9jwVMdZ J7VCycgrRq2mKdkjiQRi0DkIRw== X-Google-Smtp-Source: APXvYqwjUsp1IVBy6xrCqi1tVXrWJVCUtSduOhHwQ7RF1c+nNgCjnBVPanLhuaU8ryQy+a5kRuIkhw== X-Received: by 2002:a05:600c:20c3:: with SMTP id y3mr114925235wmm.3.1564589246646; Wed, 31 Jul 2019 09:07:26 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g8sm68930589wmf.17.2019.07.31.09.07.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 09:07:23 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5D11B1FF9A; Wed, 31 Jul 2019 17:07:20 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 17:06:35 +0100 Message-Id: <20190731160719.11396-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190731160719.11396-1-alex.bennee@linaro.org> References: <20190731160719.11396-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::342 Subject: [Qemu-devel] [PATCH v4 10/54] translate-all: use cpu_in_exclusive_work_context() in tb_flush 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: aaron@os.amperecomputing.com, cota@braap.org, Paolo Bonzini , bobby.prani@gmail.com, =?utf-8?q?Alex_?= =?utf-8?q?Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- accel/tcg/translate-all.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5d1e08b1699..9c5c60ed964 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)); + } } }