Received: from eggs.gnu.org ([2001:4830:134:3::10]:51742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZA0IZ-0005r5-B3 for qemu-devel@nongnu.org; Tue, 30 Jun 2015 14:30:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZA0IT-0008QF-8K for qemu-devel@nongnu.org; Tue, 30 Jun 2015 14:30:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZA0IT-0008QB-0q for qemu-devel@nongnu.org; Tue, 30 Jun 2015 14:30:17 -0400 Date: Tue, 30 Jun 2015 15:30:14 -0300 From: Eduardo Habkost Message-ID: <20150630183014.GA32472@thinpad.lan.raisama.net> References: <7d54c33fa2a928fd317f3a95af61f854f43ba23c.1435195913.git.zhugh.fnst@cn.fujitsu.com> <558C33BE.8020603@redhat.com> <558C3A53.3000901@suse.de> <559237D6.8000602@cn.fujitsu.com> <55926E56.7060505@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <55926E56.7060505@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND PATCH v8 2/4] hw: add a wrapper for registering reset handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Zhu Guihua , imammedo@redhat.com, qemu-devel@nongnu.org, izumi.taku@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, Paolo Bonzini On Tue, Jun 30, 2015 at 12:24:22PM +0200, Andreas F=E4rber wrote: > Am 30.06.2015 um 08:31 schrieb Zhu Guihua: > > On 06/26/2015 01:28 AM, Andreas F=E4rber wrote: > >> Am 25.06.2015 um 19:00 schrieb Paolo Bonzini: > >>> On 25/06/2015 04:17, Zhu Guihua wrote: > >>>> Add a wrapper to specify reset order when registering reset handle= r, > >>>> instead of non-obvious initiazation code ordering. > >>>> > >>>> Signed-off-by: Zhu Guihua > >>> I'm sorry, this is not really acceptable. The initialization code > >>> ordering is good because it should be okay to run reset handlers in= the > >>> same order as code is run. If there are dependencies between reset > >>> handlers, a random integer is not a maintainable way to maintain th= em. > >>> > >>> Instead, you should have a single reset handler that calls the rese= t > >>> handlers in the right order; for example a qdev bus such as icc_bus > >>> always resets children before parents. > >>> > >>> Are you sure that you want to remove the icc_bus?... What are you > >>> gaining exactly by doing so? > >> >From my view we would be gaining by making the APIC an integral par= t > >> (child<>) of the CPU in a follow-up step (there's a TODO to make thi= ngs > >> link<>s). > >> > >> But either way the CPU's existing reset handler should be able to ha= ndle > >> CPU/APIC interdependencies just fine, somehow. Which is what Eduardo > >> said on v6 and v7. (Another alternative he raised was a machine init > >> notifier, but I see no code for that after its mention on v7?) > >=20 > > According to Eduardo's suggestions on v7, the simpler way is to add a > > ordering parameter > > to qemu_register_reset(), so that we can ensure the order of apic res= et > > handler(apic reset > > must be after the other devices' reset on x86). >=20 > That is a very general statement. Surely the APIC does not need to be > reset after *all* other devices but after some particular device(s). > Which one is that if not the X86CPU? >=20 > > This way will not influence the initialization code ordering expect > > apic reset. >=20 > And exactly that's the criticism: You're introducing a generic mechanis= m > to address a single very specific problem. >=20 > sPAPR already has the MachineClass::reset() callback to order CPU vs. > device reset. So if you want a new mechanism you'll need to explain in > detail why that is needed and not just say that it solves your issue. My main point was that relying on a specific ordering of qemu_register_reset() calls to ensure reset ordering was too fragile. Adding an ordering argument to qemu_register_reset() was a suggestion, but now I agree it is unnecessary. Having a reset handler that calls reset code in the right order (like Paolo proposed earlier in this thread) looks much simpler. --=20 Eduardo