[lkml]   [2012]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v4 12/18] perf: add support for sampling taken branch to perf record
On Tue, Jan 31, 2012 at 4:44 PM, Anshuman Khandual
<> wrote:
> On Tuesday 31 January 2012 04:01 PM, Stephane Eranian wrote:
>>>> +};
>>>> +
>>>> +static int
>>>> +parse_branch_stack(const struct option *opt, const char *str, int unset __used)
>>>> +{
>>>> +#define ONLY_PLM \
>>>> +     (PERF_SAMPLE_BRANCH_USER        |\
>>>> +      PERF_SAMPLE_BRANCH_KERNEL      |\
>>> I guess this would be PERF_SAMPLE_BRANCH_HV instead of the second
>> Oops, yes you're right.
>> There is also something else I realized after the fact that needs to
>> be tweaked about
>> The thing is the X86 code is setup to ignore priv levels it does not
>> know about, it seems.
>> Perf does not set exclude_hv by default. Thus in my patch, if the user
>> does not specify
>> any branch priv level, it will default to the level used for the
>> event. That is fine but in the
>> x86 code, I added a sanity check to reject BRANCH_HV because the HW
>> does not support
>> it.
> Right. So either we
> (1) Set 'exclude_hv' on a X86 system without hypervisor mode (and required HW support) and do the sanity check for BRANCH_HV
> or
> (2) Do not set 'exclude_hv' (which is happening right now by default) and remove the sanity check
>>I think it should just ignore it. That way, one can do:
>>     $ perf record -b any_call -e cycles ls
>> without getting an error (because hv is not supported on branch sampling).
>> Currently, the workaround is to set the priv level on branches:
>>     $ perf record -b any_call,u,k -e cycles ls
> --------------------------------
> ./perf record -b any_call -e cycles ls
> ./perf record -b any_call,hv -e cycles ls
>  Error: sys_perf_event_open() syscall returned with 95 (Operation not supported).  /bin/dmesg may provide additional information.
>  Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
> ls: Terminated
> --------------------------------
> However these works absolutely fine
> perf record -b any_call,k -e cycles ls
> perf record -b any_call,u -e cycles ls
> perf record -b any_call,u,k -e cycles ls

Yes, because you only get the problem with the kernel has to figure out the
default priv level for the branches.

I want to make this simplest case work:
/perf record -b any_call -e cycles ls

For now, I have reworked the patchset, to ignore hv in the x86 lbr code.
That's the simplest.

> --
> Anshuman Khandual
> Linux Technology Centre
> IBM Systems and Technology Group
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2012-01-31 16:51    [W:0.042 / U:5.492 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site