From patchwork Fri Sep 23 08:48:01 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: 608585 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp151624pvb; Fri, 23 Sep 2022 02:03:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+E/rCpuP9+9RhSvuDhNIxH8QHRstRUBP7Dcso21RMF/lpV+nLu4WnPycYPmCJqBBUORqk X-Received: by 2002:a05:622a:150:b0:35d:2492:3a83 with SMTP id v16-20020a05622a015000b0035d24923a83mr537586qtw.164.1663923796457; Fri, 23 Sep 2022 02:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663923796; cv=none; d=google.com; s=arc-20160816; b=TproIhuHMuTxC8su7fplHFXoi4uO2M7DtHif40KAkGIfH4XofoZJ2xsQRgw3NbwkvM cp7zeHc00jSGKtddulQ5sOp/QXfoyr7LIR3Ez2tUJ0beg8y8k0HLDSal9mUIxa9GA8HG uxiIFugZ3Nu4sWIKxd6RWCN3ky9NUuiMfe94nziLjIdJdsPuZKj+bQ/r4HchUzZZgOqj 8hXyr1J3czPbbtEngXqweg3n/oQHuRnntY52sESB8Ymz3fwFZRMvL/BVSd4cy5lzXQel ryuQxo8Kw1JUVMOwOy/imVocRPCfCZx+lt7T+W2ByP17PMfRAy2huntUoJbD/rHa2X6E tEbQ== 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=wbXSuRf4qmE+Uq+zXXjsfsn3zGXpuZ80Hj3mjIa2b1Y=; b=rRiNXdrpKqJdcea+0qYVdjPyfIKqJpLQk0oHLy3zQDM6aZEBe/Dfr35Mk6MDw1byOT xW12TxIwQQGRfTn2ap2nJyyRkXSh/pzwvkeh+sPzbNJn7F461/6d1vq5zZnw8tCs9X/F oUNThgiXJs2wdAK0vFG4iE3Ak4GroDqj1SStKkNKteucyz5bOHHuCBtY8HaAegj9cFXU Y/+3M6BuM2iYaU+kYImOUIU60I7tBZe6TsOpCNxKhOgEGksNf1dePZP1kPC2MtSmJ99p sWHbvWUt1+/ZuGolzhNxc3+yeBMyMokB/4IYgZqHDlcIqbuAq0mR75gr7jCRsM2I+oA1 UdOQ== 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 cc5-20020a05622a410500b0035ce726b2d5si4266514qtb.398.2022.09.23.02.03.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 23 Sep 2022 02:03:16 -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]:38334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obeaZ-0007CN-RN for patch@linaro.org; Fri, 23 Sep 2022 05:03:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obeMK-00059N-Dw; Fri, 23 Sep 2022 04:48:35 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]:57019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obeME-0005Lt-T7; Fri, 23 Sep 2022 04:48:30 -0400 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4MYm5N04WGz4xGg; Fri, 23 Sep 2022 18:48:24 +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 4MYm5K3NT2z4xGN; Fri, 23 Sep 2022 18:48:21 +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 4/6] cputlb: used cached CPUClass in our hot-paths Date: Fri, 23 Sep 2022 10:48:01 +0200 Message-Id: <20220923084803.498337-5-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=150.107.74.76; envelope-from=SRS0=gbDQ=Z2=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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 Before: 35.912 s ± 0.168 s After: 35.565 s ± 0.087 s Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20220811151413.3350684-5-alex.bennee@linaro.org> Signed-off-by: Cédric Le Goater --- accel/tcg/cputlb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 8fad2d9b83cd..193bfc1cfc14 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1291,15 +1291,14 @@ void tlb_set_page(CPUState *cpu, target_ulong vaddr, static void tlb_fill(CPUState *cpu, target_ulong addr, int size, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { - CPUClass *cc = CPU_GET_CLASS(cpu); bool ok; /* * This is not a probe, so only valid return is success; failure * should result in exception + longjmp to the cpu loop. */ - ok = cc->tcg_ops->tlb_fill(cpu, addr, size, - access_type, mmu_idx, false, retaddr); + ok = cpu->cc->tcg_ops->tlb_fill(cpu, addr, size, + access_type, mmu_idx, false, retaddr); assert(ok); } @@ -1307,9 +1306,8 @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) { - CPUClass *cc = CPU_GET_CLASS(cpu); - - cc->tcg_ops->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); + cpu->cc->tcg_ops->do_unaligned_access(cpu, addr, access_type, + mmu_idx, retaddr); } static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr, @@ -1539,10 +1537,9 @@ static int probe_access_internal(CPUArchState *env, target_ulong addr, if (!tlb_hit_page(tlb_addr, page_addr)) { if (!victim_tlb_hit(env, mmu_idx, index, elt_ofs, page_addr)) { CPUState *cs = env_cpu(env); - CPUClass *cc = CPU_GET_CLASS(cs); - if (!cc->tcg_ops->tlb_fill(cs, addr, fault_size, access_type, - mmu_idx, nonfault, retaddr)) { + if (!cs->cc->tcg_ops->tlb_fill(cs, addr, fault_size, access_type, + mmu_idx, nonfault, retaddr)) { /* Non-faulting page table read failed. */ *phost = NULL; return TLB_INVALID_MASK;