FROMLIST: arm64: perf: Make exporting of pmu events configurable
The PMU export bit (PMCR_EL0.X) is getting reset during pmu reset, Make is configurable using sysctls to enable/disable at runtime. It can also be enabled at early bootup with kernel arguments. Bug: 230559577 Bug: 427401803 Change-Id: I35dcfeed23e64ec9493f9a15dbb43e9966108664 Link: https://lore.kernel.org/lkml/1653306574-20946-1-git-send-email-quic_c_spathi@quicinc.com/ Signed-off-by: Srinivasarao Pathipati <quic_spathi@quicinc.com>
This commit is contained in:
committed by
Treehugger Robot
parent
22d634eb24
commit
273b788415
@@ -1541,6 +1541,10 @@
|
|||||||
Format: { "fix" }
|
Format: { "fix" }
|
||||||
Permit 'security.evm' to be updated regardless of
|
Permit 'security.evm' to be updated regardless of
|
||||||
current integrity status.
|
current integrity status.
|
||||||
|
export_pmu_events
|
||||||
|
[KNL,ARM64] Sets the PMU export bit (PMCR_EL0.X), which enables
|
||||||
|
the exporting of events over an IMPLEMENTATION DEFINED PMU event
|
||||||
|
export bus to another device.
|
||||||
|
|
||||||
early_page_ext [KNL,EARLY] Enforces page_ext initialization to earlier
|
early_page_ext [KNL,EARLY] Enforces page_ext initialization to earlier
|
||||||
stages so cover more early boot allocations.
|
stages so cover more early boot allocations.
|
||||||
|
|||||||
@@ -286,6 +286,17 @@ domain names are in general different. For a detailed discussion
|
|||||||
see the ``hostname(1)`` man page.
|
see the ``hostname(1)`` man page.
|
||||||
|
|
||||||
|
|
||||||
|
export_pmu_events (arm64 only)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Controls the PMU export bit (PMCR_EL0.X), which enables the exporting of
|
||||||
|
events over an IMPLEMENTATION DEFINED PMU event export bus to another device.
|
||||||
|
|
||||||
|
0: disables exporting of events (default).
|
||||||
|
|
||||||
|
1: enables exporting of events.
|
||||||
|
|
||||||
|
|
||||||
firmware_config
|
firmware_config
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
|||||||
@@ -325,6 +325,7 @@ GEN_PMU_FORMAT_ATTR(threshold_compare);
|
|||||||
GEN_PMU_FORMAT_ATTR(threshold);
|
GEN_PMU_FORMAT_ATTR(threshold);
|
||||||
|
|
||||||
static int sysctl_perf_user_access __read_mostly;
|
static int sysctl_perf_user_access __read_mostly;
|
||||||
|
static int sysctl_export_pmu_events __read_mostly;
|
||||||
|
|
||||||
static bool armv8pmu_event_is_64bit(struct perf_event *event)
|
static bool armv8pmu_event_is_64bit(struct perf_event *event)
|
||||||
{
|
{
|
||||||
@@ -1053,6 +1054,17 @@ static int armv8pmu_set_event_filter(struct hw_perf_event *event,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init export_pmu_events(char *str)
|
||||||
|
{
|
||||||
|
/* Enable exporting of pmu events at early bootup with kernel
|
||||||
|
* arguments.
|
||||||
|
*/
|
||||||
|
sysctl_export_pmu_events = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
early_param("export_pmu_events", export_pmu_events);
|
||||||
|
|
||||||
static void armv8pmu_reset(void *info)
|
static void armv8pmu_reset(void *info)
|
||||||
{
|
{
|
||||||
struct arm_pmu *cpu_pmu = (struct arm_pmu *)info;
|
struct arm_pmu *cpu_pmu = (struct arm_pmu *)info;
|
||||||
@@ -1077,6 +1089,9 @@ static void armv8pmu_reset(void *info)
|
|||||||
if (armv8pmu_has_long_event(cpu_pmu))
|
if (armv8pmu_has_long_event(cpu_pmu))
|
||||||
pmcr |= ARMV8_PMU_PMCR_LP;
|
pmcr |= ARMV8_PMU_PMCR_LP;
|
||||||
|
|
||||||
|
if (sysctl_export_pmu_events)
|
||||||
|
pmcr |= ARMV8_PMU_PMCR_X;
|
||||||
|
|
||||||
armv8pmu_pmcr_write(pmcr);
|
armv8pmu_pmcr_write(pmcr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,6 +1295,15 @@ static struct ctl_table armv8_pmu_sysctl_table[] = {
|
|||||||
.extra1 = SYSCTL_ZERO,
|
.extra1 = SYSCTL_ZERO,
|
||||||
.extra2 = SYSCTL_ONE,
|
.extra2 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.procname = "export_pmu_events",
|
||||||
|
.data = &sysctl_export_pmu_events,
|
||||||
|
.maxlen = sizeof(unsigned int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ZERO,
|
||||||
|
.extra2 = SYSCTL_ONE,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void armv8_pmu_register_sysctl_table(void)
|
static void armv8_pmu_register_sysctl_table(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user