On Sat, Nov 04, 2023, Jim Mattson wrote: > On Fri, Nov 3, 2023 at 5:02 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > > > Hide fixed counters for which perf is incapable of creating the associated > > architectural event. Except for the so called pseudo-architectural event > > for counting TSC reference cycle, KVM virtualizes fixed counters by > > creating a perf event for the associated general purpose architectural > > event. If the associated event isn't supported in hardware, KVM can't > > actually virtualize the fixed counter because perf will likely not program > > up the correct event. > > Won't it? My understanding was that perf preferred to use a fixed > counter when there was a choice of fixed or general purpose counter. > Unless the fixed counter is already assigned to a perf_event, KVM's > request should be satisfied by assigning the fixed counter. > > > Note, this issue is almost certainly limited to running KVM on a funky > > virtual CPU model, no known real hardware has an asymmetric PMU where a > > fixed counter is supported but the associated architectural event is not. > > This seems like a fix looking for a problem. Has the "problem" > actually been encountered? Heh, yes, I "encountered" the problem in a curated VM I created. But I completely agree that this is unnecessary, especially since odds are very, very good that requesting the architectural general purpose encoding will still work. E.g. in my goofy setup, the underlying hardware does support the architectural event and so even if perf doesn't use the fixed counter for whatever reason, the GP counter will still count the right event.