Bug #500
closedAdd context for perf counters fails
0%
Description
I cannot add contexts for perf counters using lttng-tools v2.1.1 (or v2.2-rc1). I get the error below. When using lttng-tools 2.0.5 (on a different computer) it works.
lttng create mySession
Session mySession created.
Traces will be written in /home/bernd/lttng-traces/mySession-20130319-145021
lttng enable-event -a -k
All kernel events are enabled in channel channel0
lttng add-context -k -t perf:branch-misses -t perf:cache-misses
PERROR: add context ioctl: Invalid argument [in kernel_add_channel_context() at kernel.c:47]
Error: perf:cache-misses: Add kernel context failed
PERROR: add context ioctl: Invalid argument [in kernel_add_channel_context() at kernel.c:47]
Error: perf:branch-misses: Add kernel context failed
Warning: Some command(s) went wrong
-----------------------------------------------------------------------
My setup is:
Ubuntu 12.04 with kernel 3.2.0-38
lttng-modules v2.1.1
lttng-tools v2.1.1
Files
Updated by David Goulet over 11 years ago
- Status changed from New to Feedback
This works with the current HEAD of master.
Is this a problem of 2.1-stable HEAD or you've try this on 2.2-rc1 ?
Updated by Mathieu Desnoyers over 11 years ago
We need the dmesg output from the user.
Is the problem seen when running Linux as guest OS under a virtual
machine ?
There are such cases where the perf counters are not available.
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Updated by Bernd Hufmann over 11 years ago
- Yes, it happens with 2.2-rc1
- Yes, I'm running on Linux as guest OS under a virtual machine (Virtualbox).
- Please find attached the dmesg output.
- I have perf installed and I ran the command below. I noticed that some counters are not supported (e.g. cycles). I tried add-context for page-fault and the command was successful. When trying it with cycles it fails. Hmm, maybe it is related to the VM. If it is related to the VM, maybe it would be good to give a better error message in lttng when adding a context, for example "<counter> not supported".
BTW, I don't have native Linux machine to confirm that it works there.
perf stat -B dd if=/dev/zero of=/dev/null count=10000
10000+0 records in
10000+0 records out
5120000 bytes (5.1 MB) copied, 3.81099 s, 1.3 MB/s
Performance counter stats for 'dd if=/dev/zero of=/dev/null count=10000':
1202.052949 task-clock # 0.306 CPUs utilized
173 context-switches # 0.000 M/sec
0 CPU-migrations # 0.000 M/sec
227 page-faults # 0.000 M/sec
<not supported> cycles
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
<not supported> instructions
<not supported> branches
<not supported> branch-misses
Updated by David Goulet over 11 years ago
Hmmm the VM would explain that. Unfortunately, the tracer returns EINVAL making it difficult to provide a more meaningful error message.
It would be easier if lttng-modules could return a specific error like ENOENT if the context is not supported for instance.
Updated by Mathieu Desnoyers over 11 years ago
We could probably return the error from perf return code, but inspecting perf code leads me to think that it would return EINVAL in this case anyway, so we would not really have more meaningful info.
Bottom line: the precision of our error message is limited by perf.
Updated by David Goulet over 11 years ago
- Status changed from Feedback to Won't fix