Skip to content

Commit d3fe6f0

Browse files
Dapeng MiPeter Zijlstra
authored andcommitted
perf/x86/intel: Add PMU support for ArrowLake-H
ArrowLake-H contains 3 different uarchs, LionCove, Skymont and Crestmont. It is different with previous hybrid processors which only contains two kinds of uarchs. This patch adds PMU support for ArrowLake-H processor, adds ARL-H specific events which supports the 3 kinds of uarchs, such as td_retiring_arl_h, and extends some existed format attributes like offcore_rsp to make them be available to support ARL-H as well. Althrough these format attributes like offcore_rsp have been extended to support ARL-H, they can still support the regular hybrid platforms with 2 kinds of uarchs since the helper hybrid_format_is_visible() would filter PMU types and only show the format attribute for available PMUs. Signed-off-by: Dapeng Mi <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Kan Liang <[email protected]> Tested-by: Yongwei Ma <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 9f4a397 commit d3fe6f0

File tree

3 files changed

+127
-3
lines changed

3 files changed

+127
-3
lines changed

arch/x86/events/intel/core.c

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4599,6 +4599,28 @@ static inline bool erratum_hsw11(struct perf_event *event)
45994599
X86_CONFIG(.event=0xc0, .umask=0x01);
46004600
}
46014601

4602+
static struct event_constraint *
4603+
arl_h_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
4604+
struct perf_event *event)
4605+
{
4606+
struct x86_hybrid_pmu *pmu = hybrid_pmu(event->pmu);
4607+
4608+
if (pmu->pmu_type == hybrid_tiny)
4609+
return cmt_get_event_constraints(cpuc, idx, event);
4610+
4611+
return mtl_get_event_constraints(cpuc, idx, event);
4612+
}
4613+
4614+
static int arl_h_hw_config(struct perf_event *event)
4615+
{
4616+
struct x86_hybrid_pmu *pmu = hybrid_pmu(event->pmu);
4617+
4618+
if (pmu->pmu_type == hybrid_tiny)
4619+
return intel_pmu_hw_config(event);
4620+
4621+
return adl_hw_config(event);
4622+
}
4623+
46024624
/*
46034625
* The HSW11 requires a period larger than 100 which is the same as the BDM11.
46044626
* A minimum period of 128 is enforced as well for the INST_RETIRED.ALL.
@@ -5974,6 +5996,37 @@ static struct attribute *lnl_hybrid_events_attrs[] = {
59745996
NULL
59755997
};
59765998

5999+
/* The event string must be in PMU IDX order. */
6000+
EVENT_ATTR_STR_HYBRID(topdown-retiring,
6001+
td_retiring_arl_h,
6002+
"event=0xc2,umask=0x02;event=0x00,umask=0x80;event=0xc2,umask=0x0",
6003+
hybrid_big_small_tiny);
6004+
EVENT_ATTR_STR_HYBRID(topdown-bad-spec,
6005+
td_bad_spec_arl_h,
6006+
"event=0x73,umask=0x0;event=0x00,umask=0x81;event=0x73,umask=0x0",
6007+
hybrid_big_small_tiny);
6008+
EVENT_ATTR_STR_HYBRID(topdown-fe-bound,
6009+
td_fe_bound_arl_h,
6010+
"event=0x9c,umask=0x01;event=0x00,umask=0x82;event=0x71,umask=0x0",
6011+
hybrid_big_small_tiny);
6012+
EVENT_ATTR_STR_HYBRID(topdown-be-bound,
6013+
td_be_bound_arl_h,
6014+
"event=0xa4,umask=0x02;event=0x00,umask=0x83;event=0x74,umask=0x0",
6015+
hybrid_big_small_tiny);
6016+
6017+
static struct attribute *arl_h_hybrid_events_attrs[] = {
6018+
EVENT_PTR(slots_adl),
6019+
EVENT_PTR(td_retiring_arl_h),
6020+
EVENT_PTR(td_bad_spec_arl_h),
6021+
EVENT_PTR(td_fe_bound_arl_h),
6022+
EVENT_PTR(td_be_bound_arl_h),
6023+
EVENT_PTR(td_heavy_ops_adl),
6024+
EVENT_PTR(td_br_mis_adl),
6025+
EVENT_PTR(td_fetch_lat_adl),
6026+
EVENT_PTR(td_mem_bound_adl),
6027+
NULL,
6028+
};
6029+
59776030
/* Must be in IDX order */
59786031
EVENT_ATTR_STR_HYBRID(mem-loads, mem_ld_adl, "event=0xd0,umask=0x5,ldlat=3;event=0xcd,umask=0x1,ldlat=3", hybrid_big_small);
59796032
EVENT_ATTR_STR_HYBRID(mem-stores, mem_st_adl, "event=0xd0,umask=0x6;event=0xcd,umask=0x2", hybrid_big_small);
@@ -5992,6 +6045,21 @@ static struct attribute *mtl_hybrid_mem_attrs[] = {
59926045
NULL
59936046
};
59946047

