From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH] vpmu intel: Add dumping vpmu infos in 'q' keyhandler Date: Mon, 25 Mar 2013 10:47:17 -0400 Message-ID: <20130325144717.GA15129@phenom.dumpdata.com> References: <2380071.Ao4sLm2npk@amur> <1365941.PJBONSDnbW@amur> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1365941.PJBONSDnbW@amur> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Dietmar Hahn Cc: Eddie Dong , Jun Nakajima , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Mar 20, 2013 at 07:41:10AM +0100, Dietmar Hahn wrote: > Am Donnerstag 14 M=E4rz 2013, 10:36:25 schrieb Dietmar Hahn: > > = > > This patch extends the printout of the VPCU infos of the keyhandler 'q'. > > If vPMU is enabled is on the VCPU and active a line is printed like; > > (XEN) vPMU running: fixed=3D0x2 general=3D0x1 > > = > > This means from the fixed counters the counter 3 and the general > > counter 1 are enabled. > > As example this picture happens on linux-3.4.6 with watchdog and 'perf = top'. > > This patch supports only Intel as I don't have Amd machines. > > Thanks. > > = > > Dietmar. > = > Ping? > = > > Signed-off-by: Dietmar Hahn > > = > > diff -r a6b81234b189 xen/arch/x86/domain.c > > --- a/xen/arch/x86/domain.c Mon Mar 11 16:13:42 2013 +0000 > > +++ b/xen/arch/x86/domain.c Thu Mar 14 10:25:49 2013 +0100 > > @@ -2093,6 +2093,9 @@ void arch_dump_domain_info(struct domain > > void arch_dump_vcpu_info(struct vcpu *v) > > { > > paging_dump_vcpu_info(v); > > + > > + if ( is_hvm_vcpu(v) ) > > + vpmu_dump(v); > > } > > = > > void domain_cpuid( > > diff -r a6b81234b189 xen/arch/x86/hvm/vmx/vpmu_core2.c > > --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Mon Mar 11 16:13:42 2013 +0000 > > +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Thu Mar 14 10:25:49 2013 +0100 > > @@ -611,6 +611,41 @@ static void core2_vpmu_do_cpuid(unsigned > > } > > } > > = > > +static void core2_vpmu_dump(struct vcpu *v) > > +{ > > + struct vpmu_struct *vpmu =3D vcpu_vpmu(v); > > + int i, num, fixed, general; > > + struct core2_vpmu_context *core2_vpmu_cxt =3D NULL; > > + > > + if ( !vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) ) > > + return; > > + > > + if ( !vpmu_is_set(vpmu, VPMU_RUNNING) ) > > + { > > + if ( vpmu_set(vpmu, VPMU_CONTEXT_LOADED) ) > > + printk(" vPMU loaded\n"); > > + else > > + printk(" vPMU allocated\n"); > > + return; > > + } > > + > > + core2_vpmu_cxt =3D vpmu->context; > > + num =3D core2_get_pmc_count(); > > + general =3D 0; > > + for ( i =3D 0; i < num; i++ ) > > + { > > + if ( core2_vpmu_cxt->pmu_enable->arch_pmc_enable[i] ) > > + general |=3D 1 << i; > > + } > > + fixed =3D 0; > > + for ( i =3D 0; i < 3; i++ ) 3? What if there are more? Ah, wait. The code can only do 3! Perhaps another extra patch that makes this a #define in case the CPU can do more in the future? > > + { > > + if ( core2_vpmu_cxt->pmu_enable->fixed_ctr_enable[i] ) > > + fixed |=3D 1 << i; > > + } > > + printk(" vPMU running: fixed=3D0x%x general=3D0x%x\n", fixed, g= eneral); Would it also make sense to print the contents of the MSR? And also the global counter enable and the overflow one? > > +} > > + > > static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs) > > { > > struct vcpu *v =3D current; > > @@ -724,7 +759,8 @@ struct arch_vpmu_ops core2_vpmu_ops =3D { > > .do_cpuid =3D core2_vpmu_do_cpuid, > > .arch_vpmu_destroy =3D core2_vpmu_destroy, > > .arch_vpmu_save =3D core2_vpmu_save, > > - .arch_vpmu_load =3D core2_vpmu_load > > + .arch_vpmu_load =3D core2_vpmu_load, > > + .arch_vpmu_dump =3D core2_vpmu_dump > > }; > > = > > int vmx_vpmu_initialise(struct vcpu *v, unsigned int vpmu_flags) > > diff -r a6b81234b189 xen/arch/x86/hvm/vpmu.c > > --- a/xen/arch/x86/hvm/vpmu.c Mon Mar 11 16:13:42 2013 +0000 > > +++ b/xen/arch/x86/hvm/vpmu.c Thu Mar 14 10:25:49 2013 +0100 > > @@ -157,3 +157,12 @@ void vpmu_destroy(struct vcpu *v) > > vpmu->arch_vpmu_ops->arch_vpmu_destroy(v); > > } > > = > > +/* Dump some vpmu informations on console. Used in keyhandler dump_dom= ains(). */ > > +void vpmu_dump(struct vcpu *v) > > +{ > > + struct vpmu_struct *vpmu =3D vcpu_vpmu(v); > > + > > + if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->arch_vpmu_dump ) > > + vpmu->arch_vpmu_ops->arch_vpmu_dump(v); > > +} > > + > > diff -r a6b81234b189 xen/include/asm-x86/hvm/vpmu.h > > --- a/xen/include/asm-x86/hvm/vpmu.h Mon Mar 11 16:13:42 2013 +0000 > > +++ b/xen/include/asm-x86/hvm/vpmu.h Thu Mar 14 10:25:49 2013 +0100 > > @@ -54,6 +54,7 @@ struct arch_vpmu_ops { > > void (*arch_vpmu_destroy)(struct vcpu *v); > > void (*arch_vpmu_save)(struct vcpu *v); > > void (*arch_vpmu_load)(struct vcpu *v); > > + void (*arch_vpmu_dump)(struct vcpu *v); > > }; > > = > > int vmx_vpmu_initialise(struct vcpu *, unsigned int flags); > > @@ -87,6 +88,7 @@ void vpmu_initialise(struct vcpu *v); > > void vpmu_destroy(struct vcpu *v); > > void vpmu_save(struct vcpu *v); > > void vpmu_load(struct vcpu *v); > > +void vpmu_dump(struct vcpu *v); > > = > > extern int acquire_pmu_ownership(int pmu_ownership); > > extern void release_pmu_ownership(int pmu_ownership); > > = > > = > -- = > Company details: http://ts.fujitsu.com/imprint.html > = > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > =