From patchwork Thu Oct 17 13:15:25 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: 11195921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6CFB14DB for ; Thu, 17 Oct 2019 13:21:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACC5D20869 for ; Thu, 17 Oct 2019 13:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YzbmAveP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACC5D20869 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5j2-0005aZ-FH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 17 Oct 2019 09:21:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33844) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5df-0007zL-1P for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iL5dd-0005Mv-Qc for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:22 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45312) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iL5dd-0005J0-KX for qemu-devel@nongnu.org; Thu, 17 Oct 2019 09:16:21 -0400 Received: by mail-wr1-x443.google.com with SMTP id r5so2287223wrm.12 for ; Thu, 17 Oct 2019 06:16:20 -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=YzbmAveP3kH7nfi1Fd1MCw5P8sEtLkh9oaa0FdIsIlgTJpxxai+H+uusU5scFJbqVJ IuO2sBK3Q3/T1zq+kSSJ+nnxHcQvZHv7GSO1dNcv3MLIDqFe9zbIWTzAMT+FQIBn4WCR mu7CgkOxp8KQmK/pBhq3rirs1AEtQ87YUFhWg+cQM4LdCkAUrpsS7qe1AxkKHWQnr46s YHBSP4r0jlmDndyRHHjvu+Co7eFTuStk79rHh7wwdbYB80c/zDTsVN0URPuszI7exnWy B+MQU9Tdv3AGcfn8m9t165hNc3G7UYdFvWg5vRh/GYoDdT4UlInoJD3TBbWEVvxtYgA0 wuIg== 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=WvyPJh/LCi7wBjZl8zoE6Ye7aSZjwSy5TdmWX0sf67bZisUlT7E0+7SdTZv3r99SnC aVUY/skNtqMF5KXnOcOxekBV+x+vR9SFL3ioERnVI3DaaOT8/QdkQQ6DbluBG0ZFv9AV +95JiV6qv8LlHroAOisb8zWd0CHIHB/fTJn9D2tMY3UeqVc71kzT6y83yTaFumLBsaNl Cgo35fBiOb8UtVOhIK/8eCDNJRWw7P8vHRzNx8HhRQZGynhptQcGBJwW1Onw6cqiVKEK LtURgUHKSLTI6Z7pz+1iU9jZ0CQEdxyJRANDQRFd2QUqhFSMXtTf0RaZ48tctFR1KEIZ 5Nzw== X-Gm-Message-State: APjAAAWK0pzFn8qrca7Q/sFGwdXINnrIQXUqXf0eY2532kEve88sJU6J 38jZBcZW4JrK9bJzsJSjiy8w2Q== X-Google-Smtp-Source: APXvYqzvScam17OEllCAM0H3PFsvZMFcjf5pnkMDAKp97HCLjvz0oDvgbC/67fpQFdDWEQsyjKnMVw== X-Received: by 2002:adf:e74b:: with SMTP id c11mr2905615wrn.250.1571318179027; Thu, 17 Oct 2019 06:16:19 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r65sm2215123wmr.9.2019.10.17.06.16.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 06:16:17 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2F0BA1FF91; Thu, 17 Oct 2019 14:16:16 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v6 04/54] translate-all: use cpu_in_exclusive_work_context() in tb_flush Date: Thu, 17 Oct 2019 14:15:25 +0100 Message-Id: <20191017131615.19660-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191017131615.19660-1-alex.bennee@linaro.org> References: <20191017131615.19660-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::443 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+patchwork-qemu-devel=patchwork.kernel.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(-) 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)); + } } }