Received: from eggs.gnu.org ([208.118.235.92]:45577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXGgX-0005rl-JF for qemu-devel@nongnu.org; Tue, 30 Apr 2013 15:58:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXGgS-00056M-AP for qemu-devel@nongnu.org; Tue, 30 Apr 2013 15:57:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXGgS-000569-21 for qemu-devel@nongnu.org; Tue, 30 Apr 2013 15:57:52 -0400 Date: Tue, 30 Apr 2013 16:57:49 -0300 From: Eduardo Habkost Message-ID: <20130430195749.GI28606@otherpad.lan.raisama.net> References: <1366915386-14728-1-git-send-email-ehabkost@redhat.com> <1366915386-14728-8-git-send-email-ehabkost@redhat.com> <20130426171029.3e159116@thinkpad> <20130426153108.GX2900@otherpad.lan.raisama.net> <517A9E3E.2060901@suse.de> <20130426173915.20d02c7d@thinkpad> <20130426173040.GK11821@otherpad.lan.raisama.net> <20130426194110.43ff3a80@thinkpad> <20130426190115.GA2900@otherpad.lan.raisama.net> <20130430190423.3b0be80d@nial.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20130430190423.3b0be80d@nial.usersys.redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 7/7] target-i386: Disable direct passthrough of PMU CPUID leaf by default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Andreas =?iso-8859-1?Q?F=E4rber?= , Gleb Natapov , qemu-devel@nongnu.org On Tue, Apr 30, 2013 at 07:04:23PM +0200, Igor Mammedov wrote: > On Fri, 26 Apr 2013 16:01:15 -0300 > Eduardo Habkost wrote: >=20 > > On Fri, Apr 26, 2013 at 07:41:10PM +0200, Igor Mammedov wrote: > > > On Fri, 26 Apr 2013 14:30:40 -0300 > > > Eduardo Habkost wrote: > > >=20 > > > > On Fri, Apr 26, 2013 at 05:39:15PM +0200, Igor Mammedov wrote: > > > > > On Fri, 26 Apr 2013 17:33:18 +0200 > > > > > Andreas F=E4rber wrote: > > > > >=20 > > > > > > Am 26.04.2013 17:31, schrieb Eduardo Habkost: > > > > > > > On Fri, Apr 26, 2013 at 05:10:29PM +0200, Igor Mammedov wro= te: > > > > > > >> On Thu, 25 Apr 2013 15:43:06 -0300 > > > > > > >> Eduardo Habkost wrote: > > > > > > >> > > > > > > >>> The current code handling the CPUID 0xA leaf simply forwa= rds all data > > > > > > >>> from GET_SUPPORTED_CPUID directly to the guest, breaking = migration > > > > > > >>> between hosts with different number of PMU counters. > > > > > > >>> > > > > > > >>> This patch disables this behavior, except on older machin= e-types (for > > > > > > >>> compatibility) and on the "host" CPU model. > > > > > > >> Please, make it static property and use compat properties. > > > > > > >> Result will be simpler and much less will have to be redo= ne/discarded after > > > > > > >> converting to the rest to properties and sub-classes. > > > > > > >=20 > > > > > > > I was going to say that static properties were too much wor= k to be done > > > > > > > in time for 1.5, but you are right: in this specific case a= dding a > > > > > > > static property for the cpuid_pmu_passthrough field looks v= ery easy. I > > > > > > > will give it a try. > > > > > >=20 > > > > > > I am hoping to get as initial set (though not all) of the sta= tic > > > > > > properties still into 1.5. Using them to fix CPUID bugs can t= hen be done > > > > > > during Hard Freeze. :) > > > > > patch "[PATCH 02/10] target-i386: cpu: convert existing dynamic= properties > > > > > into static properties" should be enough for using model,level = compat > > > > > properties. > > > >=20 > > > > ...except that we don't have X86CPU model subclasses yet, so we c= an't > > > > set model-specific compat properties using compat_props. > > > X86CPU could serve here > >=20 > > How? > >=20 > > If we need to set model=3D8 only on the "486" CPU model, how would we= do > > that in the compat_props table without subclasses? > for model, it would be its possible with custom setter, might be prefer= red way > since it's local to cpu.c, and could be easily replaced with with one-l= iner once > sub-classes are in tree. A custom setter has to be set inside class_init, because instance_init is run _after_ global properties are set, but we still don't have subclasses so we can't have a different setter for "486" or a compat_props item that would affect only "486". How exactly would this solution look like? I can't see it. (My main question isn't about the implementation inside cpu.c, but how the machine-type code inside pc_piix.c would look like). >=20 > >=20 > > >=20 > > > >=20 > > > > Maybe we can make compat_props work for pmu-passthrough, but it m= ay be > > > > not completely straightforward because I would like to keep it en= abled > > > > by default on -cpu host. > > > Maybe for 'host' hack realize() to override default, will do and la= ter we > > > can move it to host_subclass. > >=20 > > Yes, it's doable. And I don't think we even need to hack methods, we > > just need a x86_def_t field that indicates that this is a model that > > overrides the default (and that field would be true only for "host"). > Extended x86_def_t might be harder to handle when switching to sub-clas= ses, > although it's hard to say without comparing patches for both ways. I believe it's impossible to implement any behavior that will change depending on the CPU model (enabling PMU passthrough on "host", disabling on all other models) without extending x86_def_t. x86_def_t data is the only thing we get back from cpu_x86_find_by_name(). Would you prefer to change cpu_x86_find_by_name() to get a X86CPU* as argument, too? I was trying to avoid that, but it is doable. >=20 > >=20 > > But I still don't see how it would be possible to use compat_props fo= r > > the 486 model=3D8 fix or for the n270 movbe fix. > >=20 > It's impossible to implement "n270 movbe" fixup with compat props curr= ently, > so 5/7 + 1/7 looks ok. We can drop them once features converted to stat= ic properties > + sub-classes. True. But why this doesn't apply to 6/7 (486 model=3D8) as well? --=20 Eduardo