All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Anton Arapov <anton@redhat.com>, Frank Eigler <fche@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>, Josh Stone <jistone@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	"Suzuki K. Poulose" <suzuki@in.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/1] (Was uprobes/perf: pre-filtering)
Date: Wed, 6 Feb 2013 20:42:18 +0100	[thread overview]
Message-ID: <20130206194218.GA11998@redhat.com> (raw)
In-Reply-To: <20130206181044.GA3752@redhat.com>

On 02/06, Oleg Nesterov wrote:
>
> Btw, during the testing I noticed a minor problem (or problems) in tools/perf/,
> I'll try to investigate...

To avoid the confusion, this has nothing to do with perf/uprobe/prefiltering
changes.



Well. I am very new to this code, and I didn't even use perf before,
it is quite possible I missed something/everything.

But I simply can't understand the logic behind perf_evlist__create_maps/etc.

OK, builtin-record.c:record sets .target->uses_mmap == T, this is correct,
we are going to use perf_mmap().

But why do we need it? It is for perf_evlist__create_maps() to ensure we
do not use cpu_map__dummy_new().

But. Even if we use perf_mmap(), "event->cpu == -1 && !event->attr.inherit"
is fine. And indeed, "perf record -e whatever -p1" creates a single counter
with "cpu = -1" and this works. Because, damn, perf_evlist__config_attrs()
notices "evlist->cpus->map[0] < 0" and sets "opts->no_inherit = true".

But at the same time, this does not allow to do, say,
"perf record -e whatever -C0 -p1". -C0 is simply ignored because when
perf_evlist__create_maps() is called perf_target__has_task() == T due to "-p1".

Not to mention, there is no way to trace init and the children it will
fork...

And otoh. "perf record -e whatever -i true" creates a counter for each
cpu due to ->uses_mmap. This is suboptimal, but of course the hack like

	--- a/tools/perf/builtin-record.c
	+++ b/tools/perf/builtin-record.c
	@@ -1081,6 +1078,8 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
		if (!argc && perf_target__none(&rec->opts.target))
			usage_with_options(record_usage, record_options);
	 
	+	rec->opts.target.uses_mmap = !rec->opts.no_inherit;
	+
		if (rec->force && rec->append_file) {
			ui__error("Can't overwrite and append at the same time."
				  " You need to choose between -f and -A");

should not be even discussed.

And why opts->target.system_wide is only set by OPT_BOOLEAN("all-cpus") ?
I meant, why I can't do "perf record -e whatever -C0" to create a "global"
counter on CPU_0? This doesn't work because __cmd_record() sees !.system_wide
and assumes we need perf_event__synthesize_thread_map() which silently fail.

So I am sending a single patch to fix the problem which complicated my
testing. It is trivial but I am not sure it correct, please review.

Oleg.


  reply	other threads:[~2013-02-06 19:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 19:02 [PATCH 0/7] uprobes/perf: pre-filtering Oleg Nesterov
2013-02-04 19:02 ` [PATCH 1/7] perf: Ensure we do not free event->parent before event Oleg Nesterov
2013-03-20 13:35   ` Jiri Olsa
2013-02-04 19:02 ` [PATCH 2/7] perf: Introduce hw_perf_event->tp_target and ->tp_list Oleg Nesterov
2013-02-11  9:44   ` Srikar Dronamraju
2013-02-04 19:02 ` [PATCH 3/7] uprobes: Introduce uprobe_apply() Oleg Nesterov
2013-02-11  9:43   ` Srikar Dronamraju
2013-02-04 19:02 ` [PATCH 4/7] uprobes/perf: Teach trace_uprobe/perf code to track the active perf_event's Oleg Nesterov
2013-02-11  9:45   ` Srikar Dronamraju
2013-02-04 19:02 ` [PATCH 5/7] uprobes/perf: Teach trace_uprobe/perf code to pre-filter Oleg Nesterov
2013-02-11  9:46   ` Srikar Dronamraju
2013-02-04 19:03 ` [PATCH 6/7] uprobes/perf: Teach trace_uprobe/perf code to use UPROBE_HANDLER_REMOVE Oleg Nesterov
2013-02-11  9:54   ` Srikar Dronamraju
2013-02-04 19:03 ` [PATCH 7/7] uprobes/perf: Avoid uprobe_apply() whenever possible Oleg Nesterov
2013-02-11  9:55   ` Srikar Dronamraju
2013-02-06 18:10 ` [PATCH 0/7] uprobes/perf: pre-filtering Oleg Nesterov
2013-02-06 19:42   ` Oleg Nesterov [this message]
2013-02-06 19:42     ` [PATCH 1/1] perf/tools: Fix "perf record -C... workload" behaviour Oleg Nesterov
2013-02-25  9:58       ` Jiri Olsa
2013-02-07  6:01     ` [PATCH 0/1] (Was uprobes/perf: pre-filtering) Namhyung Kim
2013-02-07 15:22       ` Oleg Nesterov

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=20130206194218.GA11998@redhat.com \
    --to=oleg@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=anton@redhat.com \
    --cc=fche@redhat.com \
    --cc=jistone@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=suzuki@in.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.