qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: 李威威 <liweiwei@kubuds.cn>
To: "Richard Henderson" <richard.henderson@linaro.org>,
	pbonzini <pbonzini@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>
Cc: kasperl <kasperl@rivosinc.com>, 王俊强 <wangjunqiang@kubuds.cn>,
	"Wei Wu" <lazyparser@gmail.com>, liwei1518 <liwei1518@gmail.com>
Subject: Re: Re: [PATCH] accel/tcg: fix self-modify-code problem when modify code in a single tb loop
Date: Tue, 23 Sep 2025 10:04:41 +0800	[thread overview]
Message-ID: <tencent_55B681D209516B8364F39BD9@qq.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]

Richard Henderson <richard.henderson@linaro.org&gt; 于2025年9月23日周二 07:22写道:
&gt;
&gt; On 9/17/25 05:47, liweiwei@kubuds.cn wrote:
&gt; &gt; From: Weiwei Li <liweiwei@kubuds.cn&gt;
&gt; &gt;
&gt; &gt; The problem is triggered in following conditions:
&gt; &gt; - thread 1:
&gt; &gt; &nbsp; &nbsp; &nbsp;run spin loop(ended with a direct jump) like "0x0000006f, // jal zero, #0"
&gt; &gt; - thread 2:
&gt; &gt; &nbsp; &nbsp; &nbsp;do something, and then modify the loop code of thread 1 to nop isntruction,
&gt; &gt; &nbsp; &nbsp; &nbsp;finally wait thread 1 exit.
&gt; &gt;
&gt; &gt; The loop tb which is patched to jump to itself, will not be updated in this case
&gt; &gt; and will never exit.
&gt; &gt;
&gt; &gt; Signed-off-by: Weiwei Li <liweiwei@kubuds.cn&gt;
&gt; &gt; ---
&gt; &gt; &nbsp; accel/tcg/cpu-exec.c | 8 ++++++--
&gt; &gt; &nbsp; 1 file changed, 6 insertions(+), 2 deletions(-)
&gt;
&gt; If there's a problem with 1 tb, there's also a problem with 2 tb like
&gt;
&gt; &nbsp; &nbsp; &nbsp; &nbsp; jal &nbsp; &nbsp; zero, #4
&gt; &nbsp; &nbsp; &nbsp; &nbsp; jal &nbsp; &nbsp; zero, #-4
&gt;

I tried this case. And it didn't have this problem.
This problem seems only existed in single tb loop.
&gt;
&gt; But unlinking the tb should be part of invalidation, so I don't quite see where the
&gt; problem is. &nbsp;You need to expand on the description of the problem.
&gt;


I think the problem is the single tb is always in use&nbsp;&nbsp;when the single tb is linked with itself,
and it cannot be updated when we update the code。


Regards,
Weiwei Li

&gt;
&gt; r~

[-- Attachment #2: Type: text/html, Size: 2376 bytes --]

             reply	other threads:[~2025-09-23  2:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23  2:04 李威威 [this message]
2025-09-23  2:10 ` [PATCH] accel/tcg: fix self-modify-code problem when modify code in a single tb loop Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2025-09-23  7:35 李威威

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=tencent_55B681D209516B8364F39BD9@qq.com \
    --to=liweiwei@kubuds.cn \
    --cc=kasperl@rivosinc.com \
    --cc=lazyparser@gmail.com \
    --cc=liwei1518@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=wangjunqiang@kubuds.cn \
    /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).