From: "Andreas Färber" <afaerber@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>, Alexander Graf <agraf@suse.de>
Cc: Igor Mammedov <imammedo@redhat.com>,
Riku Voipio <riku.voipio@linaro.org>,
qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/9] linux-user: Don't reset a new thread's CPU
Date: Sat, 06 Jul 2013 14:40:17 +0200 [thread overview]
Message-ID: <51D81031.2080703@suse.de> (raw)
In-Reply-To: <CAFEAcA-aPgCUTau0=ap2hgjcidGVy_QQVnL2EanLZz5jW7eaaQ@mail.gmail.com>
Am 06.07.2013 12:31, schrieb Peter Maydell:
> On 6 July 2013 01:36, Alexander Graf <agraf@suse.de> wrote:
>> When we create a new thread, there is no reason to reset it. I'm fairly sure
>> the code has mostly been left in there because nobody understood why it was
>> there in the first place.
>
> We had a big discussion on this on IRC. This code is here
> because of commit b4558d748, which attempted to fix a breakage
> introduced when commit b55a37c9 made these CPUs no longer do
> a reset as part of their cpu_init().
And as I said on IRC, x86 has been fixed to reset as part of cpu_init():
http://repo.or.cz/w/qemu.git/commit/77868120cfe93ad7816dfac6546684e5a6c6e256?f=linux-user/main.c
So since this patch only removes x86 reset and leaves ppc and sparc in
place, I think this patch is more correct than what we have now.
> However, it's in the
> wrong place -- this reset needs to go into cpu_copy(), so
> it doesn't undo the copying work done by that function.
The remaining question Eduardo raised was whether not resetting after
fiddling with fields might cause some kind of inconsistency in the CPU.
But since the current code effectively undoes the effects of cpu_copy(),
I'm willing to pick up this patch as follow-up to my earlier refactoring
(and 6/9 if ack'ed as follow-up to Peter's refactoring) for qom-cpu.
The commit message would need to be reworked though to reference why
this can be done for x86. And we'd still need a follow-up solution for
ppc and sparc.
Peter's suggestion was that we run LTP in a chroot to verify whether our
respective solutions break anything badly:
http://wiki.qemu.org/Testing/LTP
(BTW the May 2013 stable version is available now)
>> Remove the reset. A new thread's kernel sided state should be identical to
>> the old one's.
>
> Just deleting the reset isn't right. We should standardize
> whether we think cpu_init() ought to give you a cleanly
> reset CPU or not (I think it should);
+1
Specifically as part of QOM realize, which - once cpu_init() is gone -
linux-user/bsd-user would trivially invoke directly after object_new().
softmmu would do it after the future QMP qom-set phase. The mess there
is reset handler registration order: We cannot have most CPUs register a
reset handler themselves yet because some machines (including most ARM
ones) register reset handlers to tweak registers before the CPU would
have reset in that future scenario.
> until then, we should
> put a cpu_reset() immediately after cpu_init() in cpu_copy().
> It doesn't need to be ifdef-guarded either.
Will test and post my patch to that effect.
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-07-06 12:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-06 0:36 [Qemu-devel] [PATCH 0/9] linux-user: Wine enablement patch set Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 1/9] linux-user: fix segmentation fault passing with h2g(x) != x Alexander Graf
2013-07-06 10:27 ` Peter Maydell
2013-07-06 0:36 ` [Qemu-devel] [PATCH 2/9] linux-user: Add is_write segfault check for ARM hosts Alexander Graf
2013-07-06 10:24 ` Peter Maydell
2013-07-06 10:28 ` Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 3/9] linux-user: Don't reset a new thread's CPU Alexander Graf
2013-07-06 10:31 ` Peter Maydell
2013-07-06 12:40 ` Andreas Färber [this message]
2013-07-06 12:44 ` Peter Maydell
2013-07-06 13:14 ` Andreas Färber
2013-07-06 0:36 ` [Qemu-devel] [PATCH 4/9] linux-user: Fix sendrecvmsg() with QEMU_GUEST_BASE Alexander Graf
2013-07-06 10:42 ` Peter Maydell
2013-07-06 10:47 ` Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 5/9] linux-user: Fix epoll on ARM hosts Alexander Graf
2013-07-06 10:45 ` Peter Maydell
2013-07-06 10:48 ` Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 6/9] linux-user: Add i386 TLS setter Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 7/9] linux-user: Enable NPTL for i386 Alexander Graf
2013-07-06 10:48 ` Peter Maydell
2013-07-06 10:49 ` Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 8/9] linux-user: Default to 64k guest base Alexander Graf
2013-07-06 0:36 ` [Qemu-devel] [PATCH 9/9] linux-user: Unlock mmap_lock when resuming guest from page_unprotect Alexander Graf
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=51D81031.2080703@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@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).