Skip to content

Commit a430021

Browse files
Kan LiangPeter Zijlstra
authored andcommitted
perf/x86/intel: Add Crestmont PMU
The Grand Ridge and Sierra Forest are successors to Snow Ridge. They both have Crestmont core. From the core PMU's perspective, they are similar to the e-core of MTL. The only difference is the LBR event logging feature, which will be implemented in the following patches. Create a non-hybrid PMU setup for Grand Ridge and Sierra Forest. Signed-off-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Andi Kleen <ak@linux.intel.com> Link: https://lore.kernel.org/r/20230522113040.2329924-1-kan.liang@linux.intel.com
1 parent 5354456 commit a430021

File tree

3 files changed

+60
-3
lines changed

3 files changed

+60
-3
lines changed

arch/x86/events/intel/core.c

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,17 @@ static struct extra_reg intel_grt_extra_regs[] __read_mostly = {
21292129
EVENT_EXTRA_END
21302130
};
21312131

2132+
EVENT_ATTR_STR(topdown-retiring, td_retiring_cmt, "event=0x72,umask=0x0");
2133+
EVENT_ATTR_STR(topdown-bad-spec, td_bad_spec_cmt, "event=0x73,umask=0x0");
2134+
2135+
static struct attribute *cmt_events_attrs[] = {
2136+
EVENT_PTR(td_fe_bound_tnt),
2137+
EVENT_PTR(td_retiring_cmt),
2138+
EVENT_PTR(td_bad_spec_cmt),
2139+
EVENT_PTR(td_be_bound_tnt),
2140+
NULL
2141+
};
2142+
21322143
static struct extra_reg intel_cmt_extra_regs[] __read_mostly = {
21332144
/* must define OFFCORE_RSP_X first, see intel_fixup_er() */
21342145
INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x800ff3ffffffffffull, RSP_0),
@@ -4840,6 +4851,8 @@ PMU_FORMAT_ATTR(ldlat, "config1:0-15");
48404851

48414852
PMU_FORMAT_ATTR(frontend, "config1:0-23");
48424853

4854+
PMU_FORMAT_ATTR(snoop_rsp, "config1:0-63");
4855+
48434856
static struct attribute *intel_arch3_formats_attr[] = {
48444857
&format_attr_event.attr,
48454858
&format_attr_umask.attr,
@@ -4870,6 +4883,13 @@ static struct attribute *slm_format_attr[] = {
48704883
NULL
48714884
};
48724885

4886+
static struct attribute *cmt_format_attr[] = {
4887+
&format_attr_offcore_rsp.attr,
4888+
&format_attr_ldlat.attr,
4889+
&format_attr_snoop_rsp.attr,
4890+
NULL
4891+
};
4892+
48734893
static struct attribute *skl_format_attr[] = {
48744894
&format_attr_frontend.attr,
48754895
NULL,
@@ -5649,7 +5669,6 @@ static struct attribute *adl_hybrid_extra_attr[] = {
56495669
NULL
56505670
};
56515671

5652-
PMU_FORMAT_ATTR_SHOW(snoop_rsp, "config1:0-63");
56535672
FORMAT_ATTR_HYBRID(snoop_rsp, hybrid_small);
56545673

56555674
static struct attribute *mtl_hybrid_extra_attr_rtm[] = {
@@ -6197,6 +6216,37 @@ __init int intel_pmu_init(void)
61976216
name = "gracemont";
61986217
break;
61996218

6219+
case INTEL_FAM6_ATOM_CRESTMONT:
6220+
case INTEL_FAM6_ATOM_CRESTMONT_X:
6221+
x86_pmu.mid_ack = true;
6222+
memcpy(hw_cache_event_ids, glp_hw_cache_event_ids,
6223+
sizeof(hw_cache_event_ids));
6224+
memcpy(hw_cache_extra_regs, tnt_hw_cache_extra_regs,
6225+
sizeof(hw_cache_extra_regs));
6226+
hw_cache_event_ids[C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] = -1;
6227+
6228+
x86_pmu.event_constraints = intel_slm_event_constraints;
6229+
x86_pmu.pebs_constraints = intel_grt_pebs_event_constraints;
6230+
x86_pmu.extra_regs = intel_cmt_extra_regs;
6231+
6232+
x86_pmu.pebs_aliases = NULL;
6233+
x86_pmu.pebs_prec_dist = true;
6234+
x86_pmu.lbr_pt_coexist = true;
6235+
x86_pmu.pebs_block = true;
6236+
x86_pmu.flags |= PMU_FL_HAS_RSP_1;
6237+
x86_pmu.flags |= PMU_FL_INSTR_LATENCY;
6238+
6239+
intel_pmu_pebs_data_source_cmt();
6240+
x86_pmu.pebs_latency_data = mtl_latency_data_small;
6241+
x86_pmu.get_event_constraints = cmt_get_event_constraints;
6242+
x86_pmu.limit_period = spr_limit_period;
6243+
td_attr = cmt_events_attrs;
6244+
mem_attr = grt_mem_attrs;
6245+
extra_attr = cmt_format_attr;
6246+
pr_cont("Crestmont events, ");
6247+
name = "crestmont";
6248+
break;
6249+
62006250
case INTEL_FAM6_WESTMERE:
62016251
case INTEL_FAM6_WESTMERE_EP:
62026252
case INTEL_FAM6_WESTMERE_EX:

arch/x86/events/intel/ds.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void __init intel_pmu_pebs_data_source_adl(void)
144144
__intel_pmu_pebs_data_source_grt(data_source);
145145
}
146146

147-
static void __init intel_pmu_pebs_data_source_cmt(u64 *data_source)
147+
static void __init __intel_pmu_pebs_data_source_cmt(u64 *data_source)
148148
{
149149
data_source[0x07] = OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOPX, FWD);
150150
data_source[0x08] = OP_LH | P(LVL, L3) | LEVEL(L3) | P(SNOOP, HITM);
@@ -164,7 +164,12 @@ void __init intel_pmu_pebs_data_source_mtl(void)
164164

165165
data_source = x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX].pebs_data_source;
166166
memcpy(data_source, pebs_data_source, sizeof(pebs_data_source));
167-
intel_pmu_pebs_data_source_cmt(data_source);
167+
__intel_pmu_pebs_data_source_cmt(data_source);
168+
}
169+
170+
void __init intel_pmu_pebs_data_source_cmt(void)
171+
{
172+
__intel_pmu_pebs_data_source_cmt(pebs_data_source);
168173
}
169174

170175
static u64 precise_store_data(u64 status)

arch/x86/events/perf_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,8 @@ void intel_pmu_pebs_data_source_grt(void);
16061606

16071607
void intel_pmu_pebs_data_source_mtl(void);
16081608

1609+
void intel_pmu_pebs_data_source_cmt(void);
1610+
16091611
int intel_pmu_setup_lbr_filter(struct perf_event *event);
16101612

16111613
void intel_pt_interrupt(void);

0 commit comments

Comments
 (0)