From: Luc Michel <lmichel@kalray.eu>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Eric Blake" <eblake@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Laurent Vivier" <laurent@vivier.eu>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Chris Wulff" <crwulff@gmail.com>, "Marek Vasut" <marex@denx.de>,
"Max Filippov" <jcmvbkbc@gmail.com>
Subject: Re: [PATCH v2 2/7] semihosting: add the semihosting_exit_request function
Date: Thu, 23 Jun 2022 09:16:44 +0200 [thread overview]
Message-ID: <20220623071644.GA31252@ws2101.lin.mbt.kalray.eu> (raw)
In-Reply-To: <CAFEAcA-Z=rYWnpceM-Ojvi2QoxkmZzSZqnjKgH1WFdwCDi9O3A@mail.gmail.com>
On 20:09 Wed 22 Jun , Peter Maydell wrote:
> On Tue, 21 Jun 2022 at 13:59, Luc Michel <lmichel@kalray.eu> wrote:
> >
> > Add the semihosting_exit_request function to be used by targets when
> > handling an `exit' semihosted syscall. This function calls gdb_exit to
> > close existing GDB connections, and qemu_system_shutdown_request with
> > the new `guest-semi-exit' exit reason. It sets the QEMU exit status
> > given by the exit syscall parameter. Finally it stops the CPU to prevent
> > further execution, and exit the CPU loop as the syscall caller expects
> > this syscall to not return.
> >
> > This function is meant to be used in place of a raw exit() call when
> > handling semihosted `exit' syscalls. Such a call is not safe because
> > it does not allow other CPU threads to exit properly, leading to e.g.
> > at_exit callbacks being called while other CPUs still run. This can lead
> > to strange bugs, especially in plugins with a registered at_exit function.
>
> This is mixing up two things:
> (1) fixing bugs with the plugin code when code (semihosting or
> otherwise) calls exit()
> (2) reporting to the monitor when the guest exits because it
> asked to via semihosting
>
> I remain unconvinced that this series is actually fixing (1),
> I think it's just working around the most common cause of it.
> For (2), maybe we want it, but that should I think be a
> separate patchset with justification of why it's useful to
> tell the monitor about it. I think on balance it probably
> is a good idea, but I disagree about (1) and would like to
> see these two things not tangled up in the same series.
OK. I'll rework this once Richard's semihosting cleanup series is
merged.
thanks.
Luc
>
> thanks
> -- PMM
>
>
> To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=11a39.62b36915.466b.0&r=lmichel%40kalray.eu&s=peter.maydell%40linaro.org&o=Re%3A+%5BPATCH+v2+2%2F7%5D+semihosting%3A+add+the+semihosting_exit_request+function&verdict=C&c=b75eec0eae9b68db747812558b665a75218eca91
>
--
next prev parent reply other threads:[~2022-06-23 7:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 12:59 [PATCH v2 0/7] semihosting: proper QEMU exit on semihosted exit syscall Luc Michel
2022-06-21 12:59 ` [PATCH v2 1/7] softmmu: add qemu_[set|get]_exit_status functions Luc Michel
2022-06-21 13:22 ` Laurent Vivier
2022-06-21 12:59 ` [PATCH v2 2/7] semihosting: add the semihosting_exit_request function Luc Michel
2022-06-21 13:33 ` Laurent Vivier
2022-06-22 16:19 ` Eric Blake
2022-06-22 19:09 ` Peter Maydell
2022-06-23 7:16 ` Luc Michel [this message]
2022-06-21 12:59 ` [PATCH v2 3/7] semihosting/arm-compat-semi: use semihosting_exit_request Luc Michel
2022-06-21 13:34 ` Laurent Vivier
2022-06-21 12:59 ` [PATCH v2 4/7] target/m68k: use semihosting_exit_request on semihosted exit syscall Luc Michel
2022-06-21 13:37 ` Laurent Vivier
2022-06-21 12:59 ` [PATCH v2 5/7] target/mips: " Luc Michel
2022-06-21 13:35 ` Laurent Vivier
2022-06-21 12:59 ` [PATCH v2 6/7] target/nios2: " Luc Michel
2022-06-21 13:35 ` Laurent Vivier
2022-06-21 12:59 ` [PATCH v2 7/7] target/xtensa: " Luc Michel
2022-06-21 13:36 ` Laurent Vivier
2022-06-21 14:37 ` [PATCH v2 0/7] semihosting: proper QEMU exit " Richard Henderson
2022-06-22 7:11 ` Luc Michel
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=20220623071644.GA31252@ws2101.lin.mbt.kalray.eu \
--to=lmichel@kalray.eu \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=crwulff@gmail.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=laurent@vivier.eu \
--cc=marex@denx.de \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).