Re: [PATCH 6/8] perf/amd/ibs: Add pmu specific minimum period

From: Namhyung Kim
Date: Wed Oct 09 2024 - 02:33:03 EST


On Tue, Oct 08, 2024 at 11:16:43AM +0530, Ravi Bangoria wrote:
> >> @@ -295,10 +296,14 @@ static int perf_ibs_init(struct perf_event *event)
> >> /* raw max_cnt may not be set */
> >> return -EINVAL;
> >>
> >> - /* Silently mask off lower nibble. IBS hw mandates it. */
> >> - hwc->sample_period &= ~0x0FULL;
> >> - if (!hwc->sample_period)
> >> - hwc->sample_period = 0x10;
> >> + if (event->attr.freq) {
> >> + hwc->sample_period = perf_ibs->min_period;
> >> + } else {
> >> + /* Silently mask off lower nibble. IBS hw mandates it. */
> >> + hwc->sample_period &= ~0x0FULL;
> >> + if (hwc->sample_period < perf_ibs->min_period)
> >> + return -EINVAL;
> >
> > Maybe it needs to check perf_ibs->max_period as well.
>
> We do allow event with sample_period > pmu->max_period and handle it with
> "period_left" logic.

Oh, ok then.

Thanks,
Namhyung