Re: [PATCH 5/8] perf/amd/ibs: Don't allow freq mode event creation through ->config interface
From: Ravi Bangoria
Date: Tue Oct 08 2024 - 01:31:00 EST
>> Don't allow freq mode event creation through perf_event_attr->config
>> interface.
>
> Sounds reasonable. I agree the freq mode should use the standard
> interface using attr->sample_freq. But I'm not sure if the behaivor is
> defined when attr->freq is set and attr->sample_freq is 0. Maybe this
> should be handled in the generic code.
I also could not find any reason to allow {freq=1, sample_freq=0}, but:
1) perf_event_open() allows it.
2) ioctl(PERF_EVENT_IOC_PERIOD) allows it.
3) all generic code explicitly checks for ->sample_freq != 0 wherever
->freq == 1.
I will prepare and post a patch to reject such event and see if there
are any objections.
Thanks,
Ravi