From patchwork Wed Jul 21 19:59:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 483334 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6523558jao; Wed, 21 Jul 2021 13:12:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/RZ3FJj5eopxmUyK+kh2OPoVm826TOCN46QgUiS3L3dSrnCmdI2l+Mbk7D5I/U7FY26SF X-Received: by 2002:a02:7348:: with SMTP id a8mr32233041jae.116.1626898326456; Wed, 21 Jul 2021 13:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626898326; cv=none; d=google.com; s=arc-20160816; b=fOXutHqldpgdQkSl10WtnZwj3UyAQxah1Kfn6LhV1gbd5PfiUBgo381Doz6P40nT53 sADNmQizQ4NTh0xzt/qAxw8FdeHiZKHwtphtqo+Xv5TIGYlcrKnPDE8XSKR8Bp9tG2uh X3gcG8Kkgq22AF1TnstYmvzOTGo3MgB4b9Rb+5eUAn6SDj4WPnc/Gr4Qi4Ffd+8y+FmG QI18hN1njV4FFwdtrE8d1XDeRx+x12BgRvCoytscHB/4sdnl8WGkRpViXIWVpTYQ12jG rcw17z5toHQCrfUTFxhRfOIgndC6eEKTB0Dx+gxINLJ58i8SyaGp8zSZ5XZaT55YodFz WbeQ== 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=DTRTI80fORwFOs4KxX5hNUbj/Raa40Oboxi0GCzL6jg=; b=gGfZnfw+66zCGP64xAXmdsPkrw2Qq74jR3Y8Pv+QU41C1wXjEm6wJ9c8+JPBJzdWzP DHw9zzo6hwT7b3w9ET9oIFceifPcEODhpgahnr6z2FxEwxFbBRHFWa6n2jfGgjeAfEOx Yr6PHG62TKvsURcgPqpNGuDfwqXVimmfpUWSYNngMBz8eu5Xpl2m/7HfKhBvX+FUjNQb vGHn1fCVUSP3stfbvZoCiUEp1dm6OsHozT24foqcNe4HdrRQYhdmiIwVOvX7K02puIlk JPF6t3/aoxum4l0iDTkHfVM7ovgoMzHpSEXNwcOBRcb5r+GeMcz6456s8Ftsw26lbstb 1MFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HRGQvmYb; 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 5si16893141iof.82.2021.07.21.13.12.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Jul 2021 13:12:06 -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=HRGQvmYb; 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]:55154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6IZZ-0000gJ-SJ for patch@linaro.org; Wed, 21 Jul 2021 16:12:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6IOK-0002xw-Pf for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:30 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:44777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6IOF-0005pG-PI for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:27 -0400 Received: by mail-pj1-x1032.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so1946840pjo.3 for ; Wed, 21 Jul 2021 13:00:21 -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=DTRTI80fORwFOs4KxX5hNUbj/Raa40Oboxi0GCzL6jg=; b=HRGQvmYb2ufbGkQNPGQcalNkkVMKGqcVe7qJfMeWegTcJi7pcGrUd5ifY8nXRQ+kM+ E+3mBDI13njMlKWXGFJcDgRykTDCSk0O4ADn1n+4oKQrt+TBNL5j4Z/+1mcjQeb5vQht L6S/5WcibK0aJ4esHcY1HvXToFnX6rp7Ce2paIyA+DFgRPlBu0OMDZ7mfpipE7nKQGek K807GdEqDNN6Chq4bDVwpx8oTzQLysMgLFD4etIE5zaPLWqV0yf6WllHPo/BgOJQ9RKH /nhzdJ8aQMSSCaDqphc/WI2nRi4Xu50YoDUrxw7b2HtdoPoTN3ahil48rUGAKWYcJl0X IJHg== 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=DTRTI80fORwFOs4KxX5hNUbj/Raa40Oboxi0GCzL6jg=; b=jYandqUvoPFm51C4GPbtjkWwV24vq+XGtIA9Y5vzdEbtKDsqLE9GXd0vvkqdkd/Ltu g4aBy3LPf0qG5YR+nif8QdOmA+B1DXttIP7Q7HV7HasAaAmKjy7kZLwvmppRkyL3EEXk WrY7MCLG9HGWzy9xFn3eshSnjqdag49/g+Vj+VRK2/sov+wm+C1BTpcgauixyAmdi7gm B9QIT+ovjT2Q7QGsphpeJQ/5SVqqeaDEn1OuSRw5SUt8XVjwWDx8ouzOAmx4KxN+1hiD 5wGef81OyuO7s9hZxPqOK+txZtUkMvVcW2bM0AeXTw0+QwaFIgIPpbdUbHINej78NWB0 lh1Q== X-Gm-Message-State: AOAM533xkGNC/Qrr6MyZr2yWoFY09l0niR1HYTV7R0lQD5V0wxIYfPmC rrHHhCN1VLdDCOOC3f9PonnkneeJEKoYYA== X-Received: by 2002:a62:1c14:0:b029:34a:70f5:40da with SMTP id c20-20020a621c140000b029034a70f540damr16118993pfc.37.1626897620403; Wed, 21 Jul 2021 13:00:20 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id w3sm706028pjq.12.2021.07.21.13.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 13:00:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 17/27] accel/tcg: Use CF_NO_GOTO_{TB, PTR} in cpu_exec_step_atomic Date: Wed, 21 Jul 2021 09:59:44 -1000 Message-Id: <20210721195954.879535-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721195954.879535-1-richard.henderson@linaro.org> References: <20210721195954.879535-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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: =?utf-8?q?Alex_Benn=C3=A9e?= , peter.maydell@linaro.org, Mark Cave-Ayland 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. Tested-by: Mark Cave-Ayland 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);