RE: [PATCH 2/3] perf/x86/mbm: Fix mbm counting for RMID reuse

From: Luck, Tony
Date: Tue May 10 2016 - 12:39:45 EST


>> (3) Also we may not want to count at every sched_in and sched_out
>> because the MSR reads involve quite a bit of overhead.
>
> Every single other PMU driver just does this; why are you special?

They just have to read a register. We have to write the IA32_EM_EVT_SEL MSR
and then read from the IA32_QM_CTR MSR ... if we are tracking both local
and total bandwidth, we have to do repeat and wrmr/rdmsr again to get the
other counter. That seems like it will noticeably affect the system if we do it
on every sched_in and sched_out.

But the more we make this complicated, the more I think that we should not
go through the pain of stealing/recycling RMIDs and just limit the number of
things that can be simultaneously monitored. If someone tries to monitor one
more thing when all the RMIDs are in use, we should just error out with
-ERUNOUTOFRMIDSTRYAGAINLATER (maybe -EAGAIN???)

-Tony