Received: from eggs.gnu.org ([2001:4830:134:3::10]:60975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwzel-0005JY-Vj for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:02:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uwzek-0003yn-EY for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:02:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwzek-0003ye-4t for qemu-devel@nongnu.org; Wed, 10 Jul 2013 15:02:26 -0400 Date: Wed, 10 Jul 2013 16:02:14 -0300 From: Eduardo Habkost Message-ID: <20130710190214.GA19826@otherpad.lan.raisama.net> References: <1373473838-1163-1-git-send-email-afaerber@suse.de> <20130710184321.GK7707@otherpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC qom-cpu] linux-user: Avoid conditional cpu_reset() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Riku Voipio , Andreas =?iso-8859-1?Q?F=E4rber?= , qemu-devel@nongnu.org On Wed, Jul 10, 2013 at 07:51:32PM +0100, Peter Maydell wrote: > On 10 July 2013 19:43, Eduardo Habkost wrote: > > On Wed, Jul 10, 2013 at 06:30:38PM +0200, Andreas F=E4rber wrote: > >> Some CPUs reset as part of cpu_init(), some others were reset > >> afterwards, some not at all. While some targets didn't implement a > >> cpu_[state_]reset() function, QOM cpu_reset() is always available. > >> There's nothing wrong with resetting twice on startup, so drop > >> the #ifdef. > >> > >> Suggested-by: Peter Maydell > >> Signed-off-by: Andreas F=E4rber > >> Cc: Eduardo Habkost > >> --- > >> This had been discussed as a possible cleanup for the #ifdef. > >> I am uncertain whether we should do this since it hides the TODO it= em > >> of investigating ppc and sparc CPU reset. > >> > >> linux-user/main.c | 2 -- > >> 1 file changed, 2 deletions(-) > >> > >> diff --git a/linux-user/main.c b/linux-user/main.c > >> index 7f15d3d..e904d8c 100644 > >> --- a/linux-user/main.c > >> +++ b/linux-user/main.c > >> @@ -3637,9 +3637,7 @@ int main(int argc, char **argv, char **envp) > >> fprintf(stderr, "Unable to find CPU definition\n"); > >> exit(1); > >> } > >> -#if defined(TARGET_SPARC) || defined(TARGET_PPC) > >> cpu_reset(ENV_GET_CPU(env)); > >> -#endif > > > > Most of the cpu_reset() implementations I have looked at (including > > sparc) contain something like: > > > > memset(env, 0, offsetof(CPUXXXState, breakpoints)); > > > > Isn't this clearing userspace registers that are not supposed to be > > touched by clone()? >=20 > You're thinking about the other cpu_reset() -- this one is in > main.c and happens only for the main thread, immediately > after we've created that thread's CPU, and before we set up > its registers for initial program start. The cpu_reset() > that sometimes happens in the clone() path is in syscall.c > (and is addressed by patch > http://patchwork.ozlabs.org/patch/257232/ ) Oh, nevermind. We discussed do_fork() for so long that I didn't even notice we had _another_ cpu_reset() #ifdef on main.c. In this case the patch looks simple and safe, to me. --=20 Eduardo