From patchwork Fri Sep 23 08:48:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 608582 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp147328pvb; Fri, 23 Sep 2022 01:52:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lvrOMc/NK81YYTLj+cHmMX8gkrPxawpmt15TSLvejtL7tgF0FRJebyA3O0uEIz/MTonTG X-Received: by 2002:a05:620a:170d:b0:6ce:9bad:13c6 with SMTP id az13-20020a05620a170d00b006ce9bad13c6mr4690292qkb.683.1663923164940; Fri, 23 Sep 2022 01:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663923164; cv=none; d=google.com; s=arc-20160816; b=Lhp8NGpYh7fPnEINfHFW+nxN/fy7KaUBL+b6vN4pfN6Af5H/vr7G/5J9rjED2AUWVR 4XZtTJRJPlUO7GvFEr/tyIxptwaOAaj/4ON6lpL82IXdTKkdkjT3pOyL4TnG8T1bcSkA lX9haoKMMp0mYbVz1JW/7s6dgax03+1v08cxXluarD7KwFNFSD620HM8Z4mDn7qDQO6u ktwuw5OUlJIaCSPu23glAep24cdVWAX3td5QPwq7acKRO32Nh9ky6BqHtUpsWySj/VS+ p6JU/nYlIh+f/4yEY8JT7DidwiwaQYcgBfWrlQdVbYazB5gJgb3eN3YJyX9/f2lW+bTy Jk6w== 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; bh=r5tNkPu//c2nqMt3oS3wMQk+F0hTNh/wM2KTW+bR4FM=; b=DIzbX+bIWoYn80U6sR1GDMS21OB1KeuotEiBwicuxtw+QcPvfGCgfXTsxzyat8rW3V ckKT1klhBEfAku0tJfYj6otDsE3wqDIr1FUvxOQXuAh9zV5qkx9xdGV3wKD8NzzxxCAE veN/YAG8KdBDfJ1IlaloaW0p3KaT0QAaBtHxD/RnVLqWsXdMYPaCV1UMVLOGK3bz6SpH Db+1TO8gLvt2/UH9c57G4Kpyl8902U8itGF3khDqu5BlFOuUhItUMCE/97+hXmdovESb /2YgXIJuNa+pYPAJ82N4nD1uJIscWmHbo/e7OMF4afRvb7kdiyDF//Tqy9gYvW0ZXS6q lcFQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m9-20020a05620a24c900b006ce550324ecsi4643551qkn.701.2022.09.23.01.52.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Sep 2022 01:52:44 -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; 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" Received: from localhost ([::1]:44902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obeQO-0005ye-FJ for patch@linaro.org; Fri, 23 Sep 2022 04:52:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obeMK-00059L-DW; Fri, 23 Sep 2022 04:48:35 -0400 Received: from mail.ozlabs.org ([2404:9400:2221:ea00::3]:58847 helo=gandalf.ozlabs.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obeMB-0005Jk-PW; Fri, 23 Sep 2022 04:48:29 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4MYm5J6vpRz4xGR; Fri, 23 Sep 2022 18:48:20 +1000 (AEST) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4MYm5G344Dz4x3w; Fri, 23 Sep 2022 18:48:18 +1000 (AEST) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , Joel Stanley , Andrew Jeffery , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?C=C3=A9dri?= =?utf-8?q?c_Le_Goater?= Subject: [PATCH 3/6] hw/core/cpu-sysemu: used cached class in cpu_asidx_from_attrs Date: Fri, 23 Sep 2022 10:48:00 +0200 Message-Id: <20220923084803.498337-4-clg@kaod.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923084803.498337-1-clg@kaod.org> References: <20220923084803.498337-1-clg@kaod.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2404:9400:2221:ea00::3; envelope-from=SRS0=gbDQ=Z2=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-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 --- 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 00253f89293a..5eaf2e79e66c 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;