From patchwork Fri Jun 14 17:11:14 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: 166858 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2346300ilk; Fri, 14 Jun 2019 10:48:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2pj9/aUu657D+uZ1SkKQBANl3NJEsBewmJMx8619bxh8S9SG9Rqhb5hCeHwlXAWchagBT X-Received: by 2002:a37:de13:: with SMTP id h19mr6553818qkj.59.1560534504012; Fri, 14 Jun 2019 10:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560534504; cv=none; d=google.com; s=arc-20160816; b=ON+3O6+x9/WBwRsVOIyUJZI9SDSxtATg9EUWgHmlnysCHZue3trhlBbK8PuUMDmxG1 T7qZge2fI6iyfvFN4dLj7q7QJCDpYKJv1f/zn89uheP6mdDD++x4t6JjijZ0p/ZKdcMP fyyQ2UnxafP0G8dYLCh7haYFlU+pQiU2NOpxPU+Pth4ZNIRtDGyZf3BJQ7Ru1RCsMPuU s3BJ4v0dYoOCOFFHei4KAkIaADiiYvpjyP/tLtngPSOhPAOIrQ0QfFzIrRPo+bUtvlFV mwFRiwh61U8geIArd1Jf32XLAh1WW9tRykN01LGsJm5ukjDPph5E7jh2L0WgEHeNGNny 8mvw== 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:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=08HscLjvD+PkgROa+8EpI2roPOdpCcPPJ5uFR5Az32c=; b=cf3olnfOE+XMnja3/4eIjt4r6Q0JXAMGnvIV6cqbnImcjQxtPruQ6zaMXR/qxemfmD 72XX8KLk4EUkI19uysjcHZ3+VmekmFVszaJfo8ujWUZpA5Qpyzq6jkVJkCzlKm/6JbRe rd/gAovLFuOmEtYVYDZnBunwe4ln2drfta3C3mre4KH5ZOH9vNPEkw42SQOVyg1mA9iK Y/zL/5YCFzR9Vxaf9A57PhgxjHdsR6D1rKVMR762pQv6rKYTsvdVVCtNYOddcACH7ECF Y0W3ozjvWGMcaHocP8jHOMqddRHXzwOBYCgOOGnYSfg15w2EPytzRC1gcuQGX1OwjvM4 SUJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ky7YLsxA; 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 h40si2280406qta.172.2019.06.14.10.48.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Jun 2019 10:48:24 -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=ky7YLsxA; 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]:53876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbqJL-0004FV-J0 for patch@linaro.org; Fri, 14 Jun 2019 13:48:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55918) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbpkF-0000T5-EM for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:12:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbpkE-0002xY-6p for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:12:07 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:40671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbpkD-0002wC-TO for qemu-devel@nongnu.org; Fri, 14 Jun 2019 13:12:06 -0400 Received: by mail-wm1-x344.google.com with SMTP id v19so3033768wmj.5 for ; Fri, 14 Jun 2019 10:12:05 -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=08HscLjvD+PkgROa+8EpI2roPOdpCcPPJ5uFR5Az32c=; b=ky7YLsxAcIiyof1matNxkkgrxHSdO/GiNDxXq3/tXUK6IyZU0XmeR6eE3mig9pHNo7 diWt4nPa2NBfaM1SJ2jWGulR1Z2nwHQPV0mS+BdsO6bsbj43J1eSe2xCLbcc47sH1kwD M5995shcL2u81R+8bJTOLTAKNBkvEwy8Z/5e1ygRx+oS+B9m1pIy5EvnWtuCXrhKimL5 L4YWyJKjQccSccDp8JOrD5ziODbolvbP/YrTdEZzP7buw6yiUTu9XpAdyuU+FkIhs6Sf CWdOovEwRt+aPW//tsu3758borr74wZ+0jtNw5lDCNrpDgxrzqz4CVCgXmdkWHNqLBmt gmjA== 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=08HscLjvD+PkgROa+8EpI2roPOdpCcPPJ5uFR5Az32c=; b=ExJ2tuozlf0QED8fWnyXFVqW2YW1JqsUsS9nvslfGJHV9Ezuleq3UJZRlRCJ7EPgSY 2R7BvTHVShQAna5bEM77ArvDGHU4wKPKs91XRwvwWlNdOfwRiW1qcLyLkg33FF4mIz40 7rYzgSy1rAu3mEvMmRsMCxsqZJKs4dwfSDB/ehimYzCL1FbS1mXS1nwZ7T1st1d/IYQb T6LVkgpicWbfLp0I9O8NomZPR/zOM+YHiYJ5xVjcMiBEWmIQjwy3QH0uEKdGXByIclHC lv4i24eFOZoCY4EXdppsGvwDoWopzLhFlK7uR5dj/6ziyzvFHsb/OVNEpmc/05WLpEMC 9aZQ== X-Gm-Message-State: APjAAAV34E5jAulARggNoi/VXdIANGbRO76ar0XI2+XBj7haoI58tKaR F3xmrfeL6ZUosFPA8/34x76WW48s0uk= X-Received: by 2002:a1c:305:: with SMTP id 5mr9092711wmd.101.1560532324399; Fri, 14 Jun 2019 10:12:04 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b14sm4225685wro.5.2019.06.14.10.12.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 10:12:02 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BFFB11FF91; Fri, 14 Jun 2019 18:12:00 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Fri, 14 Jun 2019 18:11:14 +0100 Message-Id: <20190614171200.21078-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190614171200.21078-1-alex.bennee@linaro.org> References: <20190614171200.21078-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::344 Subject: [Qemu-devel] [PATCH v3 04/50] 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: Paolo Bonzini , "Emilio G. Cota" , =?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 --- 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 5d1e08b169..54998e39c6 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_work_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)); + } } }