Following your suggestions, I have modified PAPI to no longer use pfm_find_event(). This has eliminated the problems I was seeing when trying to use PFM_OS_PERF_EVENT_EXT through the PAPI API. I have also restructured PAPI to separate the code paths used
when listing events and when counting events. This has simplified both of these code paths quite a bit. Currently I only have this new code working in the perf_events component but I plan to also put the same modifications into the perf_events_uncore component.
While doing this work I found that PAPI needed two functions which exist in libpfm4 but were declared as static so they were not available to PAPI. The functions are idx2pmu and pfmlib_idx2pidx.
The attached patch file modifies libpfm4 to make these two functions externally visible so that PAPI can use them.
Would be willing to commit this change to libpfm4 or should I replicate the source for these two functions in PAPI ?
If you would prefer to provide functions by different names which do the same thing, that would be fine with me (the existing names are not really the kind of name I would expect to find in a libraries API).
Let me know how you would like to handle this.