Project

General

Profile

Actions

Bug #500

closed

Add context for perf counters fails

Added by Bernd Hufmann about 11 years ago. Updated over 10 years ago.

Status:
Won't fix
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
04/10/2013
Due date:
% Done:

0%

Estimated time:

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

dmesg (28.3 KB) dmesg Bernd Hufmann, 04/15/2013 07:18 AM
Actions #1

Updated by David Goulet about 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 ?

Actions #2

Updated by Mathieu Desnoyers about 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

Actions #3

Updated by Bernd Hufmann about 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
&lt;not supported&gt; cycles
&lt;not supported&gt; stalled-cycles-frontend
&lt;not supported&gt; stalled-cycles-backend
&lt;not supported&gt; instructions
&lt;not supported&gt; branches
&lt;not supported&gt; branch-misses
Actions #4

Updated by David Goulet about 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.

Actions #5

Updated by Mathieu Desnoyers about 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.

Actions #6

Updated by David Goulet over 10 years ago

  • Status changed from Feedback to Won't fix
Actions

Also available in: Atom PDF