qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Andreas Schwab <schwab@suse.de>, qemu-devel@nongnu.org
Subject: Re: linux-user emulation hangs during fork
Date: Wed, 5 Jun 2024 16:14:56 -0700	[thread overview]
Message-ID: <a0e9ee6b-fbe6-48af-a122-fbf5d31aa476@linaro.org> (raw)
In-Reply-To: <mvm5xunu4ye.fsf@suse.de>

On 6/5/24 02:14, Andreas Schwab wrote:
> $ qemu-x86_64 --version
> qemu-x86_64 version 9.0.50 (v9.0.0-1211-gd16cab541a)
> Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers
> $ cat fork.rb
> begin
>    r, w = IO.pipe
>    if pid1 = fork
>      w.close
>      r.read 1
>      Process.kill "USR1", pid1
>      Process.wait2 pid1
>    else
>      print "child\n"
>      r.close
>      if pid2 = fork
>        trap("USR1") { print "child: kill\n"; Process.kill "USR2", pid2 }
>        w.close
>        print "child: wait\n"
>        Process.wait2 pid2
>      else
>        print "grandchild\n"
>        w.close
>        sleep 0.2
>      end
>    end
> end
> $ ruby fork.rb
> child
> child: wait
> grandchild
> child: kill
> $ qemu-x86_64 /usr/bin/ruby fork.rb
> child
> child: wait
> ^Z
> [1]+  Stopped                 qemu-x86_64 /usr/bin/ruby fork.rb
> $ grep SigB $(for p in $(pidof qemu-x86_64); do echo /proc/$p/status; done | sort)
> /proc/3221/status:SigBlk:       0000000000000000
> /proc/3224/status:SigBlk:       0000000000000000
> /proc/3228/status:SigBlk:       fffffff27ffbfa9f
> 

Works for me:

rth@stoup:~/zz$ ~/qemu/bld/qemu-x86_64 `which ruby` fork.rb
child
grandchild
child: wait
child: kill
rth@stoup:~/zz$ ~/qemu/bld/qemu-x86_64 `which ruby` fork.rb
child
grandchild
child: wait
child: kill
rth@stoup:~/zz$ ~/qemu/bld/qemu-x86_64 `which ruby` fork.rb
child
grandchild
child: wait
child: kill
rth@stoup:~/zz$ ~/qemu/bld/qemu-x86_64 `which ruby` fork.rb
child
grandchild
child: wait
child: kill


r~


  parent reply	other threads:[~2024-06-05 23:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  9:14 linux-user emulation hangs during fork Andreas Schwab
2024-06-05 11:10 ` Andreas Schwab
2024-06-05 23:14 ` Richard Henderson [this message]
2024-06-06  8:27   ` Andreas Schwab
2024-06-06 14:27     ` Richard Henderson

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=a0e9ee6b-fbe6-48af-a122-fbf5d31aa476@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=schwab@suse.de \
    /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).