amd_pmu_brs_sched_task(ctx, sched_in);
}
+static u64 amd_pmu_limit_period(struct perf_event *event, u64 left)
+{
+ /*
+ * Decrease period by the depth of the BRS feature to get the last N
+ * taken branches and approximate the desired period
+ */
+ if (has_branch_stack(event) && left > x86_pmu.lbr_nr)
+ left -= x86_pmu.lbr_nr;
+
+ return left;
+}
+
static __initconst const struct x86_pmu amd_pmu = {
.name = "AMD",
.handle_irq = amd_pmu_handle_irq,
if (boot_cpu_data.x86 >= 0x19 && !amd_brs_init()) {
x86_pmu.get_event_constraints = amd_get_event_constraints_f19h;
x86_pmu.sched_task = amd_pmu_sched_task;
+ x86_pmu.limit_period = amd_pmu_limit_period;
/*
* put_event_constraints callback same as Fam17h, set above
*/
x86_pmu.set_topdown_event_period)
return x86_pmu.set_topdown_event_period(event);
- /*
- * decrease period by the depth of the BRS feature to get
- * the last N taken branches and approximate the desired period
- */
- if (has_branch_stack(event))
- period = amd_brs_adjust_period(period);
-
/*
* If we are way outside a reasonable range then just skip forward:
*/
}
void amd_pmu_brs_sched_task(struct perf_event_context *ctx, bool sched_in);
-
-static inline s64 amd_brs_adjust_period(s64 period)
-{
- if (period > x86_pmu.lbr_nr)
- return period - x86_pmu.lbr_nr;
-
- return period;
-}
#else
static inline int amd_brs_init(void)
{
{
}
-static inline s64 amd_brs_adjust_period(s64 period)
-{
- return period;
-}
-
static inline void amd_brs_enable_all(void)
{
}
static inline void amd_brs_disable_all(void)
{
}
-
-static inline s64 amd_brs_adjust_period(s64 period)
-{
- return period;
-}
#endif /* CONFIG_CPU_SUP_AMD */
static inline int is_pebs_pt(struct perf_event *event)