6048+
EVENT_ATTR_STR_HYBRID(mem-loads,
6049+
mem_ld_arl_h,
6050+
"event=0xd0,umask=0x5,ldlat=3;event=0xcd,umask=0x1,ldlat=3;event=0xd0,umask=0x5,ldlat=3",
6051+
hybrid_big_small_tiny);
6052+
EVENT_ATTR_STR_HYBRID(mem-stores,
6053+
mem_st_arl_h,
6054+
"event=0xd0,umask=0x6;event=0xcd,umask=0x2;event=0xd0,umask=0x6",
6055+
hybrid_big_small_tiny);
6056+
6057+
static struct attribute *arl_h_hybrid_mem_attrs[] = {
6058+
EVENT_PTR(mem_ld_arl_h),
6059+
EVENT_PTR(mem_st_arl_h),
6060+
NULL,
6061+
};
6062+
59956063
EVENT_ATTR_STR_HYBRID(tx-start, tx_start_adl, "event=0xc9,umask=0x1", hybrid_big);
59966064
EVENT_ATTR_STR_HYBRID(tx-commit, tx_commit_adl, "event=0xc9,umask=0x2", hybrid_big);
59976065
EVENT_ATTR_STR_HYBRID(tx-abort, tx_abort_adl, "event=0xc9,umask=0x4", hybrid_big);
@@ -6015,8 +6083,8 @@ static struct attribute *adl_hybrid_tsx_attrs[] = {
60156083

60166084
FORMAT_ATTR_HYBRID(in_tx, hybrid_big);
60176085
FORMAT_ATTR_HYBRID(in_tx_cp, hybrid_big);
6018-
FORMAT_ATTR_HYBRID(offcore_rsp, hybrid_big_small);
6019-
FORMAT_ATTR_HYBRID(ldlat, hybrid_big_small);
6086+
FORMAT_ATTR_HYBRID(offcore_rsp, hybrid_big_small_tiny);
6087+
FORMAT_ATTR_HYBRID(ldlat, hybrid_big_small_tiny);
60206088
FORMAT_ATTR_HYBRID(frontend, hybrid_big);
60216089

60226090
#define ADL_HYBRID_RTM_FORMAT_ATTR \
@@ -6039,7 +6107,7 @@ static struct attribute *adl_hybrid_extra_attr[] = {
60396107
NULL
60406108
};
60416109

6042-
FORMAT_ATTR_HYBRID(snoop_rsp, hybrid_small);
6110+
FORMAT_ATTR_HYBRID(snoop_rsp, hybrid_small_tiny);
60436111

60446112
static struct attribute *mtl_hybrid_extra_attr_rtm[] = {
60456113
ADL_HYBRID_RTM_FORMAT_ATTR,
@@ -7121,6 +7189,37 @@ __init int intel_pmu_init(void)
71217189
name = "lunarlake_hybrid";
71227190
break;
71237191

7192+
case INTEL_ARROWLAKE_H:
7193+
intel_pmu_init_hybrid(hybrid_big_small_tiny);
7194+
7195+
x86_pmu.pebs_latency_data = arl_h_latency_data;
7196+
x86_pmu.get_event_constraints = arl_h_get_event_constraints;
7197+
x86_pmu.hw_config = arl_h_hw_config;
7198+
7199+
td_attr = arl_h_hybrid_events_attrs;
7200+
mem_attr = arl_h_hybrid_mem_attrs;
7201+
tsx_attr = adl_hybrid_tsx_attrs;
7202+
extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
7203+
mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr;
7204+
7205+
/* Initialize big core specific PerfMon capabilities. */
7206+
pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
7207+
intel_pmu_init_lnc(&pmu->pmu);
7208+
7209+
/* Initialize Atom core specific PerfMon capabilities. */
7210+
pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
7211+
intel_pmu_init_skt(&pmu->pmu);
7212+
7213+
/* Initialize Lower Power Atom specific PerfMon capabilities. */
7214+
pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_TINY_IDX];
7215+
intel_pmu_init_grt(&pmu->pmu);
7216+
pmu->extra_regs = intel_cmt_extra_regs;
7217+
7218+
intel_pmu_pebs_data_source_arl_h();
7219+
pr_cont("ArrowLake-H Hybrid events, ");
7220+
name = "arrowlake_h_hybrid";
7221+
break;
7222+
71247223
default:
71257224
switch (x86_pmu.version) {
71267225
case 1:

arch/x86/events/intel/ds.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,17 @@ void __init intel_pmu_pebs_data_source_mtl(void)
177177
__intel_pmu_pebs_data_source_cmt(data_source);
178178
}
179179

180+
void __init intel_pmu_pebs_data_source_arl_h(void)
181+
{
182+
u64 *data_source;
183+
184+
intel_pmu_pebs_data_source_lnl();
185+
186+
data_source = x86_pmu.hybrid_pmu[X86_HYBRID_PMU_TINY_IDX].pebs_data_source;
187+
memcpy(data_source, pebs_data_source, sizeof(pebs_data_source));
188+
__intel_pmu_pebs_data_source_cmt(data_source);
189+
}
190+
180191
void __init intel_pmu_pebs_data_source_cmt(void)
181192
{
182193
__intel_pmu_pebs_data_source_cmt(pebs_data_source);
@@ -388,6 +399,16 @@ u64 lnl_latency_data(struct perf_event *event, u64 status)
388399
return lnc_latency_data(event, status);
389400
}
390401

402+
u64 arl_h_latency_data(struct perf_event *event, u64 status)
403+
{
404+
struct x86_hybrid_pmu *pmu = hybrid_pmu(event->pmu);
405+
406+
if (pmu->pmu_type == hybrid_tiny)
407+
return cmt_latency_data(event, status);
408+
409+
return lnl_latency_data(event, status);
410+
}
411+
391412
static u64 load_latency_data(struct perf_event *event, u64 status)
392413
{
393414
union intel_x86_pebs_dse dse;

arch/x86/events/perf_event.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,8 @@ u64 cmt_latency_data(struct perf_event *event, u64 status);
15921592

15931593
u64 lnl_latency_data(struct perf_event *event, u64 status);
15941594

1595+
u64 arl_h_latency_data(struct perf_event *event, u64 status);
1596+
15951597
extern struct event_constraint intel_core2_pebs_event_constraints[];
15961598

15971599
extern struct event_constraint intel_atom_pebs_event_constraints[];
@@ -1711,6 +1713,8 @@ void intel_pmu_pebs_data_source_grt(void);
17111713

17121714
void intel_pmu_pebs_data_source_mtl(void);
17131715

1716+
void intel_pmu_pebs_data_source_arl_h(void);
1717+
17141718
void intel_pmu_pebs_data_source_cmt(void);
17151719

17161720
void intel_pmu_pebs_data_source_lnl(void);

0 commit comments

Comments
 (0)