From patchwork Mon Jul 19 21:22:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 480057 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4507383jao; Mon, 19 Jul 2021 14:29:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTTN+P6aBw76MqIuZxnwud579nbdG10g8b60LSSdkjVDEmPyQHRUo/2zg4cHYkL281RRBX X-Received: by 2002:ac8:5b83:: with SMTP id a3mr980693qta.210.1626730144607; Mon, 19 Jul 2021 14:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626730144; cv=none; d=google.com; s=arc-20160816; b=FSGDmtUI19WhuHm2r0b6hhQ2FoAOkrWaEbvcEINB+RmKBaVYil1Y24wBj/2XrPMt1g +cKjpqa7BeOALQMijMhyV4O/WM5QxZiovtnPeoq4rDz+Q9zKxVMZOLceLsZHo9/pnbJY JzJNLM1WrxcoOhLsFTwkEdPU92jfvrwsHJ1NnCevMA9KoKA/EgcK1d26lPPe+gcd8cxQ +wdPw35WVfcBhN+UUhsJeIvhq7OQhzBLj1LTb4sPfQx8nGTcIlSpFNG8OlXWcrYmj0za xzN+08k0q3rLZD2aGKQM4JBEe+bel0Fp3gGyVI0RmgZlD0ONn1mRz7JAs0VlcjsHvHGo 4FPQ== 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=UqlmS05MkTOxmP5dwcL3fhQ/lw1WJjbK9e+xb00mPGM=; b=l5w6Tp3F3Y/yhdqgwVZrbIu1l46I7Ya/4d7L+VErEVIrjNS+Dt7KT9s4NKcIFb6L3F DhOT6ML5pbomBp2wzFdKLVRPJRd0JFYHgF9dDUTQ3KJSEv/PA6DF22lXjSLEPVWH0hUa tkPPG9HHRaTjtEWsibVELpIa2kT3CxS5mzg+v9fZhlHbDe0Jh4sb/dB/yj0BSvwlXuuW ta9olJWWw71RAKDgKyPGjyjrZeKm036Ai6hP1nOOQzjBdJUzOQoGOFbv/2/wBbu1iaWU NTDJTQ9ovg3BySV0VTHhFaaFbTuK6tJDsSJVvMtFdAhKrykMSYmFkdIYqvvQq+wtH8qT 37Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=XWA9z9KN; 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 p17si15518449qvi.138.2021.07.19.14.29.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Jul 2021 14:29: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=XWA9z9KN; 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]:43026 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5aoy-0002kS-26 for patch@linaro.org; Mon, 19 Jul 2021 17:29:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5aj1-00047R-Qr for qemu-devel@nongnu.org; Mon, 19 Jul 2021 17:22:55 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]:34612) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5aj0-0000qT-9r for qemu-devel@nongnu.org; Mon, 19 Jul 2021 17:22:55 -0400 Received: by mail-pl1-x62e.google.com with SMTP id b2so5800622plx.1 for ; Mon, 19 Jul 2021 14:22:53 -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=UqlmS05MkTOxmP5dwcL3fhQ/lw1WJjbK9e+xb00mPGM=; b=XWA9z9KNqiimWGdfnOcrMx6pjVsVpcKmWLhUIYFxSUQ44WxWh0oXKwLCjbNMUxphIO VIzAbgH+608Hlxa28tiHl5r/WZO1ipJ53vFaHNRtxhghCGCzaH6nV4ODu5VQbRRjgT3q 2xj4uEzTnllMP7wdY1XgEruPpmvb6cUbalAeEtnIu51vE5GeFjjpV87qBi5k0/rkYADr ZzEHAHA1D7Cjfs5LZ8EfBrf8el0K5GUIHZTJUfvHmQHmnuzq+EdEkpmw7hYmeCRFYalC nExjxRjM0d7DqA835gVXS+ltB17Egb6gJ+/bOBtnL3luHuWGQNv9gJuCW4pJDpN+Td6d lyug== 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=UqlmS05MkTOxmP5dwcL3fhQ/lw1WJjbK9e+xb00mPGM=; b=tHt1wO2DNuBNJd6EdHEH8+DqA4fP+4lZqMpFgRdcIROgGebhFP80xmArf3jEMaGlo8 lJ7jZp6bYzpH8E4Nfw7zmOXa3FrmshdodvrM5T4mJdO2k3Qq0cWAeX1XMXrTDe2dUxL5 mHAPFpdEPOdVYIWgeCbs+E2O2B38r0FIARwRtTEQOFoOo0xb2MDESyfPudRhZ+kIdwJA gJGCtpc0vUKnvtn7jp2KgIJ+yLIcQLvyu2BemWXKMDEmheFcKFyvl5bc1hytSVTBn3gp g+uMIBsg1KP20vUXLt2xu0nq0/rjJJgtrLPpttt8assqh4CPpoCLmjms0hBz8dP1bPl1 FFvQ== X-Gm-Message-State: AOAM533I30b2FZU0rEkocoZQvNincIhgjj+EoMNwMSkVXUnmjcoZI4nl 2VpngwSpw9pcOBmr2dE/OH5iVnBDL/5jxg== X-Received: by 2002:a17:90a:b78d:: with SMTP id m13mr21219354pjr.60.1626729773068; Mon, 19 Jul 2021 14:22:53 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id e4sm25008434pgi.94.2021.07.19.14.22.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jul 2021 14:22:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH for-6.1 v4 07/15] accel/tcg: Use CF_NO_GOTO_{TB, PTR} in cpu_exec_step_atomic Date: Mon, 19 Jul 2021 11:22:31 -1000 Message-Id: <20210719212239.428740-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210719212239.428740-1-richard.henderson@linaro.org> References: <20210719212239.428740-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, f4bug@amsat.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Request that the one TB returns immediately, so that we release the exclusive lock as soon as possible. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée Message-Id: <20210717221851.2124573-7-richard.henderson@linaro.org> --- accel/tcg/cpu-exec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 2206c463f5..5bb099174f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -330,8 +330,7 @@ void cpu_exec_step_atomic(CPUState *cpu) CPUArchState *env = (CPUArchState *)cpu->env_ptr; TranslationBlock *tb; target_ulong cs_base, pc; - uint32_t flags; - uint32_t cflags = (curr_cflags(cpu) & ~CF_PARALLEL) | 1; + uint32_t flags, cflags; int tb_exit; if (sigsetjmp(cpu->jmp_env, 0) == 0) { @@ -341,8 +340,14 @@ void cpu_exec_step_atomic(CPUState *cpu) cpu->running = true; cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - tb = tb_lookup(cpu, pc, cs_base, flags, cflags); + cflags = curr_cflags(cpu); + /* Execute in a serial context. */ + cflags &= ~CF_PARALLEL; + /* After 1 insn, return and release the exclusive lock. */ + cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | 1; + + tb = tb_lookup(cpu, pc, cs_base, flags, cflags); if (tb == NULL) { mmap_lock(); tb = tb_gen_code(cpu, pc, cs_base, flags, cflags);