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: 176605 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp917888ill; Thu, 17 Oct 2019 06:21:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqymO2w9qJ5QxQO2LHQpt6L7xiUVRqR4asUQ8VTBCdbrV/bSL2RjtXpvbnIzUJYj6TIMyRL6 X-Received: by 2002:aed:30c6:: with SMTP id 64mr3619751qtf.91.1571318464099; Thu, 17 Oct 2019 06:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571318464; cv=none; d=google.com; s=arc-20160816; b=e/t0MUIaxlc0kFy++oOJJ9+oHegUE4uhvzY5xDCoZ6T8OvqzoNPEakzMU9zJixd8g0 V2z3Y/7vbwYjc1HWNP/O5MxRldwlAp1D06b9RkBC8mS7tmKawLwzswWjpKFjW8Vyh6kn lKf9o7GMgUZKXRhGftAYzOPOMk0cE0kyDkrSGHHD5IfHD3QpNSEPOeZ85IZ/X3qUrT7Z 8HmB5rGYsFH3kHDiQGZw5YICigYFBu05x5br76xbNJduCJHCzBq9r07e+9xa0cr8wl2D RqD9eXOctNmHn1vfaf5CxxX69Y8ra+NbO6lOTv2rmHSdWA1H5eq2T3FoH5uTCDhvs+HA mwBQ== 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=jl7CYODQt8OnuvIgp2XTk2g8rCG4V8KuyWDrLSftFD95KucSR5Qps1aPs50sRre/v5 6K2mq/FoSblKHpi8Fg2gJEIBSqwFVLECBZR1ehP6krkwURGnEmzYaHPqaE44NxrLeoss FrD8q3j+J6X3+WQeQ2fZZHhkXnflSXnFMCCy0hyr6e8FMHZ1VlLsWSk/jHQspbvqT9Of iRt3HohNEznZAwnzZCSJJIE61EHTAqlkSd60JUSoX3Z0OUEvBK6uYsFaoijm+8fiif1b hYE9Gl8k8sSkRiWauxC2Hs55F2v9K/oBlhhP1b+eQ15FzOZ5ySOJRtj2QndCc/3OkSjx P+sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=YzbmAveP; 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 p20si2000770qtu.245.2019.10.17.06.21.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 06:21:04 -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=YzbmAveP; 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]:47216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iL5iB-0003hH-1n for patch@linaro.org; Thu, 17 Oct 2019 09:21:03 -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-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+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)); + } } }