[RFC PATCH V2 5/9] perf/x86/intel: Enable large PEBS for monotonic raw

From: kan . liang
Date: Mon Feb 13 2023 - 14:08:21 EST


From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>

The monotonic raw clock is not affected by NTP/PTP correction. The
monotonic raw clock can be calculated from the TSC of each PEBS record
by the same conversion information.

Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
---
arch/x86/events/intel/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index d9be5701e60a..eac389e1f44c 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3776,7 +3776,8 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event)
{
unsigned long flags = x86_pmu.large_pebs_flags;

- if (event->attr.use_clockid)
+ if (event->attr.use_clockid &&
+ !((x86_pmu.intel_cap.pebs_format >= 3) && perf_event_hw_time(event)))
flags &= ~PERF_SAMPLE_TIME;
if (!event->attr.exclude_kernel)
flags &= ~PERF_SAMPLE_REGS_USER;
--
2.35.1