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

From: Ravi Bangoria
Date: Tue Oct 08 2024 - 01:47:06 EST


>> @@ -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.

Thanks,
Ravi