From: Igor Mammedov <imammedo@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
qemu-devel@nongnu.org,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Helge Deller" <deller@gmx.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
qemu-ppc@nongnu.org, "Zhao Liu" <zhao1.liu@intel.com>
Subject: Re: [PATCH 4/4] tcg:tlb: use tcg_debug_assert() in assert_cpu_is_self()
Date: Wed, 26 Feb 2025 14:31:16 +0100 [thread overview]
Message-ID: <20250226143116.3d575622@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <c7c2d873-3ea7-41a5-8842-1ebf33b5a560@linaro.org>
On Tue, 25 Feb 2025 12:02:02 -0800
Richard Henderson <richard.henderson@linaro.org> wrote:
> On 2/25/25 10:46, Alex Bennée wrote:
> > From: Igor Mammedov <imammedo@redhat.com>
> >
> > that will enable assert_cpu_is_self when QEMU is configured with
> > --enable-debug
> > without need for manual patching DEBUG_TLB_GATE define.
> >
> > Need to manually path DEBUG_TLB_GATE define to enable assert,
> > let regression caused by [1] creep in unnoticed.
> >
> > 1) 30933c4fb4f3d ("tcg/cputlb: remove other-cpu capability from TLB flushing")
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > Suggested-by: Alex Bennée <alex.bennee@linaro.org>
> > Message-Id: <20250207162048.1890669-5-imammedo@redhat.com>
> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> > ---
> > accel/tcg/cputlb.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
> > index fc16a576f0..65b04b1055 100644
> > --- a/accel/tcg/cputlb.c
> > +++ b/accel/tcg/cputlb.c
> > @@ -73,11 +73,8 @@
> > } \
> > } while (0)
> >
> > -#define assert_cpu_is_self(cpu) do { \
> > - if (DEBUG_TLB_GATE) { \
> > - g_assert(!(cpu)->created || qemu_cpu_is_self(cpu)); \
> > - } \
> > - } while (0)
> > +#define assert_cpu_is_self(cpu) \
> > + tcg_debug_assert(!(cpu)->created || qemu_cpu_is_self(cpu))
>
> I think this check is just wrong or incomplete.
the point of the path is to bring out check out of ifdef limbo.
Whether it's correct or not it's up to another patch to fix.
> The intent here is to check that we're not attempting to modify the softmmu tlb
> asynchronously while a cpu is running.
>
> (0) A synchronous flush to the current cpu is (obviously?) ok.
> (1) A flush to a cpu that is not yet created is (or should be) a no-op.
my another patch that was touching the check
"[PATCH v2 06/10] tcg: drop cpu->created check"
is trying to remove (abusing)usage of cpu->created
which should be used only for syncing main loop and
a to be created vcpu thread.
The creation of vcpu is not really complete yet by
this point so it depends on luck (being nop).
End goal from my side is to get rid of users that
use cpu->created as workaround to move from one
incomplete vcpu state to another still incomplete state.
We can drop the check after reset/postload paths are
fixed to schedule async flush.
> Not checked here are any of the other reasons a flush might be ok:
>
> (2) The system as a whole is stopped, on the way in from migration/vmload.
> (3) The cpu is offline, on the way in from poweroff/reset.
>
> If we decide that {1, 2, 3} are too complicated to check, then perhaps the solution to
> queue flushes to the cpu's workqueue is the appropriate solution. But so far all I see is
> that we have an incomplete check, and no ready explanation for why that check can't be
> improved.
>
>
> r~
>
prev parent reply other threads:[~2025-02-26 13:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 18:46 [PATCH 0/4] cputlb: add tlb_flush_other_cpu Alex Bennée
2025-02-25 18:46 ` [PATCH 1/4] target/ppc: drop ppc_tlb_invalidate_all from cpu_reset Alex Bennée
2025-02-25 19:32 ` Richard Henderson
2025-02-27 0:40 ` Nicholas Piggin
2025-02-25 18:46 ` [PATCH 2/4] target/hppa: defer hppa_ptlbe until CPU starts running Alex Bennée
2025-02-25 19:33 ` Richard Henderson
2025-02-25 19:38 ` Richard Henderson
2025-02-27 9:05 ` Nicholas Piggin
2025-02-27 10:10 ` Alex Bennée
2025-02-25 18:46 ` [PATCH 3/4] cputlb: introduce tlb_flush_other_cpu for reset use Alex Bennée
2025-02-25 19:49 ` Richard Henderson
2025-02-26 14:29 ` Alex Bennée
2025-02-26 17:59 ` Richard Henderson
2025-02-25 18:46 ` [PATCH 4/4] tcg:tlb: use tcg_debug_assert() in assert_cpu_is_self() Alex Bennée
2025-02-25 20:02 ` Richard Henderson
2025-02-25 20:04 ` Richard Henderson
2025-02-26 13:42 ` Igor Mammedov
2025-02-26 13:31 ` Igor Mammedov [this message]
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=20250226143116.3d575622@imammedo.users.ipa.redhat.com \
--to=imammedo@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=danielhb413@gmail.com \
--cc=deller@gmx.de \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zhao1.liu@intel.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).