Re: [GIT PULL 0/8] perf/pt -> Intel PT/BTS

Adrian Hunter
2015-07-01T12:49:54Z

On 01/07/15 11:19, Adrian Hunter wrote:
> On 30/06/15 16:23, Adrian Hunter wrote:
>> On 30/06/15 13:56, Ingo Molnar wrote:
>>>
>>> * Adrian Hunter <adrian.hunter@intel.com> wrote:
>>>
>>>>> Yeah, so I did a 'newbie test':
>>>>>
>>>>> I pulled the tree and saw that it has a tools/perf/Documentation/intel-bts.txt
>>>>> file and started reading it.
>>>>>
>>>>> Based on its text:
>>>>>
>>>>> The Intel BTS kernel driver creates a new PMU for Intel BTS. The perf record
>>>>> option is:
>>>>>
>>>>> -e intel_bts//
>>>>>
>>>>> Currently Intel BTS is limited to per-thread tracing so the --per-thread option
>>>>> is also needed.
>>>>>
>>>>> I tried the following command which failed:
>>>>>
>>>>> triton:~/tip> perf record -e intel_bts// --per-thread sleep 1
>>>>> invalid or unsupported event: 'intel_bts//'
>>>>> Run 'perf list' for a list of valid events
>>>>>
>>>>> usage: perf record [<options>] [<command>]
>>>>> or: perf record [<options>] -- <command> [<options>]
>>>>>
>>>>> -e, --event <event> event selector. use 'perf list' to list available events
>>>>>
>>>>> That's a really ... unhelpful message. If I typoed something I want to know that.
>>>>> If the kernel does not support something, I want to know about that too. Tooling
>>>>> telling me: "maybe you typoed something, maybe it's not supported, I really don't
>>>>> care" is not very productive.
>>>>
>>>> That is not entirely true. The message says "Run 'perf list' for a list of valid
>>>> events" which will tell you if the event is valid. So you can tell the
>>>> difference between a typo and unsupported event.
>>>
>>> Yeah, but my point is: why doesn't the tool do this disambiguation for me? Tools
>>> are hard enough to use as-is already, no need to put artificial roadblocks in the
>>> path of first time users.
>>
>> That applies to all events e.g.
>>
>> # perf record -e sched:sched_swotch sleep 1
>> invalid or unsupported event: 'sched:sched_swotch'
>> Run 'perf list' for a list of valid events
>>
>> usage: perf record [<options>] [<command>]
>> or: perf record [<options>] -- <command> [<options>]
>>
>> -e, --event <event> event selector. use 'perf list' to list available events
>>
>> So it is a general problem.
>>
>>>
>>>>> So this was with a distro kernel, and in the hope that I'm missing some magic
>>>>> new kernel feature, I tried it the latest -tip kernel, but it still gives me
>>>>> the same failure.
>>>>>
>>>>> So the test newbie user got stuck after wasting some time.
>>>>>
>>>>> Me as a kernel developer could probably figure it out, but that's not the
>>>>> point: if newbies cannot discover and use our new features then it's as if
>>>>> they didn't exist, and I'm not pulling non-existent features! ;-)
>>>>>
>>>>> Could we please improve all this?
>>>>
>>>> 'perf list' shows the event wasn't supported, so I am not sure what more the
>>>> "newbie" could expect. Do you have any suggestions?
>>>
>>> So I think a first time user would expect a clear message from the computer: what
>>> was wrong with what he wrote and what should he do to fix it.
>>>
>>> Btw., here's the 'perf list' output from a system running the latest -tip kernel:
>>>
>>> vega:~> uname -a
>>> Linux vega 4.1.0-02935-g390ad45394a3-dirty #567 SMP PREEMPT Mon Jun 29 11:44:48 CEST 2015 x86_64 x86_64 x86_64 GNU/Linux
>>> vega:~> perf list | grep -i bts
>>> vega:~>
>>>
>>> so is there any kernel feature dependency? It's unclear. If yes, it should be
>>> mentioned in the document, and in the tooling output as well. If not then we have
>>> a bug somewhere.
>>
>> I am not aware of any dependencies, apart from perf events itself.
>>
>> Are you sure you compiled perf tools with the new patches ;-)
>> And it is an Intel CPU?
>>

I am going to need to know what hardware it is and cpu feature flags i.e.
/proc/cpuinfo

Also ls /sys/bus/event_source/devices