Received: from eggs.gnu.org ([208.118.235.92]:45029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvp1h-0007LD-Ps for qemu-devel@nongnu.org; Thu, 17 Jan 2013 07:57:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvp1g-0001Jv-Hg for qemu-devel@nongnu.org; Thu, 17 Jan 2013 07:57:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvp1g-0001Jk-9f for qemu-devel@nongnu.org; Thu, 17 Jan 2013 07:57:00 -0500 Date: Thu, 17 Jan 2013 10:58:34 -0200 From: Eduardo Habkost Message-ID: <20130117125834.GK10683@otherpad.lan.raisama.net> References: <1358314380-9400-1-git-send-email-afaerber@suse.de> <1358314380-9400-4-git-send-email-afaerber@suse.de> <20130116160424.GH20133@otherpad.lan.raisama.net> <50F72F3F.5060908@suse.de> <20130116234332.GH10683@otherpad.lan.raisama.net> <50F7B06F.1050507@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <50F7B06F.1050507@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC qom-cpu 03/15] target-i386: Update CPU to QOM realizefn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Igor Mammedov , qemu-devel@nongnu.org On Thu, Jan 17, 2013 at 09:03:59AM +0100, Andreas F=E4rber wrote: [...] > >> I mentioned in the cover letter that this needs to be changed once a > >> CPUClass-level realizefn is introduced. I could introduce a no-op > >> realizefn there and do the regular store+call. > >=20 > > That was the semantics I was expecting: base classes would safely > > introduce realize functions without worrying if subclasses would > > override it incorrectly and break it. >=20 > We could do that if we fix up the respective DeviceClass::init, > SysBusDeviceClass::init etc. code. Question is (just as with some x86 > CPU code) whether it's worth cleaning up when we know that it is to be > refactored later. Actually I am not sure it would be nice to require every single class to save/call the parent realize function. I am starting to like the more relaxed requirement. :-) >=20 > > Anyway, saving the parent function in every subclass is so cumbersome > > that simply documenting it as "CPUClass subclasses must call > > qemu_init_vcpu()" sounds easier than "CPUClass subclasses must save t= he > > parent's realize() and call it". > [snip] >=20 > Actually that particular piece of code is unrelated to this discussion > since qemu_init_vcpu() still operates on CPUArchState and thus cannot b= e > moved into CPUClass yet. The reason is that > cpus.c:qemu_kvm_cpu_thread_fn sets cpu_single_env, and I do not see a > solution for that - suggestions or patches welcome. I used qemu_init_vcpu() as an example because it's something called by the realize function for all targets, and one day could be called by a common CPUClass realize function. I didn't check if it was possible to convert it today, already. My point is: if you need to save the pointer and call the parent realize function only if documented and required by the parent class, the parent could as well simply document it as "subclasses of TYPE_FOO should manually call foo_realize() if they override the realize function" instead of "subclasses of TYPE_FOO should save and call the parent realize function if they override de realize function". Won't it be easier and simpler? >=20 > However, I see that kvm-all.c:kvm_on_sigbus_vcpu() can be switched to > CPUState now, so that cpus.c:qemu_kvm_eat_signals() can be changed to > CPUState, used from cpus.c:qemu_kvm_wait_io_event(). > But cpus.c:cpu_thread_is_idle() still uses env->halted, which is blocke= d > by the search for an acceptable solution to flush the TLB at CPUState > level (exec.c:cpu_common_post_load()). >=20 > Andreas >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg --=20 Eduardo