qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shaobo Song <songshaobo@eswincomputing.com>
To: zhengyu@eswincomputing.com
Cc: qemu-devel@nongnu.org, richard.henderson@linaro.org,
	alistair.francis@wdc.com,
	Shaobo Song <songshaobo@eswincomputing.com>
Subject: [PATCH] target/riscv: Fix checking of whether instruciton at 'pc_next' spans pages
Date: Mon, 20 Feb 2023 07:27:32 +0000	[thread overview]
Message-ID: <20230220072732.568-1-songshaobo@eswincomputing.com> (raw)

This bug has a noticeable behavior of falling back to the main loop and
respawning a redundant translation block including a single instruction
when the end address of the compressive instruction is exactly on a page
boundary, and slows down running system performance.

Signed-off-by: Shaobo Song <songshaobo@eswincomputing.com>
---
 target/riscv/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index 772f9d7..8ffa211 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -1261,7 +1261,7 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
                 uint16_t next_insn = cpu_lduw_code(env, ctx->base.pc_next);
                 int len = insn_len(next_insn);
 
-                if (!is_same_page(&ctx->base, ctx->base.pc_next + len)) {
+                if (!is_same_page(&ctx->base, ctx->base.pc_next + len - 1)) {
                     ctx->base.is_jmp = DISAS_TOO_MANY;
                 }
             }
-- 
2.33.1.windows.1



             reply	other threads:[~2023-02-20 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20  7:27 Shaobo Song [this message]
2023-02-21 17:36 ` [PATCH] target/riscv: Fix checking of whether instruciton at 'pc_next' spans pages Richard Henderson
2023-03-02  1:09 ` Palmer Dabbelt
  -- strict thread matches above, loose matches on Subject: below --
2023-02-20  7:29 Shaobo Song

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=20230220072732.568-1-songshaobo@eswincomputing.com \
    --to=songshaobo@eswincomputing.com \
    --cc=alistair.francis@wdc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=zhengyu@eswincomputing.com \
    /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).