From nobody Tue Nov 26 16:38:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706464170223408.0977363089172; Sun, 28 Jan 2024 09:49:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rU9GQ-0005vy-5T; Sun, 28 Jan 2024 12:48:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9GB-0005rK-ST; Sun, 28 Jan 2024 12:48:01 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rU9G9-0000FO-Kk; Sun, 28 Jan 2024 12:47:59 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BE03C480DC; Sun, 28 Jan 2024 20:48:40 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 432126D4D6; Sun, 28 Jan 2024 20:47:49 +0300 (MSK) Received: (nullmailer pid 811305 invoked by uid 1000); Sun, 28 Jan 2024 17:47:47 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Paolo Bonzini , Michael Tokarev Subject: [Stable-7.2.9 22/30] accel/tcg: Revert mapping of PCREL translation block to multiple virtual addresses Date: Sun, 28 Jan 2024 20:47:35 +0300 Message-Id: <20240128174747.811264-2-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1706464171423100003 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini This is causing regressions that have not been analyzed yet. Revert the change on stable branches. Cc: qemu-stable@nongnu.org Cc: Michael Tokarev Related: https://gitlab.com/qemu-project/qemu/-/issues/2092 Signed-off-by: Paolo Bonzini Signed-off-by: Michael Tokarev diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 356fe348de..68fef3e01f 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -186,7 +186,7 @@ static bool tb_lookup_cmp(const void *p, const void *d) const TranslationBlock *tb =3D p; const struct tb_desc *desc =3D d; =20 - if ((TARGET_TB_PCREL || tb_pc(tb) =3D=3D desc->pc) && + if (tb_pc(tb) =3D=3D desc->pc && tb_page_addr0(tb) =3D=3D desc->page_addr0 && tb->cs_base =3D=3D desc->cs_base && tb->flags =3D=3D desc->flags && @@ -238,7 +238,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu= , target_ulong pc, return NULL; } desc.page_addr0 =3D phys_pc; - h =3D tb_hash_func(phys_pc, (TARGET_TB_PCREL ? 0 : pc), + h =3D tb_hash_func(phys_pc, pc, flags, cflags, *cpu->trace_dstate); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); } diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 0cdb35548c..9d9f651c78 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -34,7 +34,7 @@ static bool tb_cmp(const void *ap, const void *bp) const TranslationBlock *a =3D ap; const TranslationBlock *b =3D bp; =20 - return ((TARGET_TB_PCREL || tb_pc(a) =3D=3D tb_pc(b)) && + return (tb_pc(a) =3D=3D tb_pc(b) && a->cs_base =3D=3D b->cs_base && a->flags =3D=3D b->flags && (tb_cflags(a) & ~CF_INVALID) =3D=3D (tb_cflags(b) & ~CF_INVALI= D) && @@ -269,7 +269,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb,= bool rm_from_page_list) =20 /* remove the TB from the hash list */ phys_pc =3D tb_page_addr0(tb); - h =3D tb_hash_func(phys_pc, (TARGET_TB_PCREL ? 0 : tb_pc(tb)), + h =3D tb_hash_func(phys_pc, tb_pc(tb), tb->flags, orig_cflags, tb->trace_vcpu_dstate); if (!qht_remove(&tb_ctx.htable, tb, h)) { return; @@ -459,7 +459,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb, tb= _page_addr_t phys_pc, } =20 /* add in the hash table */ - h =3D tb_hash_func(phys_pc, (TARGET_TB_PCREL ? 0 : tb_pc(tb)), + h =3D tb_hash_func(phys_pc, tb_pc(tb), tb->flags, tb->cflags, tb->trace_vcpu_dstate); qht_insert(&tb_ctx.htable, tb, h, &existing_tb); =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index ac3ee3740c..ed8ddee6e8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -818,9 +818,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, =20 gen_code_buf =3D tcg_ctx->code_gen_ptr; tb->tc.ptr =3D tcg_splitwx_to_rx(gen_code_buf); -#if !TARGET_TB_PCREL tb->pc =3D pc; -#endif tb->cs_base =3D cs_base; tb->flags =3D flags; tb->cflags =3D cflags; diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 9b7bfbf09a..db677c856b 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -503,7 +503,6 @@ struct tb_tc { }; =20 struct TranslationBlock { -#if !TARGET_TB_PCREL /* * Guest PC corresponding to this block. This must be the true * virtual address. Therefore e.g. x86 stores EIP + CS_BASE, and @@ -518,7 +517,6 @@ struct TranslationBlock { * deposited into the "current" PC. */ target_ulong pc; -#endif =20 /* * Target-specific data associated with the TranslationBlock, e.g.: @@ -604,11 +602,7 @@ struct TranslationBlock { /* Hide the read to avoid ifdefs for TARGET_TB_PCREL. */ static inline target_ulong tb_pc(const TranslationBlock *tb) { -#if TARGET_TB_PCREL - qemu_build_not_reached(); -#else return tb->pc; -#endif } =20 /* Hide the qatomic_read to make code a little easier on the eyes */ --=20 2.39.2