xenoprofile: Add IBS support
PATCH 1/2 xenoprofile: Add IBS support
Patch for Xen.
Signed-off-by Wei Wang <[email protected]>
Signature · 11 lines
AMD GmbH, Germany Operating System Research Center Legal Information: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34 85609 Dornach b. München Geschäftsführer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis München Registergericht München, HRB Nr. 43632
xen/arch/x86/oprofile/nmi_int.c +2 -0
@@ -28,6 +28,7 @@#include "op_x86_model.h" struct op_counter_config counter_config[OP_MAX_COUNTER ]; +struct op_ibs_config ibs_config;static struct op_x86_model_spec const *__read_mostly model;static struct op_msrs cpu_msrs[NR_CPUS ];
@@ -430,6 +431,7 @@ static int __init nmi_init(void)case 0x10 : model = &op_athlon_spec; cpu_type ="x86-64/family10" ; + ibs_caps =ibs_init ();break ;case 0x11 : model = &op_athlon_spec;
xen/arch/x86/oprofile/op_counter.h +12 -0
@@ -26,4 +26,16 @@ struct op_counter_config {extern struct op_counter_config counter_config[]; +/* AMD IBS configuration */ +struct op_ibs_config { +unsigned long op_enabled; +unsigned long fetch_enabled; +unsigned long max_cnt_fetch; +unsigned long max_cnt_op; +unsigned long rand_en; +unsigned long dispatched_ops; +}; + +extern struct op_ibs_config ibs_config; +#endif /* OP_COUNTER_H */
xen/arch/x86/oprofile/op_model_athlon.c +348 -4
392 lines not on this page · raw message
xen/arch/x86/oprofile/xenoprof.c +17 -0
@@ -34,6 +34,23 @@ int xenoprof_arch_counter(XEN_GUEST_HAND counter_config[counter.ind].kernel = counter.kernel; counter_config[counter.ind].user = counter.user; counter_config[counter.ind].unit_mask = counter.unit_mask; + +return 0 ; +} + +int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE (void ) arg) +{ +struct xenoprof_ibs_counter ibs_counter; + +if (copy_from_guest (&ibs_counter, arg,1 ) ) +return -EFAULT ; + + ibs_config.op_enabled = ibs_counter.op_enabled; + ibs_config.fetch_enabled = ibs_counter.fetch_enabled; + ibs_config.max_cnt_fetch = ibs_counter.max_cnt_fetch; + ibs_config.max_cnt_op = ibs_counter.max_cnt_op; + ibs_config.rand_en = ibs_counter.rand_en; + ibs_config.dispatched_ops = ibs_counter.dispatched_ops;return 0 ; }
xen/common/xenoprof.c +17 -0
@@ -48,6 +48,9 @@ static u64 passive_samples;static u64 passive_samples;static u64 idle_samples;static u64 others_samples; + +/* AMD IBS support */ +extern u32 ibs_caps;int acquire_pmu_ownership (int pmu_ownship) {
@@ -881,6 +884,20 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN ret = -EFAULT ;break ; +case XENOPROF_ibs_counter: +if ( (xenoprof_state !=XENOPROF_COUNTERS_RESERVED ) || + (adomains ==0 ) ) + { + ret = -EPERM ; +break ; + } + ret =xenoprof_arch_ibs_counter (arg); +break ; + +case XENOPROF_get_ibs_caps: + ret = ibs_caps; +break ; +default : ret = -ENOSYS ; }
xen/include/asm-x86/xenoprof.h +5 -0
@@ -42,9 +42,14 @@ int xenoprof_arch_init(int *num_events,int xenoprof_arch_counter (XEN_GUEST_HANDLE (void ) arg);int compat_oprof_arch_counter (XEN_GUEST_HANDLE (void ) arg); +int xenoprof_arch_ibs_counter (XEN_GUEST_HANDLE (void ) arg);struct vcpu ;struct cpu_user_regs ; + +/* AMD IBS support */ +u32 ibs_init (void ); +extern u32 ibs_caps;int xenoprofile_get_mode (struct vcpu *v,struct cpu_user_regs *const regs);
xen/include/public/xenoprof.h +15 -1
@@ -50,7 +50,11 @@#define XENOPROF_shutdown 13#define XENOPROF_get_buffer 14#define XENOPROF_set_backtrace 15 -#define XENOPROF_last_op 15 + +/* AMD IBS support */ +#define XENOPROF_get_ibs_caps 16 +#define XENOPROF_ibs_counter 17 +#define XENOPROF_last_op 17#define MAX_OPROF_EVENTS 32#define MAX_OPROF_DOMAINS 25
@@ -124,6 +128,16 @@ typedef struct xenoprof_passive { } xenoprof_passive_t;DEFINE_XEN_GUEST_HANDLE (xenoprof_passive_t); +struct xenoprof_ibs_counter { +uint64_t op_enabled; +uint64_t fetch_enabled; +uint64_t max_cnt_fetch; +uint64_t max_cnt_op; +uint64_t rand_en; +uint64_t dispatched_ops; +}; +typedef struct xenoprof_ibs_counter xenoprof_ibs_counter_t ; +DEFINE_XEN_GUEST_HANDLE (xenoprof_ibs_counter_t);#endif /* __XEN_PUBLIC_XENOPROF_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel