From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tf2MP-00030e-Ak for qemu-devel@nongnu.org; Sun, 02 Dec 2012 00:45:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tf2MO-0001Ql-6t for qemu-devel@nongnu.org; Sun, 02 Dec 2012 00:45:01 -0500 Received: from cantor2.suse.de ([195.135.220.15]:40204 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tf2MN-0001Qh-Ts for qemu-devel@nongnu.org; Sun, 02 Dec 2012 00:45:00 -0500 Message-ID: <50BAEAD5.8080305@suse.de> Date: Sun, 02 Dec 2012 06:44:53 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1352473012-20500-1-git-send-email-ehabkost@redhat.com> <1352473012-20500-20-git-send-email-ehabkost@redhat.com> <50A44B71.50804@suse.de> <20121115184241.GB20235@otherpad.lan.raisama.net> <20121130175626.21ae766e@nial.usersys.redhat.com> <20121130213849.GE4255@otherpad.lan.raisama.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 19/24] qdev: move reset handler list from vl.c to qdev.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Eduardo Habkost Cc: blauwirbel@gmail.com, Igor Mammedov , riku.voipio@iki.fi, qemu-devel@nongnu.org, Anthony Liguori Am 01.12.2012 12:26, schrieb Peter Maydell: > On 30 November 2012 21:38, Eduardo Habkost wrote: >> cpu_reset() is not that well-defined, otherwise we wouldn't have this = on >> linux-user: >> >> #if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PP= C) >> cpu_reset(ENV_GET_CPU(env)); >> #endif >> >> (I have no idea why we have that #ifdef). >=20 > I think this is because the different targets disagree about whether > the CPU should be reset on initial construction or whether it needs > a specific reset call. (The current setup with #ifdefs is among other > things a historical effect as a result of various refactorings in > the past; you can trace the git history if you're interested.) Peter and me had long IRC discussions about how to fix this in the past: * On my qom-cpu-copy branch I have a patch queued that drops the #ifdef above, accepting that CPUs may get reset twice then. =3D> Dispels doubt for target authors; doubts about correctness though. * PMM suggested to move cpu_clone_regs() from target-*/cpu.h to *-user/. =3D> Would lead to duplication between linux-user and bsd-user; ABI? * PMM suggested to replace cpu_copy() with ABI-specific code in *-user/. Unfortunately I don't quite remember the details of how... ;) The x86 APIC refactorings that Iguardo have done do bring us very close to sane cpu_reset() semantics (ignoring the two hands full of hard/soft/... reset variants that ppc and other architectures feature). Declaring cpu_reset() inferior to reset handlers due to the linux-user mess is going into the wrong direction - some targets seem to ignore reset or fork/clone completely at the moment, so the state we see cannot be considered fully correct. In particular the above reset is being performed *after* cpu_copy() memcpy()'ed random memory contents (which for some targets may contain pointers), undoing the copying in large parts. Therefore, when all targets reset as part of cpu_init() (or by moving the cpu_reset() call into early cpu_copy()?) we could get rid of it in do_fork() and of its weird conditions. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg