[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/7] semihosting: add the semihosting_exit_request functio
Re: [PATCH v2 2/7] semihosting: add the semihosting_exit_request function
Thu, 23 Jun 2022 09:16:44 +0200
On 20:09 Wed 22 Jun , Peter Maydell wrote:
> On Tue, 21 Jun 2022 at 13:59, Luc Michel <email@example.com> 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
> -- PMM
> To declare a filtering error, please use the following link :
- [PATCH v2 0/7] semihosting: proper QEMU exit on semihosted exit syscall, Luc Michel, 2022/06/21
- [PATCH v2 2/7] semihosting: add the semihosting_exit_request function, Luc Michel, 2022/06/21
- [PATCH v2 3/7] semihosting/arm-compat-semi: use semihosting_exit_request, Luc Michel, 2022/06/21
- [PATCH v2 4/7] target/m68k: use semihosting_exit_request on semihosted exit syscall, Luc Michel, 2022/06/21
- [PATCH v2 1/7] softmmu: add qemu_[set|get]_exit_status functions, Luc Michel, 2022/06/21
- [PATCH v2 5/7] target/mips: use semihosting_exit_request on semihosted exit syscall, Luc Michel, 2022/06/21
- [PATCH v2 7/7] target/xtensa: use semihosting_exit_request on semihosted exit syscall, Luc Michel, 2022/06/21