From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Stephane Eranian <eranian@google.com>,
linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
davem@davemloft.net, perfmon2-devel@lists.sf.net,
eranian@gmail.com
Subject: Re: [PATCH] perf_events: improve x86 event scheduling (v5)
Date: Tue, 19 Jan 2010 14:24:49 +0100 [thread overview]
Message-ID: <1263907489.4283.663.camel@laptop> (raw)
In-Reply-To: <1263903773.4283.657.camel@laptop>
On Tue, 2010-01-19 at 13:22 +0100, Peter Zijlstra wrote:
> On Mon, 2010-01-18 at 18:29 +0100, Frederic Weisbecker wrote:
>
> > It has constraints that only need to be checked when we register
> > the event. It has also constraint on enable time but nothing
> > tricky that requires an overwritten group scheduling.
>
> The fact that ->enable() can fail makes it a hardware counter. Software
> counters cannot fail enable.
>
> Having multiple groups of failable events (multiple hardware pmus) can
> go wrong with the current core in interesting ways, look for example at
> __perf_event_sched_in():
>
> It does:
>
> int can_add_hw = 1;
>
> ...
>
> list_for_each_entry(event, &ctx->flexible_groups, group_entry) {
> /* Ignore events in OFF or ERROR state */
> if (event->state <= PERF_EVENT_STATE_OFF)
> continue;
> /*
> * Listen to the 'cpu' scheduling filter constraint
> * of events:
> */
> if (event->cpu != -1 && event->cpu != cpu)
> continue;
>
> if (group_can_go_on(event, cpuctx, can_add_hw))
> if (group_sched_in(event, cpuctx, ctx, cpu))
> can_add_hw = 0;
> }
>
> Now, if you look at that logic you'll see that it assumes there's one hw
> device since it only has one can_add_hw state. So if your hw_breakpoint
> pmu starts to fail we'll also stop adding counters to the cpu pmu (for
> lack of a better name) and vs.
>
> This might be fixable by using per-cpu struct pmu variables.
>
> I'm going to try and move all the weak hw_perf_* functions into struct
> pmu and create a notifier like callchain for them so we can have proper
> per pmu state, and then use that to fix these things up.
>
> However I'm afraid its far to late to push any of that into .33, which
> means .33 will have rather funny behaviour once the breakpoints start
> getting used.
Hrmph, so I read some of that hw_breakpoint stuff, and now I'm sorta
confused, it looks like ->enable should never fail, but that means you
cannot overcommit breakpoints, which doesn't fit the perf model nicely.
Also, I see you set an ->unthrottle, but then don't implement it, but
comment it as todo, which is strange because that implies its broken. If
there's an ->unthrottle method it will throttle, so if its todo, the
safest thing is to not set it.
/me mutters something and goes look at something else for a while.
next prev parent reply other threads:[~2010-01-19 13:25 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-18 8:58 [PATCH] perf_events: improve x86 event scheduling (v5) Stephane Eranian
2010-01-18 13:43 ` Frederic Weisbecker
2010-01-18 13:54 ` Peter Zijlstra
2010-01-18 14:12 ` Stephane Eranian
2010-01-18 14:20 ` Peter Zijlstra
2010-01-18 14:33 ` Peter Zijlstra
2010-01-18 14:20 ` Frederic Weisbecker
2010-01-18 14:32 ` Peter Zijlstra
2010-01-18 14:45 ` Frederic Weisbecker
2010-01-18 14:56 ` Peter Zijlstra
2010-01-18 16:18 ` Frederic Weisbecker
2010-01-18 16:26 ` Peter Zijlstra
2010-01-18 16:51 ` Frederic Weisbecker
2010-01-18 17:13 ` Peter Zijlstra
2010-01-18 17:29 ` Frederic Weisbecker
2010-01-18 20:01 ` Peter Zijlstra
2010-01-19 12:22 ` Peter Zijlstra
2010-01-19 13:24 ` Peter Zijlstra [this message]
2010-01-19 15:55 ` Frederic Weisbecker
2010-01-19 16:25 ` Peter Zijlstra
2010-02-27 17:38 ` Frederic Weisbecker
2010-01-19 15:40 ` Frederic Weisbecker
2010-01-21 10:08 ` Stephane Eranian
2010-01-21 10:11 ` Peter Zijlstra
2010-01-21 10:21 ` Stephane Eranian
2010-01-21 10:28 ` Peter Zijlstra
2010-01-21 10:38 ` Stephane Eranian
2010-01-21 10:45 ` Frederic Weisbecker
2010-01-21 11:44 ` Stephane Eranian
2010-01-21 12:02 ` Frederic Weisbecker
2010-01-18 14:37 ` Peter Zijlstra
2010-01-18 14:53 ` Frederic Weisbecker
2010-01-18 14:59 ` Peter Zijlstra
2010-01-18 16:22 ` Frederic Weisbecker
2010-01-21 10:36 ` Peter Zijlstra
2010-01-21 10:43 ` Stephane Eranian
2010-01-21 10:46 ` Peter Zijlstra
2010-01-21 14:06 ` Stephane Eranian
2010-01-21 13:55 ` [tip:perf/urgent] perf: x86: Add support for the ANY bit tip-bot for Stephane Eranian
2010-01-29 9:26 ` [tip:perf/core] perf_events, x86: Improve x86 event scheduling tip-bot for Stephane Eranian
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=1263907489.4283.663.camel@laptop \
--to=peterz@infradead.org \
--cc=davem@davemloft.net \
--cc=eranian@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
/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