[Qemu-devel] [RFC 0/2] Improve qemu-thread support on macOS

Roman Bolshakov posted 2 patches 5 years, 3 months ago
Test checkpatch passed
Test asan passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181217202602.31113-1-r.bolshakov@yadro.com
configure                | 32 ++++++++++++++++++++++++++------
qemu-options.hx          |  4 ++--
util/qemu-thread-posix.c | 11 ++++++++++-
3 files changed, 38 insertions(+), 9 deletions(-)
[Qemu-devel] [RFC 0/2] Improve qemu-thread support on macOS
Posted by Roman Bolshakov 5 years, 3 months ago
Hello,

I've hit a case where QEMU hangs not responding to anything except
SIGKILL. It turned out to be a SIGSEGV in vCPU thread that was lost by
masking all signals.

By blocking too many signals QEMU relies on undefined behaviour that
seems to work on Linux. It's documented in POSIX reference and
sigprocmask(2). Indeed signalfd(2) on Linux notes that it can't be used
to receive SIGSEGV and SIGFPE.

It's not clear what do with SIGBUS on macOS. We can't blindly unblock it
as it's used for memory preallocation.

Also the RFC adds support for thread naming on macOS. Some threads
(signalfd_compat and rcu_call) are created before debug-threads=on is
parsed and don't get their names though.

Thank you,
Roman

Roman Bolshakov (2):
  util: Implement debug-threads for macOS
  qemu-thread: Don't block SEGV, ILL and FPE

 configure                | 32 ++++++++++++++++++++++++++------
 qemu-options.hx          |  4 ++--
 util/qemu-thread-posix.c | 11 ++++++++++-
 3 files changed, 38 insertions(+), 9 deletions(-)

-- 
2.19.1


Re: [Qemu-devel] [RFC 0/2] Improve qemu-thread support on macOS
Posted by Peter Maydell 5 years, 2 months ago
On Mon, 17 Dec 2018 at 20:46, Roman Bolshakov <r.bolshakov@yadro.com> wrote:
>
> Hello,
>
> I've hit a case where QEMU hangs not responding to anything except
> SIGKILL. It turned out to be a SIGSEGV in vCPU thread that was lost by
> masking all signals.
>
> By blocking too many signals QEMU relies on undefined behaviour that
> seems to work on Linux. It's documented in POSIX reference and
> sigprocmask(2). Indeed signalfd(2) on Linux notes that it can't be used
> to receive SIGSEGV and SIGFPE.
>
> It's not clear what do with SIGBUS on macOS. We can't blindly unblock it
> as it's used for memory preallocation.
>
> Also the RFC adds support for thread naming on macOS. Some threads
> (signalfd_compat and rcu_call) are created before debug-threads=on is
> parsed and don't get their names though.

Applied to master, thanks.

-- PMM