From: Richard Henderson <richard.henderson@linaro.org>
To: "Ilya Leoshkevich" <iii@linux.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, Christian Borntraeger <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v2 2/4] cpus: Make {start,end}_exclusive() recursive
Date: Mon, 13 Feb 2023 10:12:42 -1000 [thread overview]
Message-ID: <cc54f8b9-a8c6-9606-415d-fe8a26bf09bf@linaro.org> (raw)
In-Reply-To: <20230213125238.331881-3-iii@linux.ibm.com>
On 2/13/23 02:52, Ilya Leoshkevich wrote:
> Currently dying to one of the core_dump_signal()s deadlocks, because
> dump_core_and_abort() calls start_exclusive() two times: first via
> stop_all_tasks(), and then via preexit_cleanup() ->
> qemu_plugin_user_exit().
>
> There are a number of ways to solve this: resume after dumping core;
> check cpu_in_exclusive_context() in qemu_plugin_user_exit(); or make
> {start,end}_exclusive() recursive. Pick the last option, since it's
> the most straightforward one.
>
> Fixes: da91c1920242 ("linux-user: Clean up when exiting due to a signal")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
> cpus-common.c | 12 ++++++++++--
> include/hw/core/cpu.h | 4 ++--
> 2 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/cpus-common.c b/cpus-common.c
> index 793364dc0ed..a0c52cd187f 100644
> --- a/cpus-common.c
> +++ b/cpus-common.c
> @@ -192,6 +192,11 @@ void start_exclusive(void)
> CPUState *other_cpu;
> int running_cpus;
>
> + if (current_cpu->exclusive_context_count) {
> + current_cpu->exclusive_context_count++;
> + return;
> + }
> +
> qemu_mutex_lock(&qemu_cpu_list_lock);
> exclusive_idle();
>
> @@ -219,13 +224,16 @@ void start_exclusive(void)
> */
> qemu_mutex_unlock(&qemu_cpu_list_lock);
>
> - current_cpu->in_exclusive_context = true;
> + current_cpu->exclusive_context_count++;
I think this line would be clearer as "= 1".
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
next prev parent reply other threads:[~2023-02-13 20:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 12:52 [PATCH v2 0/4] Fix deadlock when dying because of a signal Ilya Leoshkevich
2023-02-13 12:52 ` [PATCH v2 1/4] linux-user: Always exit from exclusive state in fork_end() Ilya Leoshkevich
2023-02-13 20:06 ` Richard Henderson
2023-02-14 9:26 ` Alex Bennée
2023-02-13 12:52 ` [PATCH v2 2/4] cpus: Make {start,end}_exclusive() recursive Ilya Leoshkevich
2023-02-13 20:12 ` Richard Henderson [this message]
2023-02-14 9:26 ` Alex Bennée
2023-02-13 12:52 ` [PATCH v2 3/4] linux-user/microblaze: Handle privileged exception Ilya Leoshkevich
2023-02-13 12:52 ` [PATCH v2 4/4] tests/tcg/linux-test: Add linux-fork-trap test Ilya Leoshkevich
2023-02-14 9:51 ` Alex Bennée
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=cc54f8b9-a8c6-9606-415d-fe8a26bf09bf@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=borntraeger@linux.ibm.com \
--cc=eduardo@habkost.net \
--cc=iii@linux.ibm.com \
--cc=laurent@vivier.eu \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.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).