From patchwork Sat Apr 27 15:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 792679 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp973858wrh; Sat, 27 Apr 2024 08:59:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgGppDF8nKc2uEPnqq/ywAcTqw4KnSCxE1aDYosLvrHb0EWSLlrkcD/hhaUgBuFAWQC3/xnQlfcWIHfl3BSMvE X-Google-Smtp-Source: AGHT+IEeUdCa46EDAnBSt0Qe2x3560FnByMfvuE43rNLNiR2AkUMd8cQ+BCzP6QwCPF08olHDg4J X-Received: by 2002:ac8:7c4b:0:b0:43a:8248:26f with SMTP id o11-20020ac87c4b000000b0043a8248026fmr5615016qtv.27.1714233586912; Sat, 27 Apr 2024 08:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714233586; cv=none; d=google.com; s=arc-20160816; b=SyriuJkRFYr4cMj6Emq3bKpugvjbzvCeYtSPY8tR+3+XG97tVHFB9B4OznknDGtO1V llmf6XyJQUv3GDHb+8JbsG6eTQL7bJQCe/CPBAKG5RHJMcrXMJKtShkZ/YNlKmPPllmA szUAfFhZsi+tw/Qw3p+2eMwEYnW2vSYuWFcbhO/2R+PZjAqlqN19n0xiECqJkIFv6OYz LlY9ZH+bsa4FpjNlaWj7TvLHk5ZdV7dSwEPej5u1V33vGguN+Z43MUVQsrewULAITRnT OeoOSLBXBrr2exlPJFUDzojUcmLxfEkraKCIVDDMcBe3PTxGAd9ZyNxHkJX4gvEX3QFU evoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=z1+Wv8QB/miGw++EL4p3GyCE2nTTIsU/1KJBEYJal40=; fh=ZXDWg7hKG7Hj19AbRuutTLw+Zvn/B9RsGUUw/YagpFI=; b=Er/MYZuWAoiK4X9gJr7WeOludDa4DBGVbarT0QfbSj0D3JVKSmOk2C/dZbW4jOWroR RHTAKB2y9CUsXtJA4hYdggRrHQEI2+4r4QOtnoG2+rseZhoKvoduhJ3JUazgeG5z8+21 I7hxotyd29MYIQ6oALL2V1nXa/SCkpi+m66gUWkBT3kJdkoQN2YybA0zA0TL5kWEuqXq NZRboWv7FZL1X11sLNqW96o9mNDxVSEa7I4hjvdoERUr9WATEtf+PKzZdcv+A3Go90Kz DYBSJ4erebuLqsT6eE2ZPPGvjtWfm4UyCAvVfU5kET3XgQ3uRk6aE9rFko37BNrJ4OFu ur3Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j+pfFeJl; 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=pass (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 ci16-20020a05622a261000b00437bbae16absi23014654qtb.405.2024.04.27.08.59.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 27 Apr 2024 08:59:46 -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=pass header.i=@linaro.org header.s=google header.b=j+pfFeJl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0kRU-0003Dw-5H; Sat, 27 Apr 2024 11:58:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0kRS-0003D2-6J for qemu-devel@nongnu.org; Sat, 27 Apr 2024 11:58:22 -0400 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s0kRQ-0005a0-KY for qemu-devel@nongnu.org; Sat, 27 Apr 2024 11:58:21 -0400 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2d8b2389e73so37450041fa.3 for ; Sat, 27 Apr 2024 08:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714233498; x=1714838298; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z1+Wv8QB/miGw++EL4p3GyCE2nTTIsU/1KJBEYJal40=; b=j+pfFeJlXFntuCsnHRy1Luvtyy5r5iSR0KlmkiFxTajTV/NtiZkzPr3/gY5FW2QbWQ IGzzZbuYipyV/jIkvaoNdIiIdWa7VeCURZTVTZcw9SJL7FoVI8ajAcKZ6IeeMU4G8dej r7TaJDSvPNkx5rV3R4yLMRJH1a/YJEBspFqAs/ZcPPrnAWmXHBsvZUg85tnNrJmpWnLA rJQBLzwfL/kgDX7oTKfAWpMxVii5YilchhEM/AsKWfkoDiEpyJ9dIm3v4Sx1WV9oyTxh SYXeeXAOh6AyvaBNHXupmHxzSK05AGvU4vanci5mwvMuaKzTCUM2wJpuPxLYOxqPndDW WS4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714233498; x=1714838298; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z1+Wv8QB/miGw++EL4p3GyCE2nTTIsU/1KJBEYJal40=; b=LUIdjP2nfgQmRoUWw/xE7qyRhOqRWwGsMDFYmdPBkzoiBNIpHTreNL5AqbHli7yABp z1KJnnidRweRdklAK6TLudmz71ecEV7ehI8KcxdgMkJWgjFaTIleH6dqJ4amFCdVsdo5 U9qThfsLnTzFWHbRIRbPLDEMfRxlUHsNYtEDpGC/k4kZVqOsEGc2mVghpOGNo56DRtUE recG7yhYf95PxKBudXnxwhFef5LqpKokMS5INZSGUJOctrr8FyIwqtCWIZUDtJylTojO AQPRQnWBFpom1xVLqAPXiXHqun26p4vzBYQyKgLUETDpGZbMEe76xptzvDp9KdgelPTN hhnQ== X-Gm-Message-State: AOJu0Yz+l3abG7H9UwFceNKo+YTW64ul51wp+hgzEnBDqPtsCbGaQD9B qwT2WumD8Oi6KtiyYjXpSPZBZsyK9xvc6gZDxWSM5JMoG4mDPYCX9Cv9rcV6VvBqYDV3iMPyBIx A20A= X-Received: by 2002:a2e:9110:0:b0:2de:d4df:4e75 with SMTP id m16-20020a2e9110000000b002ded4df4e75mr3275932ljg.17.1714233497868; Sat, 27 Apr 2024 08:58:17 -0700 (PDT) Received: from m1x-phil.lan ([176.187.209.2]) by smtp.gmail.com with ESMTPSA id t11-20020a05600c450b00b0041befc2652csm1499073wmo.31.2024.04.27.08.58.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 27 Apr 2024 08:58:17 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PATCH 11/14] accel/tcg: Use cpu_loop_exit_requested() in cpu_loop_exec_tb() Date: Sat, 27 Apr 2024 17:57:11 +0200 Message-ID: <20240427155714.53669-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240427155714.53669-1-philmd@linaro.org> References: <20240427155714.53669-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22e; envelope-from=philmd@linaro.org; helo=mail-lj1-x22e.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Do not open-code cpu_loop_exit_requested(). Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 225e5fbd3e..0329c6423e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -900,8 +900,6 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, vaddr pc, TranslationBlock **last_tb, int *tb_exit) { - int32_t insns_left; - trace_exec_tb(tb, pc); tb = cpu_tb_exec(cpu, tb, tb_exit); if (*tb_exit != TB_EXIT_REQUESTED) { @@ -910,8 +908,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, } *last_tb = NULL; - insns_left = qatomic_read(&cpu->neg.icount_decr.u32); - if (insns_left < 0) { + if (cpu_loop_exit_requested(cpu)) { /* Something asked us to stop executing chained TBs; just * continue round the main loop. Whatever requested the exit * will also have set something else (eg exit_request or @@ -925,6 +922,8 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, /* Instruction counter expired. */ assert(icount_enabled()); #ifndef CONFIG_USER_ONLY + int32_t insns_left; + /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */