From patchwork Thu Jul 1 15:25:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469105 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp500329jao; Thu, 1 Jul 2021 08:31:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqo2vGBG/WJCSwD12qsFEyjHXvaz/BGXZOtbxRhciTXXYpNdrw1A3q1puhxHA5ZUHJGaCB X-Received: by 2002:a17:906:6b90:: with SMTP id l16mr402505ejr.439.1625153502339; Thu, 01 Jul 2021 08:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625153502; cv=none; d=google.com; s=arc-20160816; b=X0ddeeSYfAYM5erRzH5+kQTMEb2qbn/kG43juBEaJxoiBCMk3tjBf1GeeCcU/vMq0I pC1N9kSmCNZ9nccbE1/QUZk3tkLhYNiAt5jPuj26Z7bS/8SUDssMF5jj9Zx/pyVkkJEn r6NBf0oiitfJbOMTq/GSwsU862tPbfsfP5YTM8oxMv+fsVgHHfw+PUUNWClzKLSwESaw Rc4+oOAIhXEv99SCp7EPalM+Fo1ZcY/eU098e8Ga3tTZ/KF6/aoSq+wQQX/thBSZhMIc DdKZZooLJVoFIITU1qifNd5qcJ2O4A8NaOAWYdwaOYMYV4N2vawA47P8XTuhwHZYZBIR 6sLg== 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=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=il7tBMoH7e4lo0SlUhsw63rZJY80ss2PpaMJB2WjgezDqbN2OCkuaCl1GapthM4ryr j2V21+bOFT0WZ6EJqaQtfnyhFoyT37vrLd/jrl2tAw9QEUCqnENwVbwUME6qnztZRpXp /IcbPsfomVf5mJZWYzpHcYqSuqFblpd8vEkoYgapHSrmsBqo8P9rDpf4weO+a12gJE9u a/+zEKBKua6W0DNpKlydMGw+y4sOU2ex+RxP1qJC99w2gT0JYYplny1DwbSwDDVqmtGm sDgrjCHjrACJwdJTlu5RWSosXwAL8bpo16UNnBCJ+0yAWNJoi1fUkbx3pF9uNJ2UCogl BMNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hVhivn0J; 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 t21si110141edq.73.2021.07.01.08.31.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jul 2021 08:31:42 -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=hVhivn0J; 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]:51670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyyfF-0007te-DY for patch@linaro.org; Thu, 01 Jul 2021 11:31:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyyZl-0004hj-2T for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:01 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:38805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyyZX-0008Fw-P6 for qemu-devel@nongnu.org; Thu, 01 Jul 2021 11:26:00 -0400 Received: by mail-pg1-x52b.google.com with SMTP id h4so6415299pgp.5 for ; Thu, 01 Jul 2021 08:25:46 -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=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=hVhivn0JQBLhfo15kUBHoJZe79uniU31FuCuDuDsAXIk+FCoCVEEMvHEaKqFUkpyQn 10BiUMQ+/xjSlN0Aki51DpahvczC31+rm/4tCTGjy4Y52arC4wnWGpFYaeli2o4TQyls aykoNZqo7pTzSjFP2iKwBNe5utrSbySGUizAZXONlZ5SPkz0xA05k/eEu8xRZSuSUder MQMLxI3S/RcPi/KRd4w11ptEyQlMFu9AhfuraAMGU22EK3q3P7bHTNC45rs+Jsl1aHs7 P5SYKa2O+igOULuLShCNFyg1ySNy57So40cAMDxLl+dx0n4l+0tDvKC0FOzS6+hrAHNp mpag== 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=aZodwPrqQjUt8vQ3rujRtm0PKCZdI4rcPhp5DEtvTCc=; b=oUPaXE5Ufey22KyXvABa2IJ8SQxgOul0i/KzVFA4ffjN8yEDWqzXzhap0amr4W2a7Q lzyVV8WbRXQppJsAuNgJwsiFZ1Qip5aCT/MiVEZldIj+8jsgjXef1GbYWA+ThRQSxvQ+ xTGZl786EnnLG3voSeRtyz8MYX92giHB5rfTGF3ilJoTdtHYS6aCHWSHmoCrvy2R7v5p fkhmravId8IQrEitRTkMALb2e6wyeERrabUpaSFxZ7KQ7xND7VK8tLt+OElJShApV3+h 6ASHiGouZNx4POXynslI9mhCRRT0Ny5kUf+fBTFuBb6aIKwv4dlOBLbqOxj2Zdgnix9+ 0GsQ== X-Gm-Message-State: AOAM532AILoCM2Y8ILIAFGesqxhoupgYOqftacvncIhStvqK5v864LqV K7rT9wnCpWmpeEMspRi7Tmp2I1OgS/PwpQ== X-Received: by 2002:aa7:96f0:0:b029:312:8eda:61e1 with SMTP id i16-20020aa796f00000b02903128eda61e1mr266767pfq.42.1625153145759; Thu, 01 Jul 2021 08:25:45 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id j4sm10213197pjv.7.2021.07.01.08.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 08:25:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 12/17] accel/tcg: Use CF_NO_GOTO_{TB, PTR} in cpu_exec_step_atomic Date: Thu, 1 Jul 2021 08:25:32 -0700 Message-Id: <20210701152537.3330420-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701152537.3330420-1-richard.henderson@linaro.org> References: <20210701152537.3330420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 --- 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);