From: Michael Matz <matz@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: linaro-dev <linaro-dev@lists.linaro.org>,
"Dann Frazier" <dann.frazier@canonical.com>,
"Alexander Graf" <agraf@suse.de>,
"linaro-toolchain@lists.linaro.org"
<linaro-toolchain@lists.linaro.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Wook Wookey" <wookey@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Andreas Färber" <afaerber@suse.de>,
"Christoffer Dall" <Christoffer.Dall@linaro.org>
Subject: Re: [Qemu-devel] Call for testing QEMU aarch64-linux-user emulation
Date: Tue, 25 Feb 2014 15:56:06 +0100 (CET) [thread overview]
Message-ID: <alpine.LNX.2.00.1402251520350.7694@wotan.suse.de> (raw)
In-Reply-To: <CAFEAcA8DA_NZ=CV9B9OoTAUP+R+n9Q8tJyzMUu_yx=-Nj9XMCA@mail.gmail.com>
Hi,
On Tue, 25 Feb 2014, Peter Maydell wrote:
> On 25 February 2014 13:33, Michael Matz <matz@suse.de> wrote
> > The biggest road-block is that signal vs syscall handling is
> > fundamentally broken in linux-user and it's unfixable without
> > assembler implementations of the syscall caller.
>
> I'm not entirely sure it's possible to fix even with
> hand-rolled assembly, to be honest.
I am fairly sure. The problem is "simply" to detect if the signal arrived
while inside the kernel (doing the syscalls job) or still or already
outside. This structure helps with that:
before:
setup args and stuff for syscall to do
atsys:
syscall insn (single insn!)
after:
mov return, return-register-per-psABI
realafter:
rest of stuff
When a signal arrives you look at the return address the kernel puts into
the siginfo. Several cases:
* before <= retaddr < atsys:
syscall hasn't yet started, so break syscall sequence, handle signal in
main loop, redo the syscall.
* atsys == retaddr
syscall has started and the kernel wants to restart it after sighandler
returns, _or_ syscall was just about to be started. No matter what,
the right thing to do is to actually do the syscall (again) after
handling the signal. So break syscall sequence, handle signal in main
loop, (re)do the syscall.
* after <= retaddr < realafter:
syscall is complete but return value not yet in some variable but still
in register (or other post-syscall work that still needs doing isn't
complete yet); nothing interesting to do, just let it continue with the
syscall sequence, handle signal in main loop after that one returned.
* retaddr any other value:
uninteresting; actually I'm not sure we'd need the distinction between
after and realafter. Handle signal as usual in main loop.
The important thing for qemu is to know precisely if the signal arrived
before the syscall was started (or is to be restarted), or after it
returned, and for that the compiler must not be allowed to insert any code
between atsys and after.
> However there are a bunch of bugfixes in your tree
> which it would be really nice to see upstreamed:
> the sendmmsg patch, for instance. We can at least
> get the aarch64 support to the same level as the
> 32 bit arm linux-user setup, which is genuinely
> useful to people despite the well known races and
> locking issues.
Yeah.
Ciao,
Michael.
next prev parent reply other threads:[~2014-02-25 14:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 13:40 [Qemu-devel] Call for testing QEMU aarch64-linux-user emulation Alex Bennée
2014-02-24 13:01 ` Janne Grunau
2014-02-25 15:54 ` Alex Bennée
2014-02-25 17:11 ` Janne Grunau
2014-03-06 11:40 ` Alex Bennée
2014-03-06 16:04 ` Janne Grunau
2014-02-24 20:58 ` Dann Frazier
2014-02-25 8:39 ` Alex Bennée
2014-02-25 8:49 ` Andreas Färber
2014-02-25 13:33 ` Michael Matz
2014-02-25 13:46 ` Peter Maydell
2014-02-25 14:56 ` Michael Matz [this message]
2014-02-28 14:12 ` Alex Bennée
2014-02-28 14:21 ` Peter Maydell
2014-02-28 14:27 ` Alexander Graf
2014-02-28 14:49 ` Peter Maydell
2014-02-28 17:08 ` Alex Bennée
2014-02-28 17:17 ` Peter Maydell
2014-02-26 22:06 ` Dann Frazier
2014-02-27 13:20 ` Michael Matz
2014-02-27 19:47 ` Dann Frazier
2014-03-14 14:20 ` Peter Maydell
2014-03-09 23:37 ` Dann Frazier
2014-03-09 23:51 ` Peter Maydell
2014-03-10 11:28 ` Alex Bennée
2014-03-10 11:45 ` Peter Maydell
2014-03-10 13:56 ` Michael Matz
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=alpine.LNX.2.00.1402251520350.7694@wotan.suse.de \
--to=matz@suse.de \
--cc=Christoffer.Dall@linaro.org \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=alex.bennee@linaro.org \
--cc=dann.frazier@canonical.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linaro-toolchain@lists.linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wookey@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).