From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N5Q1x-0005O2-HS for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:31:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N5Q1w-0005Nb-TY for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:31:04 -0500 Received: from [199.232.76.173] (port=54461 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N5Q1w-0005NY-Ja for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:31:04 -0500 Received: from fg-out-1718.google.com ([72.14.220.154]:59782) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N5Pw4-00080l-T1 for qemu-devel@nongnu.org; Tue, 03 Nov 2009 15:25:01 -0500 Received: by fg-out-1718.google.com with SMTP id d23so1723812fga.10 for ; Tue, 03 Nov 2009 12:25:00 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20091103201628.GD3118@mothafucka.localdomain> References: <1257277805-637-1-git-send-email-glommer@redhat.com> <761ea48b0911031212h1e55a6aav3d0678a515a7fc5e@mail.gmail.com> <20091103201628.GD3118@mothafucka.localdomain> Date: Tue, 3 Nov 2009 21:24:59 +0100 Message-ID: <761ea48b0911031224m685786a3v981616eb7cb92eef@mail.gmail.com> Subject: Re: [Qemu-devel] [PATCH] don't call reset functions on cpu initialization From: Laurent Desnogues Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Glauber Costa Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Tue, Nov 3, 2009 at 9:16 PM, Glauber Costa wrote: > On Tue, Nov 03, 2009 at 09:12:41PM +0100, Laurent Desnogues wrote: >> On Tue, Nov 3, 2009 at 8:50 PM, Glauber Costa wrote= : >> > There is absolutely no need to call reset functions when initializing >> > devices. Since we are already registering them, calling qemu_system_re= set() >> > should suffice. Actually, it is what happens when we reboot the machin= e, >> > and using the same process instead of a special case semantics will ev= en >> > allow us to find bugs easier. >> > >> > Furthermore, the fact that we initialize things like the cpu quite ear= ly, >> > 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 i= t >> > seems to be doing okay - although qemu-kvm uses a slightly different p= atch. >> > >> > 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); >> >> 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? Can't say :-) Perhaps the safest thing to do would be to #ifdef/ifndef that call without moving it? Laurent