qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH  v1 4/8] cputlb: used cached CPUClass in our hot-paths
Date: Thu, 11 Aug 2022 16:14:09 +0100	[thread overview]
Message-ID: <20220811151413.3350684-5-alex.bennee@linaro.org> (raw)
In-Reply-To: <20220811151413.3350684-1-alex.bennee@linaro.org>

  Before: 35.912 s ±  0.168 s
  After: 35.565 s ±  0.087 s

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 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 a46f3a654d..891f3f04c5 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1303,15 +1303,14 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
 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);
 }
 
@@ -1319,9 +1318,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,
@@ -1606,10 +1604,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;
-- 
2.30.2



  parent reply	other threads:[~2022-08-11 15:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 15:14 [PATCH for 7.1 v1 0/8] memory leaks and speed tweaks Alex Bennée
2022-08-11 15:14 ` [PATCH v1 1/8] linux-user: un-parent OBJECT(cpu) when closing thread Alex Bennée
2022-08-11 15:14 ` [PATCH v1 2/8] cpu: cache CPUClass in CPUState for hot code paths Alex Bennée
2022-08-11 17:17   ` Richard Henderson
2022-08-11 23:37   ` Philippe Mathieu-Daudé via
2022-08-11 15:14 ` [PATCH v1 3/8] hw/core/cpu-sysemu: used cached class in cpu_asidx_from_attrs Alex Bennée
2022-08-11 17:17   ` Richard Henderson
2022-08-11 23:37   ` Philippe Mathieu-Daudé via
2022-08-11 15:14 ` Alex Bennée [this message]
2022-08-11 17:18   ` [PATCH v1 4/8] cputlb: used cached CPUClass in our hot-paths Richard Henderson
2022-08-11 23:39   ` Philippe Mathieu-Daudé via
2022-08-11 15:14 ` [PATCH v1 5/8] ssi: cache SSIPeripheralClass to avoid GET_CLASS() Alex Bennée
2022-08-11 15:30   ` Cédric Le Goater
2022-08-11 23:42   ` Philippe Mathieu-Daudé via
2022-08-11 15:14 ` [PATCH v1 6/8] tests/avocado: add timeout to the aspeed tests Alex Bennée
2022-08-11 23:44   ` Philippe Mathieu-Daudé via
2022-08-11 15:14 ` [PATCH v1 7/8] tests/avocado: apply a band aid to aspeed-evb login Alex Bennée
2022-08-11 15:14 ` [PATCH v1 8/8] accel/tcg: remove trace_vcpu_dstate TB checking Alex Bennée
2022-08-11 23:44   ` Philippe Mathieu-Daudé via
2022-08-11 17:05 ` [PATCH for 7.1 v1 0/8] memory leaks and speed tweaks Peter Maydell
2022-08-11 18:00   ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220811151413.3350684-5-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).