From patchwork Mon Jan 29 16:45: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: 767411 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp981604wro; Mon, 29 Jan 2024 08:51:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IECtjNIKa9mEx8XXAgByTymi9C2yLTTQ5SKnsumd5idbBCDj+P6Z3aybxKkMfxtECeepgvs X-Received: by 2002:ad4:5961:0:b0:681:854:e7e0 with SMTP id eq1-20020ad45961000000b006810854e7e0mr6933020qvb.93.1706547085033; Mon, 29 Jan 2024 08:51:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706547085; cv=none; d=google.com; s=arc-20160816; b=qILG2TmbT91lWESo7IzqlTlv/GpIzalGQNm+T6YFRL07hKgkmwqqEARAPm1jX8dTPc DqM6m3kUtR+Fq/audmh3/DNhF9xjVmgdWBLD+LRjFe/iaMmGtTPvmYlegm8nFHYWtxV0 I2apFWSQmOi92yWE6T/pa57XPFmQeMzMREyQCx7K0hraoLk/S/x7lcOtdGzOx6gLJHVW /hzSTfmOS7ZgolMAH5FypiKH35Np+AX00quViGqG5S9OGMP6haq5qBoqIam0KOqAT0PS VbmUeVzlUspuX9YuKgVBkza2JTRK336AvoG787WkkZbOFaCO6+imMHzQdlxTj8VaielZ 32iw== 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=Kk5BhQRPM94EKsRIhVMqYgmcfDsB7owy8rOzxcGC7OQ=; fh=/epBWcCUTWsqGs5aSzxrp78EPibek5jU0534W23ucj0=; b=NEBpxRF19gSNPzYCmocZ/GODCibpkeNZGrZo31t5ctRw/vHlL7FzAnhWHYcIOUXQgw O8s0UxN99Y4JsQxuuLyzvuj4ni2PfEJKveR7PWtUC8HTx6zULzkxpqaiMqIrCBk8ZznD 0DqfUpfNUNF/eeX90kz+IrbFu1GOkL/jTe4V2SKkxdn8pxUUVCirlwbuLHPjPOTtGfrG 4FxrDPpnap6wlStN1eBziZ+5PrBVh5my++OUjaQ7X7qny709B6kh3r8x1IqZL9K1nwBx Pr2hSFMONNc0Vb+DiCKF1S0Cxlyc/7T9qtsBa44OgRmJNqlFnqxqj+aKREQGdZSGb78s BElw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PUFV4X8A; 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 dv11-20020ad44eeb000000b00683a93c788dsi8172368qvb.380.2024.01.29.08.51.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2024 08:51:25 -0800 (PST) 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=PUFV4X8A; 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 1rUUpI-0000oB-8y; Mon, 29 Jan 2024 11:49:40 -0500 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 1rUUo2-0004DV-Vu for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:48:23 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUUnz-0004e7-MR for qemu-devel@nongnu.org; Mon, 29 Jan 2024 11:48:22 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33aea66a31cso738786f8f.1 for ; Mon, 29 Jan 2024 08:48:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706546897; x=1707151697; 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=Kk5BhQRPM94EKsRIhVMqYgmcfDsB7owy8rOzxcGC7OQ=; b=PUFV4X8ABxoNWqyIf0tWmTXPHI7aKlcRQ0hCDU0MGNLi+HI4imGoXWkTTxvizp8RTP JP7bxiNN6Xh0ykr8WMyJEQDEWfW+9zTZJcUrJsHk0kTShXMruLlPi8P4j6gvEmwlCo7l AlkOvdvJ+98Q0e7P1nM04niBcyU/+GguFUqtRMXmdaWGbKpVo1jpoL50WsXTciREIqtp Zq2+fap1r5MBImJUycAvazyNXt8IvyDtAruXPAXd3r+AzOM3XjdDa4AlhNMATrH5wj0C DmC2ih5g3SuXzP6zfcKlz3514qiOOr9SrYBLEh8gIxcQgV5n4SawwSOafOvZDtHjPEVs IGbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706546897; x=1707151697; 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=Kk5BhQRPM94EKsRIhVMqYgmcfDsB7owy8rOzxcGC7OQ=; b=AqL2zohthewxfh0ImghS81vUscyMXZl3SsBTB6fAxJuu8aDX/RSCdOhqnG9E+9FtNX bpOLaG9B9cPyw2wdidcKCGhLQHJQl1J6H1Zlf0fF/D/DVRvRDiRsTMqF/SQ//VNy1x9J bSROI9fsKKtkwpqb71OWEIMGBnBLV37/NQ9b7/baiqXKUrmmqCbkLYopHguroboRE4zL /vWBPkhd7OCP2B40VMN43tzpoc94F2G6jU8RF44g5s7wyUlFIgMbDviqZAVP4z03aKLX Zec0aF7wyW4tDqNwq1GQSPI9Q9f3joj5C32zql2jOMRyViqFcf2jz3nbTwSdZ70gVgmA A9HA== X-Gm-Message-State: AOJu0YwHYs7a46xupJrLeNh5DNT6U74eKf2uRjIb1Sc4WPm33mmC6jGJ iUFHFyE2OW5Gu8zXICtNVLtSeqAR8+BM66/EEOsGivIBHDZd7qN1Uytgy14MkEoiqaC/hn6TkUs G X-Received: by 2002:adf:db11:0:b0:337:c91d:e816 with SMTP id s17-20020adfdb11000000b00337c91de816mr4734391wri.1.1706546897611; Mon, 29 Jan 2024 08:48:17 -0800 (PST) Received: from m1x-phil.lan ([176.187.219.39]) by smtp.gmail.com with ESMTPSA id ck8-20020a5d5e88000000b003392986585esm8609742wrb.41.2024.01.29.08.48.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Jan 2024 08:48:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, Paolo Bonzini , kvm@vger.kernel.org, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Warner Losh , Kyle Evans , Laurent Vivier Subject: [PATCH v3 29/29] user: Prefer fast cpu_env() over slower CPU QOM cast macro Date: Mon, 29 Jan 2024 17:45:11 +0100 Message-ID: <20240129164514.73104-30-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240129164514.73104-1-philmd@linaro.org> References: <20240129164514.73104-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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 Mechanical patch produced running the command documented in scripts/coccinelle/cpu_env.cocci_template header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/signal.c | 3 +-- linux-user/signal.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/bsd-user/signal.c b/bsd-user/signal.c index ca31470772..c6f0b1be38 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -463,14 +463,13 @@ static int fatal_signal(int sig) void force_sig_fault(int sig, int code, abi_ulong addr) { CPUState *cpu = thread_cpu; - CPUArchState *env = cpu_env(cpu); target_siginfo_t info = {}; info.si_signo = sig; info.si_errno = 0; info.si_code = code; info.si_addr = addr; - queue_signal(env, sig, QEMU_SI_FAULT, &info); + queue_signal(cpu_env(cpu), sig, QEMU_SI_FAULT, &info); } static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) diff --git a/linux-user/signal.c b/linux-user/signal.c index c9527adfa3..f78f7fc476 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -623,7 +623,6 @@ void signal_init(void) void force_sig(int sig) { CPUState *cpu = thread_cpu; - CPUArchState *env = cpu_env(cpu); target_siginfo_t info = {}; info.si_signo = sig; @@ -631,7 +630,7 @@ void force_sig(int sig) info.si_code = TARGET_SI_KERNEL; info._sifields._kill._pid = 0; info._sifields._kill._uid = 0; - queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); + queue_signal(cpu_env(cpu), info.si_signo, QEMU_SI_KILL, &info); } /* @@ -641,14 +640,13 @@ void force_sig(int sig) void force_sig_fault(int sig, int code, abi_ulong addr) { CPUState *cpu = thread_cpu; - CPUArchState *env = cpu_env(cpu); target_siginfo_t info = {}; info.si_signo = sig; info.si_errno = 0; info.si_code = code; info._sifields._sigfault._addr = addr; - queue_signal(env, sig, QEMU_SI_FAULT, &info); + queue_signal(cpu_env(cpu), sig, QEMU_SI_FAULT, &info); } /* Force a SIGSEGV if we couldn't write to memory trying to set