Re: [Patch v4 07/13] perf/x86: Add constraint for guest perf metrics event

From: Ravi Bangoria
Date: Tue Oct 03 2023 - 02:36:44 EST


On 02-Oct-23 5:59 PM, Peter Zijlstra wrote:
> On Fri, Sep 29, 2023 at 08:50:07PM +0530, Ravi Bangoria wrote:
>> On 29-Sep-23 5:23 PM, Peter Zijlstra wrote:
>
>>> I don't think you need to go that far, host can use PMU just fine as
>>> long as it doesn't overlap with a vCPU. Basically, if you force
>>> perf_attr::exclude_guest on everything your vCPU can haz the full thing.
>
> ^ this..
>
>> How about keying off based on PMU specific KVM module parameter? Something
>> like what Manali has proposed for AMD VIBS? Please see solution 1.1:
>>
>> https://lore.kernel.org/r/3a6c693e-1ef4-6542-bc90-d4468773b97d@xxxxxxx
>
> So I hadn't read that, but isn't that more or less what I proposed
> above?

Yes, it's pretty much same as:

"Like I wrote, all we need to do is ensure vCPU tasks will never have a
perf-event scheduled that covers guest mode. Currently this would be
achievable by having event creation for both:

- CPU events without attr::exclude_guest=1, and
- task events for vCPU task of interest without attr::exclude_guest=1

error with -EBUSY or something."

Thanks,
Ravi