Re: [PATCH 7/8] arm64/perf: Add BRBE driver

From: Anshuman Khandual
Date: Mon Jun 13 2022 - 21:44:26 EST




On 6/13/22 17:46, German Gomez wrote:
> Hi Anshuman, thanks for the update,
>
> As I mentioned offline, I have a perf test that I've been using for the
> branch records and filters. I'll let you know the result using this set.

Sure, thanks !

>
> On 13/06/2022 11:01, Anshuman Khandual wrote:
>> [...]
>>
>> +
>> +static int brbe_fetch_perf_priv(u64 brbinf)
>> +{
>> + int brbe_el = brbe_fetch_el(brbinf);
>> +
>> + switch (brbe_el) {
>> + case BRBINF_EL_EL0:
>> + return PERF_BR_PRIV_USER;
>> + case BRBINF_EL_EL1:
>> + return PERF_BR_PRIV_KERNEL;
>> + case BRBINF_EL_EL2:
>> + if (is_kernel_in_hyp_mode())
>> + return PERF_BR_PRIV_KERNEL;
>> + return PERF_BR_PRIV_HV;
>> + default:
>> + pr_warn("unknown branch privilege captured\n");
>> + return -1;
>
> This looks like it should return PERF_BR_PRIV_UNKNOWN.

Right, return from this function gets into perf branch record's priv
element and '-1' is not something that can be parsed correctly in the
user space tools as the corresponding enum itself starts with 0 i.e
PERF_BR_PRIV_UNKNOWN.

cpuc->brbe_entries[idx].priv = brbe_fetch_perf_priv(brbinf)

Will change the return as PERF_BR_PRIV_UNKNOWN instead.