Re: [PATCH v2 2/3] perf/ibs: Fix interface via core pmu events
From: Ravi Bangoria
Date: Mon Mar 13 2023 - 11:41:29 EST
On 13-Mar-23 7:51 PM, Peter Zijlstra wrote:
> On Mon, Mar 13, 2023 at 05:59:46PM +0530, Ravi Bangoria wrote:
>
>>> Now, we already have a gruesome hack in there, and I'm thikning you
>>> should use that instead of adding yet another one. Note:
>>>
>>> if (ret == -ENOENT && event->attr.type != type && !extended_type) {
>>> type = event->attr.type;
>>> goto again;
>>>
>>> So if you have amd_pmu_hw_config() do:
>>>
>>> event->attr.type = ibs_pmu.type;
>>> return -ENOENT;
>>>
>>> it should all just work no?
>>
>> IBS driver needs to convert RAW pmu config to IBS config, which it does
>> based on original event->attr.type. See perf_ibs_precise_event(). This
>> logic will fail with event->attr.type overwrite.
>
> amd_pmu_hw_config() could also rewrite event->attr.config I suppose.
This might work. Let me try.
>
> I don't think we actually use/expose these event->attr fields again
> after all this, do wel?
I'll confirm this as well.
>
> The closest to that is perf_event_modify_attr(), but that is limited to
> TYPE_BREAKPOINT for the time being (also, could this be used to cure
> your in-kernel IBS usage woes?).
I think doing it transparently at the arch layer would be better.
Thanks,
Ravi