From patchwork Mon May 6 12:37:06 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: 795003 Delivered-To: patch@linaro.org Received: by 2002:adf:a453:0:b0:34e:ceec:bfcd with SMTP id e19csp901508wra; Mon, 6 May 2024 05:39:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXtTOrLzA6qPAGIM3JQMsCiOpYqrl7Zz7QacUzRdm4GmnzKp8KSKrPblhQ4XiRilzOO4tZQ4MkUpVtbAF9BQoqx X-Google-Smtp-Source: AGHT+IEQdtbErDFdFl/K/2NzRwcpHdZ8V3ysydc8kq1kBXq8kGHGzMxLVVyV6m7uymi9yDgvGU7G X-Received: by 2002:a05:620a:3709:b0:790:945e:6f0 with SMTP id de9-20020a05620a370900b00790945e06f0mr13028230qkb.55.1714999180149; Mon, 06 May 2024 05:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714999180; cv=none; d=google.com; s=arc-20160816; b=KX/gQyLN1tSHCeHLFDKZxAkj4Dl3zMKTqVSR6a59qnIp62rRoKhWEc7gjRtejn2MNK HM2pgDRNEL4PUUO7q+IihG/pDunb7FgVsbmwaFIpo539gFHsIgUq35KmekpwBDcF5IZR YNCbnk4DJ7dkwjzloWhj3IpnD6DQMrVhYiySB07rBtNxbOJm0/Gpz2HYn583Al4fIm2M VOB9eI91rizYutulbPmo38XRlgrlKomniTrckBv180qqKzUzw+ka1yUKY2RCFitQ75gC EWXt9jgk8lnKGoOnDiwlk4vfyBJYWelnPT63wbiPWXze0sTVhEaz07hSHAhx2551/qHi FKgA== 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=1xKUlJq4altC6gXgMzk8h7ZuMjWZxGoEWR8S+Y8f728=; fh=qtn8prgQtzf5IzCNvLChUZDElvNECP6ej9YfjQeBz3I=; b=CODbvsIAxTPTakXXLxARIAIQgLCngGxeD0jZGBwkrmVDd5qyEn/K7dPJfbiA6yIZAZ 4HBXByO/PHSvoC+XtNz9T5SRbU5ea/Ov7O/D3lDvNi4Qv+71qB+5XX/ISHVvo+JIjq3H kY7k/jAN8vbGHCqSVU6IprChKjxcc7rMjkhGmC+nG2KeRxk6jMaCNG0ansnKZCuZT8cn cMMOUcQXIQrtTcLPN+pTxZdOyc5p47TGAi2depWZ8LKiaaaZZ93Qp0y/y+luHJWoR24o pIpqZdWe8gfvHnVNLQtYlFFrIsUMBeJjktDI+/85Znam7rBR50Dy5nLCa1BMVNPiw8Xd XbPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uR1rA6Ba; 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 bq36-20020a05620a46a400b0078ef1622a70si9895617qkb.68.2024.05.06.05.39.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 May 2024 05:39:40 -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=uR1rA6Ba; 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 1s3xcW-0002SA-KR; Mon, 06 May 2024 08:39:04 -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 1s3xbz-0001KQ-AZ for qemu-devel@nongnu.org; Mon, 06 May 2024 08:38:31 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3xbr-00020O-Mo for qemu-devel@nongnu.org; Mon, 06 May 2024 08:38:31 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-41ba1ba5592so12608155e9.1 for ; Mon, 06 May 2024 05:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714999101; x=1715603901; 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=1xKUlJq4altC6gXgMzk8h7ZuMjWZxGoEWR8S+Y8f728=; b=uR1rA6Ba6NGMxIpkAdx2yWzANPGRl/9JGOYUIoccvpKV4eaEuoCszad4gxByHItzyh LWfXBoMmAlwD6ukzkzxGDnhN2paOp2o2AIndC/mSnNJaa4cZ11jrelZo2vjD0zKgoEie PQEjNSuGB42XChxly+3lTz6ocOZqM100FhLznMESKjoayF2JyTyBjciwAhpjMKz+ITVu UYIGpai87y7C7/u6tF5QztokE6KPn+VJ8b0Ft6jmVGpvMsyVVRbvKyihNTktZ/oyEYVe GRGQNNir8JGvRtAS2dY/x/oyWbhxkYiGiXHp3D5yRKiSyIA569shvtz/vID0bu/ESept h4/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714999101; x=1715603901; 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=1xKUlJq4altC6gXgMzk8h7ZuMjWZxGoEWR8S+Y8f728=; b=I3VGreDmyDe4D96GL67DbW320nKr6su+MBddhohmRJDc7txbhZNAd1dANt3Vk9S3Nf s6zdYHC5UOobkOMRfb+rst5cCS7FXT61D8C7mDLrQRR0GOeXRFUSVlZdXVSs5eJyFQjd aGyNgjpqdRlPJKrYIG3PyPuC1mBEIUeTo9bhC3gekJEOT92ALtH3EPMUOEM5MDmicjsT ahNTB6wFuiq5E1p5FeMTKjhTqBEP7ouWe2F7vp+bXJrA/lsa3jqWmU4X+x+1q1+Gu0qa q/FeO+3U/GU+4Lbg2dhUfdFSLB1TgwCLDVblWofWynucsVw89n2ENtfJE2Ytdj8g6l3q EDWQ== X-Gm-Message-State: AOJu0YzWOH58T2m93wRDd6xXNOwUp1LAEvtgfGPYAAr6BgpXYSvILcBa gBTKeDmSKgpNYwNExD+aDTNQrlXi++iwygZLGAhMJzhqG8vbkzRg7soNdTBKJ2arNaXWsZO2flS G X-Received: by 2002:adf:f6c6:0:b0:34d:963a:12cf with SMTP id y6-20020adff6c6000000b0034d963a12cfmr9146299wrp.50.1714999101595; Mon, 06 May 2024 05:38:21 -0700 (PDT) Received: from m1x-phil.lan ([176.187.211.4]) by smtp.gmail.com with ESMTPSA id c4-20020a5d5284000000b0034b1a91be72sm10608400wrv.14.2024.05.06.05.38.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 May 2024 05:38:21 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 06/28] accel/tcg: Use cpu_loop_exit_requested() in cpu_loop_exec_tb() Date: Mon, 6 May 2024 14:37:06 +0200 Message-ID: <20240506123728.65278-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240506123728.65278-1-philmd@linaro.org> References: <20240506123728.65278-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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é Reviewed-by: Richard Henderson Message-Id: <20240428214915.10339-9-philmd@linaro.org> --- accel/tcg/cpu-exec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 225e5fbd3e..c18a7e2b85 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 @@ -928,7 +925,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */ - insns_left = MIN(0xffff, cpu->icount_budget); + int32_t insns_left = MIN(0xffff, cpu->icount_budget); cpu->neg.icount_decr.u16.low = insns_left; cpu->icount_extra = cpu->icount_budget - insns_left;