Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5Pny-0007qM-7r for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:16:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5Pnt-0007pb-Nn for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:16:37 -0500 Received: from [199.232.76.173] (port=36398 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5Pnt-0007pY-Ky for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:16:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40270) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N5Pnt-0006fv-9Q for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:16:33 -0500 Date: Tue, 3 Nov 2009 18:16:28 -0200 From: Glauber Costa Subject: Re: [Qemu-devel] [PATCH] don't call reset functions on cpu initialization Message-ID: <20091103201628.GD3118@mothafucka.localdomain> References: <1257277805-637-1-git-send-email-glommer@redhat.com> <761ea48b0911031212h1e55a6aav3d0678a515a7fc5e@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <761ea48b0911031212h1e55a6aav3d0678a515a7fc5e@mail.gmail.com> Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Desnogues Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Tue, Nov 03, 2009 at 09:12:41PM +0100, Laurent Desnogues wrote: > On Tue, Nov 3, 2009 at 8:50 PM, Glauber Costa wrot= e: > > There is absolutely no need to call reset functions when initializing > > devices. Since we are already registering them, calling qemu_system_r= eset() > > should suffice. Actually, it is what happens when we reboot the machi= ne, > > and using the same process instead of a special case semantics will e= ven > > allow us to find bugs easier. > > > > Furthermore, the fact that we initialize things like the cpu quite ea= rly, > > leads to the need to introduce synchronization stuff like qemu_system= _cond. > > This patch removes it entirely. All we need to do is call qemu_system= _reset() > > only when we're already sure the system is up and running > > > > I tested it with qemu (with and without io-thread) and qemu-kvm, and = it > > seems to be doing okay - although qemu-kvm uses a slightly different = patch. > > > > Signed-off-by: Glauber Costa > > --- > > =A0hw/apic.c =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/e1000.c =A0 =A0 =A0 =A0 =A0 | =A0 =A01 - > > =A0hw/hpet.c =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/i8254.c =A0 =A0 =A0 =A0 =A0 | =A0 =A02 -- > > =A0hw/ide/piix.c =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/piix4.c =A0 =A0 =A0 =A0 =A0 | =A0 =A01 - > > =A0hw/piix_pci.c =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/rtl8139.c =A0 =A0 =A0 =A0 | =A0 =A02 +- > > =A0hw/serial.c =A0 =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/usb-ohci.c =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/usb-uhci.c =A0 =A0 =A0 =A0| =A0 =A01 - > > =A0hw/vga.c =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A01 - > > =A0target-i386/helper.c | =A0 =A01 - > > =A0vl.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 15 +-------------- > > =A014 files changed, 2 insertions(+), 28 deletions(-) > [...] > > diff --git a/target-i386/helper.c b/target-i386/helper.c > > index c961544..957b3fc 100644 > > --- a/target-i386/helper.c > > +++ b/target-i386/helper.c > > @@ -1885,7 +1885,6 @@ CPUX86State *cpu_x86_init(const char *cpu_model= ) > > =A0 =A0 =A0 =A0 return NULL; > > =A0 =A0 } > > =A0 =A0 mce_init(env); > > - =A0 =A0cpu_reset(env); >=20 > Who will call cpu_reset for user mode QEMU then? I believe we can then call it explicitly right after we call cpu_init for user mode, then or can't we?