On 5/15/2025 6:51 AM, Sean Christopherson wrote:
> On Mon, Mar 24, 2025, Mingwei Zhang wrote:
>> +{
>> +    if (event->attr.exclude_guest && __this_cpu_read(perf_in_guest)) {
> My vote is for s/perf_in_guest/guest_ctx_loaded, because "perf in guest" 
> doesn't
> accurately describe just the mediated PMU case.  E.g. perf itself is running 
> in
> KVM guests when using an emulated vPMU, or no vPMU at all.

Agree.


>
> And with a Kconfig to guard the mediated PMU, this check (and others) can be
> elided at compile time for architectures that don't support a mediated PMU (or
> if KVM is disabled).
>
>> +            /*
>> +             * (now + times[total].offset) - (now + times[guest].offset) :=
>> +             * times[total].offset - times[guest].offset
>> +             */
>> +            return READ_ONCE(times[T_TOTAL].offset) - 
>> READ_ONCE(times[T_GUEST].offset);
>> +    }
>> +
>> +    return now + READ_ONCE(times[T_TOTAL].offset);
>> +}
>> +

Reply via email to