perf/x86/intel/uncore: correct num_boxes for IIO and IRP
Subsystems (2)
PATCH 1/2 perf/x86/intel/uncore: correct num_boxes for IIO and IRP
From: Kan Liang <[email protected]>
There are 6 IIO/IRP boxes for CBDMA, PCIe0-2, MCP 0 and MCP 1 separately.
Correct the num_boxes.
--- arch/x86/events/intel/uncore_snbep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore_snbep.c +2 -2
@@ -3462,7 +3462,7 @@ static struct intel_uncore_ops skx_uncore_iio_ops = {static struct intel_uncore_type skx_uncore_iio = { .name ="iio" , .num_counters =4 , - .num_boxes =5 , + .num_boxes =6 , .perf_ctr_bits =48 , .event_ctl =SKX_IIO0_MSR_PMON_CTL0 , .perf_ctr =SKX_IIO0_MSR_PMON_CTR0 ,
@@ -3492,7 +3492,7 @@ static const struct attribute_group skx_uncore_format_group = {static struct intel_uncore_type skx_uncore_irp = { .name ="irp" , .num_counters =2 , - .num_boxes =5 , + .num_boxes =6 , .perf_ctr_bits =48 , .event_ctl =SKX_IRP0_MSR_PMON_CTL0 , .perf_ctr =SKX_IRP0_MSR_PMON_CTR0 ,
Signature · 1 line
2.7.4
PATCH 2/2 perf/x86/intel/uncore: support IIO freerunning counter for SKX
From: Kan Liang <[email protected]>
As of Skylake Server, there are a number of free-running counters in each IIO Box that collect counts for per box IO clocks and per Port Input/Output x BW/Utilization.
The event code of free running event is shared with fixed event, which is 0xff.
The umask of free running event starts from 0x10. The umask less than 0x10 is reserved for fixed event.
The Free running counters could have different MSR location and offset. Accordingly, they are divided into different types. Each type is limited to only have at most 16 events.
So the umask of the first free running events type starts from 0x10. The umask of the second starts from 0x20. The rest can be done in the same manner.
Freerunning counters cannot be written by SW. Counting will be suspended only when the IIO Box is powered down. They are specially handled in uncore_pmu_event_add/del/start/stop and not added in box->events list.
The bit width of freerunning counter is 36-bit.
--- arch/x86/events/intel/uncore.c | 33 +++++++++++++++++- arch/x86/events/intel/uncore.h | 67 +++++++++++++++++++++++++++++++++++- arch/x86/events/intel/uncore_snbep.c | 58 +++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore.c +32 -1
@@ -218,7 +218,9 @@ void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *eu64 prev_count, new_count, delta;int shift; -if (event->hw.idx >=UNCORE_PMC_IDX_FIXED ) +if (event->hw.idx >=UNCORE_PMC_IDX_FREERUNNING ) + shift =64 -uncore_free_running_bits (box, event); +else if (event->hw.idx ==UNCORE_PMC_IDX_FIXED ) shift =64 -uncore_fixed_ctr_bits (box);else shift =64 -uncore_perf_ctr_bits (box);
@@ -362,6 +364,9 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader,if (n >= max_count)return -EINVAL ; +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) +continue ; + box->event_list[n] = event; n++; }
@@ -454,6 +459,12 @@ static void uncore_pmu_event_start(struct perf_event *event, int flags)struct intel_uncore_box *box =uncore_event_to_box (event);int idx = event->hw.idx; +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) { +local64_set (&event->hw.prev_count, +uncore_read_counter (box, event)); +return ; + } +if (WARN_ON_ONCE (!(event->hw.state &PERF_HES_STOPPED )))return ;
@@ -479,6 +490,11 @@ static void uncore_pmu_event_stop(struct perf_event *event, int flags)struct intel_uncore_box *box =uncore_event_to_box (event);struct hw_perf_event *hwc = &event->hw; +if (hwc->idx ==UNCORE_PMC_IDX_FREERUNNING ) { +uncore_perf_event_update (box, event); +return ; + } +if (__test_and_clear_bit (hwc->idx, box->active_mask)) {uncore_disable_event (box, event); box->n_active--;
@@ -512,6 +528,13 @@ static int uncore_pmu_event_add(struct perf_event *event, int flags)if (!box)return -ENODEV ; +if (hwc->idx ==UNCORE_PMC_IDX_FREERUNNING ) { + event->hw.event_base =uncore_free_running_msr (box, event); +if (flags &PERF_EF_START ) +uncore_pmu_event_start (event,0 ); +return 0 ; + } + ret = n =uncore_collect_events (box, event, false);if (ret <0 )return ret;
@@ -570,6 +593,9 @@ static void uncore_pmu_event_del(struct perf_event *event, int flags)uncore_pmu_event_stop (event,PERF_EF_UPDATE ); +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) +return ; +for (i =0 ; i < box->n_events; i++) {if (event == box->event_list[i]) {uncore_put_event_constraint (box, event);
@@ -690,6 +716,11 @@ static int uncore_pmu_event_init(struct perf_event *event)/* fixed counters have event field hardcoded to zero */ hwc->config =0ULL ; + }else if (is_free_running_event (event)) { +if (UNCORE_FREE_RUNNING_MSR_IDX (event->attr.config) > +uncore_num_free_running (box, event)) +return -EINVAL ; + event->hw.idx =UNCORE_PMC_IDX_FREERUNNING ; }else { hwc->config = event->attr.config & (pmu->type->event_mask | ((u64 )pmu->type->event_mask_ext <<32 ));
arch/x86/events/intel/uncore.h +66 -1
114 lines not on this page · raw message
arch/x86/events/intel/uncore_snbep.c +58 -0
72 lines not on this page · raw message
Signature · 1 line
2.7.4
RE: [PATCH 2/2] perf/x86/intel/uncore: support IIO freerunning counter for SKX
Ping.
Any comments for this patch?
Thanks,
Kan
Quoted 377 lines
From: Kan Liang <[email protected]>
As of Skylake Server, there are a number of free-running counters in each IIO Box that collect counts for per box IO clocks and per Port Input/Output x BW/Utilization.
The event code of free running event is shared with fixed event, which is
0xff.
The umask of free running event starts from0x10. The umask less than0x10is reserved for fixed event.The Free running counters could have different MSR location and offset. Accordingly, they are divided into different types. Each type is limited to only have at most 16 events.
So the umask of the first free running events type starts from0x10. The umask of the second starts from0x20. The rest can be done in the same manner.Freerunning counters cannot be written by SW. Counting will be suspended only when the IIO Box is powered down. They are specially handled in uncore_pmu_event_add/del/start/stop and not added in
box->eventslist.The bit width of freerunning counter is 36-bit.
Signed-off-by Kan Liang <[email protected]>--- arch/x86/events/intel/uncore.c | 33 +++++++++++++++++- arch/x86/events/intel/uncore.h | 67 +++++++++++++++++++++++++++++++++++- arch/x86/events/intel/uncore_snbep.c | 58 +++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 2 deletions(-)arch/x86/events/intel/uncore.c +0
-0@@ -218,7 +218,9 @@ void uncore_perf_event_update(struct
intel_uncore_box*box, structperf_event*earch/x86/events/intel/uncore.c +6
-1u64 prev_count, new_count, delta;int shift; -if (event->hw.idx >=UNCORE_PMC_IDX_FIXED ) +if (event->hw.idx >=UNCORE_PMC_IDX_FREERUNNING ) + shift =64 -uncore_free_running_bits (box, event); +else if (event->hw.idx ==UNCORE_PMC_IDX_FIXED ) shift =64 -uncore_fixed_ctr_bits (box);else shift =64 -uncore_perf_ctr_bits (box);@@ -362,6 +364,9 @@ uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, if (n >= max_count) return -EINVAL; +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) +continue ; + box->event_list[n] = event; n++;arch/x86/events/intel/uncore.c +11
-0}@@ -454,6 +459,12 @@ static void uncore_pmu_event_start(struct perf_event *event, int flags)struct intel_uncore_box *box =uncore_event_to_box (event);int idx = event->hw.idx; +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) { +local64_set (&event->hw.prev_count, +uncore_read_counter (box, event)); +return ; + } +if (WARN_ON_ONCE (!(event->hw.state &PERF_HES_STOPPED )))return ;@@ -479,6 +490,11 @@ static void uncore_pmu_event_stop(struct perf_event *event, int flags)struct intel_uncore_box *box =uncore_event_to_box (event);struct hw_perf_event *hwc = &event->hw; +if (hwc->idx ==UNCORE_PMC_IDX_FREERUNNING ) { +uncore_perf_event_update (box, event); +return ; + } +if (__test_and_clear_bit (hwc->idx, box->active_mask)) {uncore_disable_event (box, event);arch/x86/events/intel/uncore.c +7
-0box->n_active--;@@ -512,6 +528,13 @@ static int uncore_pmu_event_add(struct perf_event *event, int flags)if (!box)return -ENODEV ; +if (hwc->idx ==UNCORE_PMC_IDX_FREERUNNING ) { + event->hw.event_base =uncore_free_running_msr (box, event); +if (flags &PERF_EF_START ) +uncore_pmu_event_start (event,0 ); +return 0 ; + } + ret = n =uncore_collect_events (box, event, false);arch/x86/events/intel/uncore.c +3
-0if (ret <0 )return ret;@@ -570,6 +593,9 @@ static void uncore_pmu_event_del(struct perf_event *event, int flags)uncore_pmu_event_stop (event,PERF_EF_UPDATE ); +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) +return ; +for (i =0 ; i < box->n_events; i++) {if (event == box->event_list[i]) {arch/x86/events/intel/uncore.c +5
-0uncore_put_event_constraint (box, event);@@ -690,6 +716,11 @@ static int uncore_pmu_event_init(struct perf_event *event)/* fixed counters have event field hardcoded to zero */ hwc->config =0ULL ; + }else if (is_free_running_event (event)) { +if (UNCORE_FREE_RUNNING_MSR_IDX (event->attr.config) > +uncore_num_free_running (box, event)) +return -EINVAL ; + event->hw.idx =UNCORE_PMC_IDX_FREERUNNING ; }else { hwc->config = event->attr.config &(
pmu->type->event_mask| ((u64)pmu->type-Quoted 1 line
event_mask_ext<< 32));arch/x86/events/intel/uncore.h +2
-1@@ -12,7 +12,25 @@#define UNCORE_FIXED_EVENT 0xff#define UNCORE_PMC_IDX_MAX_GENERIC 8#define UNCORE_PMC_IDX_FIXED UNCORE_PMC_IDX_MAX_GENERIC -#define UNCORE_PMC_IDX_MAX (UNCORE_PMC_IDX_FIXED + 1) +#define UNCORE_PMC_IDX_FREERUNNING (UNCORE_PMC_IDX_FIXED + 1) +#define UNCORE_PMC_IDX_MAX (
UNCORE_PMC_IDX_FREERUNNING+ 1)arch/x86/events/intel/uncore.h +14
-0+ +/* +* Free running MSR events have the same event code 0xff as fixed events. +* The Free running events umask starts from 0x10. +* The umask which is less than 0x10 is reserved for fixed events. +* +* The Free running events are divided into different types according to +* MSR location, bit width or definition. Each type is limited to only have +* at most 16 events. +* So the umask of first type starts from 0x10, the second starts from 0x20, +* the rest can be done in the same manner. +*/ +#define UNCORE_FREE_RUNNING_MSR_START 0x10 +#define UNCORE_FREE_RUNNING_MSR_IDX (config) ((config >> 8)&
0xf)arch/x86/events/intel/uncore.h +2
-0+#define UNCORE_FREE_RUNNING_MSR_TYPE_IDX (config) \ + ((((config >> 8) - UNCORE_FREE_RUNNING_MSR_START) >> 4)&
0xf)arch/x86/events/intel/uncore.h +23
-0+#define UNCORE_PCI_DEV_FULL_DATA (dev, func, type, idx) \ ((dev << 24) | (func << 16) | (type << 8) | idx)@@ -34,6 +52,7 @@ struct intel_uncore_ops;struct intel_uncore_pmu ;struct intel_uncore_box ;struct uncore_event_desc ; +struct free_running_msr ;struct intel_uncore_type {const char *name;@@ -41,6 +60,7 @@ struct intel_uncore_type {int num_boxes;int perf_ctr_bits;int fixed_ctr_bits; +int num_free_running_type;unsigned perf_ctr;unsigned event_ctl;unsigned event_mask;@@ -58,6 +78,7 @@ struct intel_uncore_type {struct intel_uncore_pmu *pmus;struct intel_uncore_ops *ops;struct uncore_event_desc *event_descs; +struct free_running_msr *free_running;const struct attribute_group *attr_groups[4 ];struct pmu *pmu;/* for custom pmu ops */ };@@ -128,6 +149,13 @@ struct uncore_event_desc {const char *config; }; +struct free_running_msr { +unsigned msr_base; +unsigned msr_off; +unsigned num_counters; +unsigned bits; +}; +struct pci2phy_map {struct list_head list;int segment;@@ -214,6 +242,18 @@ static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) }static inline +unsigned uncore_free_running_msr (struct intel_uncore_box *box, +struct perf_event *event) +{ +unsigned type =UNCORE_FREE_RUNNING_MSR_TYPE_IDX (event- >attr.config); +unsigned idx =UNCORE_FREE_RUNNING_MSR_IDX (event- >attr.config); +struct intel_uncore_pmu *pmu = box->pmu; + +return pmu->type->free_running[type].msr_base + idx + + pmu->type->free_running[type].msr_off * pmu->pmu_idx; +} + +static inlineunsigned
uncore_msr_event_ctl(struct intel_uncore_box *box, int idx){arch/x86/events/intel/uncore.h +22
-0return box->pmu->type->event_ctl +@@ -275,11 +315,36 @@ static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)return box->pmu->type->fixed_ctr_bits; } +static inline unsigned +uncore_free_running_bits (struct intel_uncore_box *box, +struct perf_event *event) +{ +unsigned idx =UNCORE_FREE_RUNNING_MSR_TYPE_IDX (event- >attr.config); + +return box->pmu->type->free_running[idx].bits; +} + +static inline int uncore_num_free_running (struct intel_uncore_box *box, +struct perf_event *event) +{ +unsigned idx =UNCORE_FREE_RUNNING_MSR_TYPE_IDX (event- >attr.config); + +return box->pmu->type->free_running[idx].num_counters; +} +static inline int uncore_num_counters (struct intel_uncore_box *box) {return box->pmu->type->num_counters; } +static inline bool is_free_running_event (struct perf_event *event) +{ +u64 cfg = event->attr.config; + + return (((cfg & UNCORE_FIXED_EVENT) == UNCORE_FIXED_EVENT)&&
arch/x86/events/intel/uncore.h +1
-0+ (((cfg >> 8) & 0xff) >=
UNCORE_FREE_RUNNING_MSR_START));arch/x86/events/intel/uncore.h +2
-0+} +static inline void uncore_disable_box (struct intel_uncore_box *box) {if (box->pmu->type->ops->disable_box)arch/x86/events/intel/uncore_snbep.c +21
-0@@ -3459,6 +3459,61 @@ static struct intel_uncore_ops skx_uncore_iio_ops = { .read_counter = uncore_msr_read_counter, }; +enum perf_uncore_iio_free_running_msr_type_id { +SKX_IIO_MSR_IOCLK =0 , +SKX_IIO_MSR_BW =1 , +SKX_IIO_MSR_UTIL =2 , + +SKX_IIO_FREE_RUNNING_MSR_TYPE_MAX , +}; + + +static struct free_running_msr skx_iio_free_running_msr[] = { + [SKX_IIO_MSR_IOCLK ] = {0xa45 ,0x20 ,1 ,36 }, + [SKX_IIO_MSR_BW ] = {0xb00 ,0x10 ,8 ,36 }, + [SKX_IIO_MSR_UTIL ] = {0xb08 ,0x10 ,8 ,36 }, +}; + +static struct uncore_event_desc skx_uncore_iio_events[] = { +/* Free-Running IO CLOCKS Counter */ +INTEL_UNCORE_EVENT_DESC (ioclk,"event=0xff,umask=0x10" ), +/* Free-Running IIO Bandwidth Counters */ +INTEL_UNCORE_EVENT_DESC (bw_in_port0,"event=0xff,umask=0x20" ), + INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_in_port0.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_in_port1,"event=0xff,umask=0x21"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_in_port1.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_in_port2,"event=0xff,umask=0x22"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_in_port2.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_in_port3,"event=0xff,umask=0x23"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_in_port3.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_out_port0,"event=0xff,umask=0x24"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_out_port0.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_out_port0.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_out_port1,"event=0xff,umask=0x25"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_out_port1.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_out_port1.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_out_port2,"event=0xff,umask=0x26"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_out_port2.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +2
-0+INTEL_UNCORE_EVENT_DESC (bw_out_port2.unit,"MiB" ), + INTEL_UNCORE_EVENT_DESC(bw_out_port3,"event=0xff,umask=0x27"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(bw_out_port3.scale,"3.814697266e-6"),arch/x86/events/intel/uncore_snbep.c +3
-0+INTEL_UNCORE_EVENT_DESC (bw_out_port3.unit,"MiB" ), +/* Free-running IIO Utilization Counters */ + INTEL_UNCORE_EVENT_DESC(util_in_port0,"event=0xff,umask=0x30"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_out_port0,"event=0xff,umask=0x31"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_in_port1,"event=0xff,umask=0x32"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_out_port1,"event=0xff,umask=0x33"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_in_port2,"event=0xff,umask=0x34"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_out_port2,"event=0xff,umask=0x35"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_in_port3,"event=0xff,umask=0x36"),arch/x86/events/intel/uncore_snbep.c +1
-0+ INTEL_UNCORE_EVENT_DESC(util_out_port3,"event=0xff,umask=0x37"),arch/x86/events/intel/uncore_snbep.c +6
-0+ { /* end: all zeroes */ }, +}; +static struct intel_uncore_type skx_uncore_iio = { .name ="iio" , .num_counters =4 ,@@ -3470,8 +3525,11 @@ static struct intel_uncore_type skx_uncore_iio = { .event_mask_ext = SKX_IIO_PMON_RAW_EVENT_MASK_EXT, .box_ctl = SKX_IIO0_MSR_PMON_BOX_CTL, .msr_offset = SKX_IIO_MSR_OFFSET, + .num_free_running_type = SKX_IIO_FREE_RUNNING_MSR_TYPE_MAX, + .free_running = skx_iio_free_running_msr, .constraints = skx_uncore_iio_constraints, .ops = &skx_uncore_iio_ops, + .event_descs = skx_uncore_iio_events, .format_group = &skx_uncore_iio_format_group,};
--
2.7.4
Re: [PATCH 2/2] perf/x86/intel/uncore: support IIO freerunning counter for SKX
In reply to [email protected]arch/x86/events/intel/uncore.c void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *e · line 223
Quoted 4 lines · On Mon, 11 Sep 2017, [email protected] wrote:
arch/x86/events/intel/uncore.c +3
-1-if (event->hw.idx >=UNCORE_PMC_IDX_FIXED ) +if (event->hw.idx >=UNCORE_PMC_IDX_FREERUNNING ) + shift =64 -uncore_free_running_bits (box, event); +else if (event->hw.idx ==UNCORE_PMC_IDX_FIXED )
I have no idea why the original check was
event->hw.idx >= UNCORE_PMC_IDX_FIXED
and why the new one is
event->hw.idx >= UNCORE_PMC_IDX_FREERUNNING
when you check in the next conditional:
arch/x86/events/intel/uncore.c uncore_collect_events(struct intel_uncore_box *box, struct perf_event *leader, · line 368
Quoted 2 lines
arch/x86/events/intel/uncore.c +2
-0+if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) +continue ;
This stinks. Anything > UNCORE_PMC_IDX_FREERUNNING is bogus.
arch/x86/events/intel/uncore.c static void uncore_pmu_event_start(struct perf_event *event, int flags) · line 464
Quoted 7 lines
arch/x86/events/intel/uncore.c +3
-0@@ -454,6 +459,12 @@ static void uncore_pmu_event_start(struct perf_event *event, int flags)struct intel_uncore_box *box =uncore_event_to_box (event);int idx = event->hw.idx; +if (event->hw.idx ==UNCORE_PMC_IDX_FREERUNNING ) { +local64_set (&event->hw.prev_count, +uncore_read_counter (box, event));
A comment why this has special treatment would be helpful. Here and in other places.
Quoted 7 lines
arch/x86/events/intel/uncore.h +7
-0+/* +* Free running MSR events have the same event code 0xff as fixed events. +* The Free running events umask starts from 0x10. +* The umask which is less than 0x10 is reserved for fixed events. +* +* The Free running events are divided into different types according to +* MSR location, bit width or definition. Each type is limited to only have
arch/x86/events/intel/uncore.h
Quoted 10 lines
arch/x86/events/intel/uncore.h +9
-0+* at most 16 events. +* So the umask of first type starts from 0x10, the second starts from 0x20, +* the rest can be done in the same manner. +*/ +#define UNCORE_FREE_RUNNING_MSR_START 0x10 +#define UNCORE_FREE_RUNNING_MSR_IDX (config) ((config >> 8) & 0xf) +#define UNCORE_FREE_RUNNING_MSR_TYPE_IDX (config) \ + ((((config >> 8) - UNCORE_FREE_RUNNING_MSR_START) >> 4) & 0xf) +
Any reason why these two need to be fugly macros instead of inlines which simply take an event or an attribute pointer?
arch/x86/events/intel/uncore.h struct intel_uncore_type { · line 63
Quoted 13 lines
arch/x86/events/intel/uncore.h +2
-0@@ -34,6 +52,7 @@ struct intel_uncore_ops;struct intel_uncore_pmu ;struct intel_uncore_box ;struct uncore_event_desc ; +struct free_running_msr ;struct intel_uncore_type {const char *name;@@ -41,6 +60,7 @@ struct intel_uncore_type {int num_boxes;int perf_ctr_bits;int fixed_ctr_bits; +int num_free_running_type;
s/type/types/
arch/x86/events/intel/uncore.h struct uncore_event_desc { · line 153
Quoted 6 lines
arch/x86/events/intel/uncore.h +2
-0@@ -128,6 +149,13 @@ struct uncore_event_desc {const char *config; }; +struct free_running_msr { +unsigned msr_base;
unsigned int please
Quoted 9 lines
arch/x86/events/intel/uncore.h +5
-0+unsigned msr_off; +unsigned num_counters; +unsigned bits; +}; +struct pci2phy_map {struct list_head list;int segment;
arch/x86/events/intel/uncore.h static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) · line 250
Quoted 9 lines
arch/x86/events/intel/uncore.h +7
-0@@ -214,6 +242,18 @@ static inline unsigned uncore_msr_fixed_ctr(struct intel_uncore_box *box) } +enum perf_uncore_iio_free_running_msr_type_id { +SKX_IIO_MSR_IOCLK =0 , +SKX_IIO_MSR_BW =1 , +SKX_IIO_MSR_UTIL =2 , + +SKX_IIO_FREE_RUNNING_MSR_TYPE_MAX , +};
Please split the patch in two parts:
1) Add infrastructure for free running counters
2) Add SKX support
Thanks,
tglx
tip-bot for Kan Liang
merge bot[tip:x86/urgent] perf/x86/intel/uncore: Correct num_boxes for IIO and IRP
In reply to [email protected]perf/x86/intel/uncore: Correct num_boxes for IIO and IRP
Commit-ID: 29b46dfb136cdbeece542b3f01115237e43f2855 Gitweb: http://git.kernel.org/tip/29b46dfb136cdbeece542b3f01115237e43f2855 Author: Kan Liang <[email protected]> AuthorDate: Mon, 11 Sep 2017 10:10:15 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Mon, 25 Sep 2017 12:43:56 +0200
perf/x86/intel/uncore: Correct num_boxes for IIO and IRP
There are 6 IIO/IRP boxes for CBDMA, PCIe0-2, MCP 0 and MCP 1 separately. Correct the num_boxes.
--- arch/x86/events/intel/uncore_snbep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/uncore_snbep.c +2 -2
@@ -3462,7 +3462,7 @@ static struct intel_uncore_ops skx_uncore_iio_ops = {static struct intel_uncore_type skx_uncore_iio = { .name ="iio" , .num_counters =4 , - .num_boxes =5 , + .num_boxes =6 , .perf_ctr_bits =48 , .event_ctl =SKX_IIO0_MSR_PMON_CTL0 , .perf_ctr =SKX_IIO0_MSR_PMON_CTR0 ,
@@ -3492,7 +3492,7 @@ static const struct attribute_group skx_uncore_format_group = {static struct intel_uncore_type skx_uncore_irp = { .name ="irp" , .num_counters =2 , - .num_boxes =5 , + .num_boxes =6 , .perf_ctr_bits =48 , .event_ctl =SKX_IRP0_MSR_PMON_CTL0 , .perf_ctr =SKX_IRP0_MSR_PMON_CTR0 ,