From patchwork Tue Oct 4 19:52:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 612301 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp395860pvb; Tue, 4 Oct 2022 12:55:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5znyFrOP2s6EqRIQuSPA0iPAjh7AJAS5J5l7MzELgzzjil4W8o1pvxLXkOod/pebre0H7O X-Received: by 2002:a05:620a:987:b0:6cb:cdf2:ee34 with SMTP id x7-20020a05620a098700b006cbcdf2ee34mr17523704qkx.429.1664913308004; Tue, 04 Oct 2022 12:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664913308; cv=none; d=google.com; s=arc-20160816; b=WKuUW8/adIi6dhFRyg+s49k036otOS2auWTxbLY3JgKXnY75GVDmeF8D5XPE3uOuB/ aDNmbsoJuiPeOA/S6w+g4mU9dLVkANljMgNg1BrwKyDuRq4IkjjqI7FIBjf++JIKVYNP PkaH7iaQN1o7lB5wRdHKHfXBwgu9aPuXUArfRtgTU4wJ6GkSQT5tOLzXMZXXVf5Tt4rA U6kPYDae9Htw1SUU8JYLvNfPn5r1aDAXZTvEs+pPnlh8Na+r3ZXDnd/U9iewJONQ/JSY 02WZHJbtrFmdE8YDfJvQzORc1quQ2oNs/bPhQQymlxJkMwKS4vEbj1ExaECaMY+IXL0Z 8Z2g== 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=q0eg+3QiI3aRqtvdrrAtNwv7hcqy9NWtzJtlLArJ6SQ=; b=uXPFMEkxDuUGl0EczkI4H+C3JIbOg/ycRMbXXHIIXcbcV3YN8dJMwBmuRhywLqLTd5 Be+FsSWXXgVoDE36VkYyhtPmu/b3n9R+FxfqLkb7H779aabk+UVTpKuywIcizZpZxbL6 y/GgmzlxhH4hl8D+aHJuiHmcp0jZuvCZ4kk830Qt6BCIoLcDvypoi5azbLHwFGV/4c49 kyUqQgj9bn9MCYTV93h/BDHj8BfhQED1TRuSWoi8hhKC2kqsyp5IS0DExn5u2Tlytdhb pF/s4XLFI/74ZN6AsFmWg1ARzt6ZqJ/kJPgWxEjoJjbYPhgW+vjrADlc5QQTRnrRwbqM oG/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MF2kf+e3; 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 v2-20020a05620a0f0200b006cf4d30dd61si6212692qkl.542.2022.10.04.12.55.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Oct 2022 12:55:07 -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=MF2kf+e3; 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]:34360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofo0R-0001lJ-Gi for patch@linaro.org; Tue, 04 Oct 2022 15:55:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofnyD-0001hq-Kv for qemu-devel@nongnu.org; Tue, 04 Oct 2022 15:52:50 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:34357) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofnyB-0000FZ-2D for qemu-devel@nongnu.org; Tue, 04 Oct 2022 15:52:49 -0400 Received: by mail-pl1-x633.google.com with SMTP id n7so13566911plp.1 for ; Tue, 04 Oct 2022 12:52:46 -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=q0eg+3QiI3aRqtvdrrAtNwv7hcqy9NWtzJtlLArJ6SQ=; b=MF2kf+e30KGYajtSlps4xlAxA2V5HaJx31EtVVrG9j427FWLhwxps+HcmV3H3a4cWg 1jnddZBhLWiTia5Wxpjk6eCsKB+iMEK2ZPVNBpyyGGke1kywWbWtyRVHn64hkt27fv1K GwVwTSoHHb3NPpF/s4Prs0wvhca4t69/fj+aRoMGrsby9XUf6IZrtJodFJYfmGmNrb45 uwQLqRYeTHq6rBGPBRlN8+xBJjHpFGXLCd8tPJ7cR/dNQUjwuNdBS3SuUU604J00l8Jb X5OF70vUPRbFKq4J5/YzBQXwHswPECr/faTt8H3rJ2Jq/a+5TXUB2Duno9yi2OqPizue TynA== 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=q0eg+3QiI3aRqtvdrrAtNwv7hcqy9NWtzJtlLArJ6SQ=; b=hTH145/z0+HsCsfvA4Ab0NU26Jb/DAJqrtuAlqCsz8A8K+xG2i26y47gnIsTz0tHiI XunJMoh3B48aUz9pT4lkzrp0QdBqfPDTN8+oYcb9J0JMmAOQZFOOqUxz4+MybHm1FCdY gH8R8Kwm8NVdwHxv6qi+plevB5QV6lh2nMb9letwWfk/H1Pij+RCreUIvTlJsLyyUOkb sFHwxSSNe7pbI0qRE660p/Uj9erXGzeFrQlDrnx+6+nNYJ6cYiPDxvtqxvDEQcoMmMlN EO70SsQbiwJIJc32LVJbCHBIDY3UYL0Wq39ow3kSeEsgA1vOLK6tdQpOP5drYkblugDR wuow== X-Gm-Message-State: ACrzQf2nW3T5wKaSNyqI7u0sJgkb7lfMy5QUVMN+FYEATuWCSzgoTpqA LZpWQSHFTRw80e/7Uh4q4BnTpzp9if2avQ== X-Received: by 2002:a17:902:edcd:b0:17a:6fa:228d with SMTP id q13-20020a170902edcd00b0017a06fa228dmr28581603plk.29.1664913165607; Tue, 04 Oct 2022 12:52:45 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:526e:3326:a84e:e5e3]) by smtp.gmail.com with ESMTPSA id u23-20020a1709026e1700b00172973d3cd9sm9293406plk.55.2022.10.04.12.52.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 12:52:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?C=C3=A9dri?= =?utf-8?q?c_Le_Goater?= Subject: [PULL 03/20] cputlb: used cached CPUClass in our hot-paths Date: Tue, 4 Oct 2022 12:52:24 -0700 Message-Id: <20221004195241.46491-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221004195241.46491-1-richard.henderson@linaro.org> References: <20221004195241.46491-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 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 Message-Id: <20220923084803.498337-5-clg@kaod.org> Signed-off-by: Richard Henderson --- 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 8fad2d9b83..193bfc1cfc 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;