Add more features to xenoprof
PATCH 1/1 Add more features to xenoprof
This patch set syncs xenoprof features with Linux upstream:
01_cpu_type.patch: add support for Core i7 and Atom.
02_arch_perfmon.patch: add architectural perfmon support. One benefit is that more perfmon counters can be used on Nehalem.
03_force_arch_perfmon: force use of architectural perfmon instead of the CPU specific event set, which may be not supported by oprofile user space tool yet.
Signed-off-by Yang Zhang <[email protected]>
Signed-off-by Yang Xiaowei <[email protected]>
Thanks,
xiaowei
xen/arch/x86/oprofile/nmi_int.c +10 -4
@@ -357,22 +357,28 @@ *cpu_type ="i386/pii" ;break ; case 6 ... 8: + case 10 ... 11: *cpu_type ="i386/piii" ;break ;case 9 : +case 13 : *cpu_type ="i386/p6_mobile" ; -break ; - case 10 ... 13: - *cpu_type ="i386/p6" ;break ;case 14 : *cpu_type ="i386/core" ;break ;case 15 :case 23 : -case 26 :case 29 : *cpu_type ="i386/core_2" ; + ppro_has_global_ctrl =1 ; +break ; +case 26 : + *cpu_type ="i386/core_i7" ; + ppro_has_global_ctrl =1 ; +break ; +case 28 : + *cpu_type ="i386/atom" ; ppro_has_global_ctrl =1 ;break ;default :
xen/arch/x86/cpu/intel.c +6 -0
@@ -148,6 +148,12 @@select_idle_routine (c); l2 =init_intel_cacheinfo (c); +if (c->cpuid_level >9 ) { +unsigned eax =cpuid_eax (10 ); +/* Check for version and the number of counters */ +if ((eax &0xff ) && (((eax>>8 ) &0xff ) >1 )) +set_bit (X86_FEATURE_ARCH_PERFMON , c->x86_capability); + }/* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it until model 3 mask 3 */ if ((c->x86<<8 | c->x86_model<<4 | c->x86_mask) <0x633 )
xen/arch/x86/oprofile/nmi_int.c +20 -11
@@ -374,18 +374,15 @@ ppro_has_global_ctrl =1 ;break ;case 26 : +arch_perfmon_setup_counters (); *cpu_type ="i386/core_i7" ; ppro_has_global_ctrl =1 ;break ;case 28 : *cpu_type ="i386/atom" ; - ppro_has_global_ctrl =1 ;break ;default :/* Unknown */ -printk ("xenoprof: Initialization failed. " -"Intel processor model %d for P6 class family is not " -"supported\n" , cpu_model);return 0 ; }
@@ -393,10 +390,21 @@return 1 ; } +static int __init arch_perfmon_init (char **cpu_type) +{ +if (!cpu_has_arch_perfmon) +return 0 ; + *cpu_type ="i386/arch_perfmon" ; + model = &op_arch_perfmon_spec; +arch_perfmon_setup_counters (); +return 1 ; +} +static int __init nmi_init (void ) {__u8 vendor = current_cpu_data.x86_vendor;__u8 family = current_cpu_data.x86; +__u8 _model = current_cpu_data.x86_model;if (!cpu_has_apic) {printk ("xenoprof: Initialization failed. No APIC\n" );
@@ -438,21 +446,22 @@switch (family) {/* Pentium IV */ case 0xf : -if (!p4_init (&cpu_type)) -return -ENODEV ; +p4_init (&cpu_type);break ;/* A P6-class processor */ case 6 : -if (!ppro_init (&cpu_type)) -return -ENODEV ; +ppro_init (&cpu_type);break ;default : +break ; + } +if (!cpu_type && !arch_perfmon_init (&cpu_type)) {printk ("xenoprof: Initialization failed. " -"Intel processor family %d is not " -"supported\n" , family); -return -ENODEV ; +"Intel processor family %d model %d" +"is not supported\n" , family, _model); +return -ENODEV ; }break ;
xen/arch/x86/oprofile/op_model_ppro.c +109 -34
253 lines not on this page · raw message
xen/arch/x86/oprofile/op_x86_model.h +5 -3
@@ -32,8 +32,8 @@* various x86 CPU model's perfctr support. */ struct op_x86_model_spec { -unsigned int const num_counters; -unsigned int const num_controls; +unsigned int num_counters; +unsigned int num_controls;void (*fill_in_addresses)(struct op_msrs *const msrs);void (*setup_ctrs)(struct op_msrs const *const msrs); int (*check_ctrs)(unsigned int const cpu,
@@ -48,9 +48,11 @@ void (*save_msr)(struct vcpu * const v, int type, int index, u64 msr_content); }; -extern struct op_x86_model_spec const op_ppro_spec; +extern struct op_x86_model_spec op_ppro_spec; +extern struct op_x86_model_spec op_arch_perfmon_spec;extern struct op_x86_model_spec const op_p4_spec;extern struct op_x86_model_spec const op_p4_ht2_spec;extern struct op_x86_model_spec const op_athlon_spec; +void arch_perfmon_setup_counters (void );#endif /* OP_X86_MODEL_H */
xen/include/asm-x86/cpufeature.h +3 -0
@@ -76,6 +76,7 @@#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_NOSTOP_TSC (3*32+ 9)/* TSC does not stop in C states */ #define X86_FEATURE_ARAT (3*32+ 10)/* Always running APIC timer */ +#define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 (4*32+ 0)/* Streaming SIMD Extensions-3 */
@@ -188,6 +189,8 @@ && boot_cpu_has(X86_FEATURE_FFXSR))#define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) +#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) +#endif /* __ASM_I386_CPUFEATURE_H */ /*
xen/arch/x86/oprofile/nmi_int.c +15 -0
@@ -344,10 +344,25 @@ } +static int force_arch_perfmon; +static int force_cpu_type (const char *str) +{ +if (!strcmp (str,"arch_perfmon" )) { + force_arch_perfmon =1 ; +printk (KERN_INFO "oprofile: forcing architectural perfmon\n" ); + } + +return 0 ; +} +custom_param ("cpu_type" , force_cpu_type); +extern int ppro_has_global_ctrl;static int __init ppro_init (char ** cpu_type) {__u8 cpu_model = current_cpu_data.x86_model; + +if (force_arch_perfmon && cpu_has_arch_perfmon) +return 0 ;switch (cpu_model) { case 0 ... 2:
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel