From patchwork Fri Sep 30 21:26:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 610960 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1754680pvb; Fri, 30 Sep 2022 14:34:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7hjdtwLdXfg7l/6NK3pVpa/cwW2+rLxs+FFOvF81gU1z3Z33MrRzZle0FK6+fIG8UhTMAE X-Received: by 2002:a0c:f84b:0:b0:4ac:9d85:2933 with SMTP id g11-20020a0cf84b000000b004ac9d852933mr8482400qvo.115.1664573668194; Fri, 30 Sep 2022 14:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664573668; cv=none; d=google.com; s=arc-20160816; b=KJrIaJbOGB0rZdIBpo/cUx2rGRVlKA9/m1D2dxElXydhQcHfh/PWjEA7sK0LNDdm04 YEmdDfIRHZEPyWDkmV51Q+HUFN1+JiWUMDYMibe/6tDy7ih4fUAjQinygtCxSBkcPMeV ym6d2Y7ILP9P5Ab43r1QYc7Qpa1f7dGse6Ux59sDEwjGGPgNmn9lJKpZMYry7ctJqbDB m8h8F1JQLKF8bnJJNaZAGPbHeuq6YqnpjcoITio/MmPDt5ZK74IzI5jUCvbKlQ7sX4oX FeGbQ9d8ikl/HpP7N80RFdAahcvIH8TkWRHy+hfEa1xr6wfPu2skOav1uF5q9sMpjUj5 MgaA== 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=FcUiK2Okdru3cG4LiS1rgcAo1RAHSsbMmma9k9kUJWI=; b=iqCVPxl6SU46uC65GHCK4imJYsNdiOXPMO5T7r9VqkWF5k7vDFHJEUxfbknK0EzTKd FMuyBWKYyMeNQkptxK1Q4XU+BrIyLrLWUkXMMV/l1gLeaYq50HcbQRQOxnVQ33TZAR5A G6K0c4gBwAF4VbYBuoZoLEyefbuXZxrNJW9v0PK473i0ty2QxKFSFsHmMFhKf69Sc2jI OjPeimsOaCXyuMWj0svY6kp07+fAIoT0Yod+xgpeJ7Le8zCNWhZwm2GyNFGTNOqBy2eT rnMWMZrsHRsfDINhdTFwAtMS2sHKI2BxajSbvaD97ksgb/tmLDzgrk//X52T0uWWE5ny cGUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/vYG3g7"; 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 hg17-20020a05622a611100b0035caacf0060si1844802qtb.31.2022.09.30.14.34.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Sep 2022 14:34:28 -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="M/vYG3g7"; 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]:60680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeNeN-0007lK-NJ for patch@linaro.org; Fri, 30 Sep 2022 17:34:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeNWk-0005um-2Q for qemu-devel@nongnu.org; Fri, 30 Sep 2022 17:26:34 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:34742) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeNWi-0005NJ-E8 for qemu-devel@nongnu.org; Fri, 30 Sep 2022 17:26:33 -0400 Received: by mail-qk1-x72f.google.com with SMTP id g2so3622883qkk.1 for ; Fri, 30 Sep 2022 14:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=FcUiK2Okdru3cG4LiS1rgcAo1RAHSsbMmma9k9kUJWI=; b=M/vYG3g7pBcDMupCoDn3WfBcgdaFwjO23mq2B70iQzSKpCv0IeE5jHTfJI5fVLT1E0 PgI0Orj1mKrCAH1NhBZPBW0BmMzJfAHWDfn0wFqIo6Ir9Yo4g0Yrx42qUAZrdPduAs0C nKeiu1JeKKr45k60si+HolYZeGPtoQrAbX/+JpWaek7G3OXyfxX+O229yJTxJR1Ui/w9 O83M8VhOH0+s2BdPv3M+sWErbyOsRVMa66z9pmmi9Kx0K1N/gRSMfJm9IvSlTJ+YwnhI 5EZaYaQ/X4skWGpAq9Bxu585DCazSoAp/hPu0V8M1EraIqP4aKAXPHsiN7QqXwLQACwo /8Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=FcUiK2Okdru3cG4LiS1rgcAo1RAHSsbMmma9k9kUJWI=; b=7fv7tJPAx5GaSGWf4zh1/KLBsO0xgk/6G0dwpO8zgm20ka2t8GI4IVbqOqCj8MUi1K hUr+zMSbKMuuDD2u8U/Lz8+VzslCYJlK7aJjIcC8c9t3KC9aT22jdxdW+JXG+KJ4PFsw 430S3zzFL/8B+Txmp8jdEH8PYDqVoYWiU/jf5Et8HyiG/ixnOcoxHJIiMv17x5rJucQh HCkvtqFynre+pSydtQIDNcsDEvoAcRiAT5RI+P5IdAt36jZKwLDCtxR48aQJXNBY6YIT rz0tEu32aZ6K+P+jIlaRYYqENS1vmze+GFxaPWZmF8GCxgpIHOTxuDKye3FhNfKUHy0r fvyA== X-Gm-Message-State: ACrzQf3+tA4DyKHm3WNw4w5+1UyZtnbMGf1iZudrOk9U7DvkhcFRB/j6 /BqMfrN0aeusEAJQUWjVsdiE1Fs9Xx/9sA== X-Received: by 2002:a05:620a:29c9:b0:6ce:a961:af73 with SMTP id s9-20020a05620a29c900b006cea961af73mr7625044qkp.226.1664573191390; Fri, 30 Sep 2022 14:26:31 -0700 (PDT) Received: from stoup.. ([2605:ef80:80a1:5a60:d0d7:468b:5667:114b]) by smtp.gmail.com with ESMTPSA id l18-20020a05620a28d200b006ce813bb306sm3696370qkp.125.2022.09.30.14.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 14:26:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linux.org, alex.bennee@linux.org, =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , =?utf-8?q?C=C3=A9dric_Le_Goat?= =?utf-8?q?er?= Subject: [PATCH v6 02/18] hw/core/cpu-sysemu: used cached class in cpu_asidx_from_attrs Date: Fri, 30 Sep 2022 14:26:06 -0700 Message-Id: <20220930212622.108363-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220930212622.108363-1-richard.henderson@linaro.org> References: <20220930212622.108363-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72f.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" From: Alex Bennée This is a heavily used function so lets avoid the cost of CPU_GET_CLASS. On the romulus-bmc run it has a modest effect: Before: 36.812 s ± 0.506 s After: 35.912 s ± 0.168 s Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20220811151413.3350684-4-alex.bennee@linaro.org> Signed-off-by: Cédric Le Goater Message-Id: <20220923084803.498337-4-clg@kaod.org> Signed-off-by: Richard Henderson --- hw/core/cpu-sysemu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c index 00253f8929..5eaf2e79e6 100644 --- a/hw/core/cpu-sysemu.c +++ b/hw/core/cpu-sysemu.c @@ -69,11 +69,10 @@ hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs) { - CPUClass *cc = CPU_GET_CLASS(cpu); int ret = 0; - if (cc->sysemu_ops->asidx_from_attrs) { - ret = cc->sysemu_ops->asidx_from_attrs(cpu, attrs); + if (cpu->cc->sysemu_ops->asidx_from_attrs) { + ret = cpu->cc->sysemu_ops->asidx_from_attrs(cpu, attrs); assert(ret < cpu->num_ases && ret >= 0); } return ret;