From: Peter Zijlstra <peterz@infradead.org>
To: "Ronny Tschüter" <Ronny.Tschueter@tu-dresden.de>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: BUG: sched:sched_migrate_task event tracing returns incorrect events
Date: Thu, 10 Jun 2010 17:11:41 +0200 [thread overview]
Message-ID: <1276182701.2077.462.camel@twins> (raw)
In-Reply-To: <4C10FD1C.7080200@tu-dresden.de>
On Thu, 2010-06-10 at 16:56 +0200, Ronny Tschüter wrote:
> Hi,
>
> I want to know a little bit more about the execution of my program.
> Especially I'm interested in cpu migrations of my process. Therefore I
> use the Linux performance counter infrastructure, set appropriate
> perf_event attributes and setup the sched:sched_migrate_task event with
> a system call:
> ...
> attr.type = PERF_TYPE_TRACEPOINT;
> attr.size = sizeof( struct perf_event_attr );
> attr.config = event_id; // id of sched:sched_migrate_task event
> attr.sample_type = PERF_SAMPLE_TIME|PERF_SAMPLE_CPU|PERF_SAMPLE_RAW;
> attr.freq = 0;
> attr.sample_freq = 1;
> fd = syscall( __NR_perf_counter_open, &attr, getpid(), -1, -1, 0 );
> ...
> Finally to read the events I map the kernel event buffer via mmap and
> process every event in this buffer. However I run into two problems:
>
> (1) I need root privileges to open the counter successfully. Without
> root privileges syscall returns -1. I think that is not OK because users
> should be allowed to create per task counters.
It is, because you specify PERF_SAMPLE_RAW, which is considered a data
leak for unpriv users.
> (2) The buffer contains events that aren't caused by my process (i.e.
> the COMM field does not contain the name of my process and the PID field
> is not equal to the pid of my process).
I think that could happen if the migration happens from interrupt
context while your task is running. Also wakeups your process does can
result in migrations of the woken task from the context of your task.
next prev parent reply other threads:[~2010-06-10 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 14:56 Ronny Tschüter
2010-06-10 15:11 ` Peter Zijlstra [this message]
2010-06-14 7:44 ` Ronny Tschüter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1276182701.2077.462.camel@twins \
--to=peterz@infradead.org \
--cc=Ronny.Tschueter@tu-dresden.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome