From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 02/10] perf, trace: Use per-tracepoint-per-cpu hlist to track events
Date: Fri, 21 May 2010 12:13:48 +0200 [thread overview]
Message-ID: <20100521101347.GC30108@nowhere> (raw)
In-Reply-To: <1274436125.1674.1690.camel@laptop>
On Fri, May 21, 2010 at 12:02:05PM +0200, Peter Zijlstra wrote:
> On Fri, 2010-05-21 at 11:40 +0200, Frederic Weisbecker wrote:
> > On Fri, May 21, 2010 at 11:02:03AM +0200, Peter Zijlstra wrote:
>
> > > Also, avoid conditionals on the fast path by ordering with probe unregister
> > > so that we should never get on the callback path without the data being there.
> > >
> > \
> > > + head = per_cpu_ptr(event_call->perf_events, smp_processor_id());\
>
> > Should be rcu_dereference_sched ?
>
> No, I removed all that rcu stuff and synchronized against the probe
> unregister.
>
> I assumed that after probe unregister a tracepoint callback doesn't
> happen, which then guarantees we should never get !head.
I'm not sure about this. The tracepoints are called under rcu_read_lock(),
but there is not synchronize_rcu() after we unregister a tracepoint, which
means you can have a pending preempted one somewhere.
There is a call_rcu that removes the callbacks, but that only protect
the callback themselves.
>
> > > + for_each_possible_cpu(cpu)
> > > + INIT_HLIST_HEAD(per_cpu_ptr(list, cpu));
> > > +
> > > + tp_event->perf_events = list;
> >
> >
> >
> > I suspect this must be rcu_assign_pointer.
>
> Same thing as above, I do this before probe register, so I see no need
> for RCU.
>
> > > + list = per_cpu_ptr(list, smp_processor_id());
> > > + hlist_add_head_rcu(&p_event->hlist_entry, list);
> >
> >
> >
> > Ah and may be small comment, because using the hlist api here
> > may puzzle more people than just me ;)
>
> What exactly is the puzzlement about?
The fact we use the hlist API not for hlist purpose but for a list.
> > > + if (--tp_event->perf_refcount > 0)
> > > + return;
> > > +
> > > + tp_event->perf_event_disable(tp_event);
> >
> >
> >
> > Don't we need a rcu_synchronize_sched() here?
>
> Doesn't probe unregister synchronize things against its own callback?
May be I missed it but it doesn't seem so.
> > > + raw_data = per_cpu_ptr(perf_trace_buf[*rctxp], smp_processor_id());
> >
> >
> >
> > Needs rcu_dereference_sched too. And this could be __this_cpu_var()
>
> Ahh! so that is what its called.
:)
> > > + preempt_disable_notrace();
> >
> >
> > Why is this needed. We have the recursion context protection already.
>
> Because:
>
> @@ -4094,7 +4087,7 @@ end:
>
> int perf_swevent_get_recursion_context(void)
> {
> - struct perf_cpu_context *cpuctx = &get_cpu_var(perf_cpu_context);
> + struct perf_cpu_context *cpuctx = &__get_cpu_var(perf_cpu_context);
> int rctx;
>
> if (in_nmi())
>
Right.
Thanks.
next prev parent reply other threads:[~2010-05-21 10:13 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 9:02 [PATCH 00/10] perf tracepoint and output optimizations Peter Zijlstra
2010-05-21 9:02 ` [PATCH 01/10] perf, trace: Remove IRQ-disable from perf/tracepoint interaction Peter Zijlstra
2010-05-21 17:43 ` Frank Ch. Eigler
2010-05-21 17:53 ` Steven Rostedt
2010-05-21 18:07 ` Frank Ch. Eigler
2010-05-23 12:11 ` Paul Mackerras
2010-05-23 18:16 ` Peter Zijlstra
2010-05-24 4:29 ` Paul Mackerras
2010-05-25 8:06 ` [tip:perf/core] perf, trace: Fix IRQ-disable removal " tip-bot for Peter Zijlstra
2010-05-25 9:02 ` Peter Zijlstra
2010-05-25 9:30 ` [tip:perf/core] perf, trace: Fix !x86 build bug tip-bot for Peter Zijlstra
2010-05-24 11:31 ` [PATCH 01/10] perf, trace: Remove IRQ-disable from perf/tracepoint interaction Frederic Weisbecker
2010-05-25 7:30 ` [PATCH 01a/10] perf, trace: Fix !x86 build issue Peter Zijlstra
2010-05-21 9:02 ` [PATCH 02/10] perf, trace: Use per-tracepoint-per-cpu hlist to track events Peter Zijlstra
2010-05-21 9:40 ` Frederic Weisbecker
2010-05-21 10:02 ` Peter Zijlstra
2010-05-21 10:13 ` Frederic Weisbecker [this message]
2010-05-21 10:15 ` Peter Zijlstra
2010-05-21 10:19 ` Frederic Weisbecker
2010-05-21 10:38 ` Ingo Molnar
2010-05-21 10:51 ` Ingo Molnar
2010-05-21 10:19 ` Peter Zijlstra
2010-05-21 10:21 ` Frederic Weisbecker
2010-05-21 10:34 ` Peter Zijlstra
2010-05-21 10:38 ` Frederic Weisbecker
2010-05-21 10:41 ` [PATCH 02b/10] perf, trace: Fix probe unregister race Peter Zijlstra
2010-05-21 10:43 ` Frederic Weisbecker
2010-05-31 7:19 ` [tip:perf/urgent] perf_events, " tip-bot for Peter Zijlstra
2010-05-21 11:28 ` [tip:perf/core] perf, trace: Optimize tracepoints by using per-tracepoint-per-cpu hlist to track events tip-bot for Peter Zijlstra
2010-05-21 14:04 ` [PATCH 02/10] perf, trace: Use " Steven Rostedt
2010-05-21 14:18 ` Peter Zijlstra
2010-05-21 14:25 ` Peter Zijlstra
2010-05-31 7:20 ` [tip:perf/urgent] perf_events, trace: Fix perf_trace_destroy(), mutex went missing tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 03/10] perf: Ensure IOC_OUTPUT isnt used to create multi-writer buffers Peter Zijlstra
2010-05-21 11:28 ` [tip:perf/core] perf: Ensure that IOC_OUTPUT isn't " tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 04/10] perf-record: Remove -M Peter Zijlstra
2010-05-21 11:28 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 05/10] perf-record: Share per-cpu buffers Peter Zijlstra
2010-05-21 9:44 ` Frederic Weisbecker
2010-05-21 10:03 ` Peter Zijlstra
2010-05-21 11:29 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 06/10] perf: Fix wakeup storm for RO mmap()s Peter Zijlstra
2010-05-21 11:29 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 07/10] perf: Optimize perf_output_copy Peter Zijlstra
2010-05-21 11:29 ` [tip:perf/core] perf: Optimize perf_output_copy() tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 08/10] perf: Optimize the !vmalloc backed buffer Peter Zijlstra
2010-05-21 11:29 ` [tip:perf/core] " tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 09/10] perf: Remove more fastpath code Peter Zijlstra
2010-05-21 11:15 ` Steven Rostedt
2010-05-21 11:18 ` Peter Zijlstra
2010-05-21 11:30 ` [tip:perf/core] perf: Remove more code from the fastpath tip-bot for Peter Zijlstra
2010-05-21 9:02 ` [PATCH 10/10] perf: Optimize perf_tp_event_match Peter Zijlstra
2010-05-21 11:30 ` [tip:perf/core] perf: Optimize perf_tp_event_match() tip-bot for Peter Zijlstra
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=20100521101347.GC30108@nowhere \
--to=fweisbec@gmail.com \
--cc=acme@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/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.