From patchwork Mon Oct 14 10:48:57 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: 176142 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4340310ill; Mon, 14 Oct 2019 03:51:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxLBbzI1/GEOQm/8TkF1DphWF3896P5LtgiehQflYABCXdhhimQdSHZ4qcjnjFBVJm+xX4 X-Received: by 2002:a05:6402:149a:: with SMTP id e26mr27356292edv.123.1571050313524; Mon, 14 Oct 2019 03:51:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571050313; cv=none; d=google.com; s=arc-20160816; b=SOC16tTG/aS7jSwKAlMctXZGCxwxfxvCwG9ZNmAtGuoSl4sln0JlzTOyfN0ERLO4Kd uem8LEBWCVBsDP1xq4mHwT/DoibEx+5yLXDTWYAiuVrwsbCk7hkR/KWL9IjfPc/mKPRl aY6r3nZdQjD3O2rxht7OgtbYjSB7GvuAykNZg7ia93MVXLPwNtGQeIfGLspfyPn+EYyu k1FapykyW6Ljh2db8EAGmdzGBHgxgzZRGC9RiQA7kyRLB1HBwe7RQ70zu2wFODBcAhx6 jKrAeLyGgp8nGFOncvIkirysxy0eGW9AZlmg6V1n8PDj31KT7eT11gwOVR4mdBqhUaVV wZ7g== 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=TcDnMTCbqc+SMPI8ZRIhg2t2SAwRlKS9dBsRR316T8M=; b=UcRVqWaQY44H/rouRn6j6NatVRAfTSNQ+ZuEreQsbYe1FYR3Q32dbFZOw+Xv17rDM/ QMXFikpegLBBdfE7/YARHB1q2QhoN0p9/vVyXeS4Lh1UkGX6/M5hN7SIv3cAUbl8w0Dm pYvshwhUeMd40H0o05wB5KG5AwXIutyofg2w58jZc5obl4TukWtkDEsqBtOzHckBE43A e2FZ6RijjZUjjYk8kpSkFcePgWg8dAYSpNU26PiOo07V/AXhFMeJ0S8JzEWx7fn4xOZs GsgINYF2TP7bYzyOyuccSJP0HlInHUpZYdJ2UT5ZlwxY447tkjIfmcyZBqvWZ1N1/Oya wayw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VnTpB8sq; 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 z11si12274664edl.1.2019.10.14.03.51.53 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Oct 2019 03:51:53 -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=VnTpB8sq; 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]:46814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJxxA-0007K9-2k for patch@linaro.org; Mon, 14 Oct 2019 06:51:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJxvF-0007JD-Ud for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:49:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJxvE-0005vX-VA for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:49:53 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:34538) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJxvE-0005uk-P9 for qemu-devel@nongnu.org; Mon, 14 Oct 2019 06:49:52 -0400 Received: by mail-wr1-x442.google.com with SMTP id j11so19161269wrp.1 for ; Mon, 14 Oct 2019 03:49:52 -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=TcDnMTCbqc+SMPI8ZRIhg2t2SAwRlKS9dBsRR316T8M=; b=VnTpB8sqXBvIvtF5yjTZvEcpflNYrKJhxc8WiUTIuCs8QgtlYbp8+ETdtBf/aZlmxg KPsKx7HgK4Z43ZdttNWYoSw1VYD3zXAmBNEiW/ujR+v4yrAikRnN46I7de3L4nIgF5Dd jMi2VmkthDwbumSM99z+14a7D8QKrnqlyC6HC+piA2a99bdaIgb7LgchgrjoTAnMqgm1 EROzAamFa1HdKpc03SdazTJrKbxbZiw2cf0N0woa4MX7vADSAwF8FwWHohyNhphSLUgH sowYJ5ugpwDqv/NRVufeiL0EklUJfbbsdVTDW9VKZfrSjRpfxFKucsUQyV3v16zUa+lj HS9g== 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=TcDnMTCbqc+SMPI8ZRIhg2t2SAwRlKS9dBsRR316T8M=; b=brQ5rztqUgVA2CmiZ4lhPW41ipVLBKD+jpTIUc3mDFMVX7iACChvzDFYzyLk5sAh23 fPh9oP5R5uUMjD1Q5csCYBAwi9CuQhSPQ6yBPGCFlHkuv8D4GRj/K0vELAj/Q0ChYy3U SIFSUdXpsCvmXGd6Cg1UxGtafKAZIY5Domzy57zat6e3zmXDune4zwxmT7EJPdXn0gWY 3gPr2YCivTWM3WKf7/g5vAsvrBhIUg3MW1chM7d2kpvnOLLnPG5IjNpw7wIQW5TKGB45 ZSghCnYU9Ln4wmUYa8wWgrwFApfCgwEnEdVDaECuV8d4Crmt+gAoxIOYRhdCjMMoWRSm KrVg== X-Gm-Message-State: APjAAAVLFPo7d+hGrzPSbJwM5Y7au2bMktmxBP5O+7G/AMuTvHXSF80K i6nBeOJNf1FT2hUEU7GO6SJ+pw== X-Received: by 2002:adf:ee82:: with SMTP id b2mr24823864wro.285.1571050191698; Mon, 14 Oct 2019 03:49:51 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id t203sm21013915wmf.42.2019.10.14.03.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 03:49:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E5EDD1FF91; Mon, 14 Oct 2019 11:49:49 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v5 04/55] translate-all: use cpu_in_exclusive_work_context() in tb_flush Date: Mon, 14 Oct 2019 11:48:57 +0100 Message-Id: <20191014104948.4291-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014104948.4291-1-alex.bennee@linaro.org> References: <20191014104948.4291-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::442 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: robert.foley@futurewei.com, Richard Henderson , peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, 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 --- accel/tcg/translate-all.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 66d4bc4341..0a08fcda3e 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)); + } } }