From: Ilya Leoshkevich <iii@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Laurent Vivier" <laurent@vivier.eu>
Subject: Re: [PATCH 3/3] accel/tcg: Implement cpu_exec_reset_hold() on user emulation
Date: Fri, 10 Jan 2025 00:43:34 +0100 [thread overview]
Message-ID: <6d1171d8debb462f468bb47ff875e0e9db253b4e.camel@linux.ibm.com> (raw)
In-Reply-To: <20250102182521.65428-4-philmd@linaro.org>
On Thu, 2025-01-02 at 19:25 +0100, Philippe Mathieu-Daudé wrote:
> Commit bb6cf6f0168 ("accel/tcg: Factor tcg_cpu_reset_hold()
> out") wanted to restrict tlb_flush() to system emulation,
> but inadvertently also restricted tcg_flush_jmp_cache(),
> which was before called on user emulation via:
>
> Realize -> Reset -> cpu_common_reset_hold()
>
> Since threads (vCPUs) use a common CPUJumpCache, when many
> threads are created / joined, they eventually end re-using
> a CPUJumpCache entry, which was cleared when the first vCPU
> was allocated (via Realize) but then stayed dirty, leading to:
How are jump caches shared between qemu-user vCPUs?
I found the following, but this looks private and zeroed out
during initialization:
bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
[...]
cpu->tb_jmp_cache = g_new0(CPUJumpCache, 1);
I was also wondering whether vCPUs themselves may be recycled, but
it doesn't seem to be the case, since do_fork() -> cpu_copy() ->
cpu_create() -> object_new() -> object_new_with_type() calls
g_malloc().
Btw, I tried to reproduce the original issue, but bumped into something
seemingly unrelated. To make matters worse, debugging seems to be
broken, so it may take some time before I can properly test this
change.
Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 37607.37622]
0x000002aa00a6a64c in cs_option (ud=140251083477344,
type=CS_OPT_SYNTAX, value=2) at capstone/cs.c:782
782 return arch_configs[handle->arch].arch_option(handle,
type, value);
(gdb) info threads
Ignoring packet error, continuing...
next prev parent reply other threads:[~2025-01-09 23:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 18:25 [PATCH 0/3] linux-user: Call tcg_flush_jmp_cache() before re-using threads Philippe Mathieu-Daudé
2025-01-02 18:25 ` [PATCH 1/3] linux-user: Only include 'exec/tb-flush.h' header when necessary Philippe Mathieu-Daudé
2025-01-09 22:13 ` Ilya Leoshkevich
2025-01-22 0:41 ` Pierrick Bouvier
2025-01-02 18:25 ` [PATCH 2/3] accel/tcg: Factor out common tcg_exec_reset() helper Philippe Mathieu-Daudé
2025-01-09 22:16 ` Ilya Leoshkevich
2025-01-22 0:41 ` Pierrick Bouvier
2025-01-02 18:25 ` [PATCH 3/3] accel/tcg: Implement cpu_exec_reset_hold() on user emulation Philippe Mathieu-Daudé
2025-01-09 23:43 ` Ilya Leoshkevich [this message]
2025-01-14 20:52 ` Ilya Leoshkevich
2025-01-22 0:46 ` Pierrick Bouvier
2025-01-09 10:59 ` [PATCH 0/3] linux-user: Call tcg_flush_jmp_cache() before re-using threads Philippe Mathieu-Daudé
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=6d1171d8debb462f468bb47ff875e0e9db253b4e.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
/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).