Skip to content

Commit 5fcccba

Browse files
Gowthami Thiagarajanwilldeacon
authored andcommitted
perf/marvell: Odyssey LLC-TAD performance monitor support
Each TAD provides eight 64-bit counters for monitoring cache behavior.The driver always configures the same counter for all the TADs. The user would end up effectively reserving one of eight counters in every TAD to look across all TADs. The occurrences of events are aggregated and presented to the user at the end of running the workload. The driver does not provide a way for the user to partition TADs so that different TADs are used for different applications. The performance events reflect various internal or interface activities. By combining the values from multiple performance counters, cache performance can be measured in terms such as: cache miss rate, cache allocations, interface retry rate, internal resource occupancy, etc. Each supported counter's event and formatting information is exposed to sysfs at /sys/devices/tad/. Use perf tool stat command to measure the pmu events. For instance: perf stat -e tad_hit_ltg,tad_hit_dtg <workload> Signed-off-by: Gowthami Thiagarajan <gthiagarajan@marvell.com> Link: https://lore.kernel.org/r/20241108040619.753343-6-gthiagarajan@marvell.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 59731e2 commit 5fcccba

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed

Documentation/admin-guide/perf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Performance monitor support
1515
qcom_l3_pmu
1616
starfive_starlink_pmu
1717
mrvl-odyssey-ddr-pmu
18+
mrvl-odyssey-tad-pmu
1819
arm-ccn
1920
arm-cmn
2021
arm-ni
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
====================================================================
2+
Marvell Odyssey LLC-TAD Performance Monitoring Unit (PMU UNCORE)
3+
====================================================================
4+
5+
Each TAD provides eight 64-bit counters for monitoring
6+
cache behavior.The driver always configures the same counter for
7+
all the TADs. The user would end up effectively reserving one of
8+
eight counters in every TAD to look across all TADs.
9+
The occurrences of events are aggregated and presented to the user
10+
at the end of running the workload. The driver does not provide a
11+
way for the user to partition TADs so that different TADs are used for
12+
different applications.
13+
14+
The performance events reflect various internal or interface activities.
15+
By combining the values from multiple performance counters, cache
16+
performance can be measured in terms such as: cache miss rate, cache
17+
allocations, interface retry rate, internal resource occupancy, etc.
18+
19+
The PMU driver exposes the available events and format options under sysfs::
20+
21+
/sys/bus/event_source/devices/tad/events/
22+
/sys/bus/event_source/devices/tad/format/
23+
24+
Examples::
25+
26+
$ perf list | grep tad
27+
tad/tad_alloc_any/ [Kernel PMU event]
28+
tad/tad_alloc_dtg/ [Kernel PMU event]
29+
tad/tad_alloc_ltg/ [Kernel PMU event]
30+
tad/tad_hit_any/ [Kernel PMU event]
31+
tad/tad_hit_dtg/ [Kernel PMU event]
32+
tad/tad_hit_ltg/ [Kernel PMU event]
33+
tad/tad_req_msh_in_exlmn/ [Kernel PMU event]
34+
tad/tad_tag_rd/ [Kernel PMU event]
35+
tad/tad_tot_cycle/ [Kernel PMU event]
36+
37+
$ perf stat -e tad_alloc_dtg,tad_alloc_ltg,tad_alloc_any,tad_hit_dtg,tad_hit_ltg,tad_hit_any,tad_tag_rd <workload>

drivers/perf/marvell_cn10k_tad_pmu.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct tad_pmu {
3939

4040
enum mrvl_tad_pmu_version {
4141
TAD_PMU_V1 = 1,
42+
TAD_PMU_V2,
4243
};
4344

4445
struct tad_pmu_data {
@@ -222,6 +223,24 @@ static const struct attribute_group tad_pmu_events_attr_group = {
222223
.attrs = tad_pmu_event_attrs,
223224
};
224225

226+
static struct attribute *ody_tad_pmu_event_attrs[] = {
227+
TAD_PMU_EVENT_ATTR(tad_req_msh_in_exlmn, 0x3),
228+
TAD_PMU_EVENT_ATTR(tad_alloc_dtg, 0x1a),
229+
TAD_PMU_EVENT_ATTR(tad_alloc_ltg, 0x1b),
230+
TAD_PMU_EVENT_ATTR(tad_alloc_any, 0x1c),
231+
TAD_PMU_EVENT_ATTR(tad_hit_dtg, 0x1d),
232+
TAD_PMU_EVENT_ATTR(tad_hit_ltg, 0x1e),
233+
TAD_PMU_EVENT_ATTR(tad_hit_any, 0x1f),
234+
TAD_PMU_EVENT_ATTR(tad_tag_rd, 0x20),
235+
TAD_PMU_EVENT_ATTR(tad_tot_cycle, 0xFF),
236+
NULL
237+
};
238+
239+
static const struct attribute_group ody_tad_pmu_events_attr_group = {
240+
.name = "events",
241+
.attrs = ody_tad_pmu_event_attrs,
242+
};
243+
225244
PMU_FORMAT_ATTR(event, "config:0-7");
226245

227246
static struct attribute *tad_pmu_format_attrs[] = {
@@ -260,6 +279,13 @@ static const struct attribute_group *tad_pmu_attr_groups[] = {
260279
NULL
261280
};
262281

282+
static const struct attribute_group *ody_tad_pmu_attr_groups[] = {
283+
&ody_tad_pmu_events_attr_group,
284+
&tad_pmu_format_attr_group,
285+
&tad_pmu_cpumask_attr_group,
286+
NULL
287+
};
288+
263289
static int tad_pmu_probe(struct platform_device *pdev)
264290
{
265291
const struct tad_pmu_data *dev_data;
@@ -350,6 +376,8 @@ static int tad_pmu_probe(struct platform_device *pdev)
350376

351377
if (version == TAD_PMU_V1)
352378
tad_pmu->pmu.attr_groups = tad_pmu_attr_groups;
379+
else
380+
tad_pmu->pmu.attr_groups = ody_tad_pmu_attr_groups;
353381

354382
tad_pmu->cpu = raw_smp_processor_id();
355383

@@ -385,6 +413,12 @@ static const struct tad_pmu_data tad_pmu_data = {
385413
};
386414
#endif
387415

416+
#ifdef CONFIG_ACPI
417+
static const struct tad_pmu_data tad_pmu_v2_data = {
418+
.id = TAD_PMU_V2,
419+
};
420+
#endif
421+
388422
#ifdef CONFIG_OF
389423
static const struct of_device_id tad_pmu_of_match[] = {
390424
{ .compatible = "marvell,cn10k-tad-pmu", .data = &tad_pmu_data },
@@ -395,6 +429,7 @@ static const struct of_device_id tad_pmu_of_match[] = {
395429
#ifdef CONFIG_ACPI
396430
static const struct acpi_device_id tad_pmu_acpi_match[] = {
397431
{"MRVL000B", (kernel_ulong_t)&tad_pmu_data},
432+
{"MRVL000D", (kernel_ulong_t)&tad_pmu_v2_data},
398433
{},
399434
};
400435
MODULE_DEVICE_TABLE(acpi, tad_pmu_acpi_match);

0 commit comments

Comments
 (0)