From: Peter Zijlstra <peterz@infradead.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jason Wessel <jason.wessel@windriver.com>,
Jiri Olsa <jolsa@redhat.com>,
kgdb-bugreport@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: kgdb segv in the latest tip due to perf ctx changes
Date: Thu, 30 Sep 2010 13:42:01 +0200 [thread overview]
Message-ID: <1285846921.2144.19.camel@laptop> (raw)
In-Reply-To: <20100925135532.GA5349@nowhere>
On Sat, 2010-09-25 at 15:55 +0200, Frederic Weisbecker wrote:
> > Frederic, anything we can do about that?
>
>
>
> Jason's patch is partially good, it just lacks one place to handle.
> Jiri, can you test that?
>
> diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
> index d71a987..d727c58 100644
> --- a/kernel/hw_breakpoint.c
> +++ b/kernel/hw_breakpoint.c
> @@ -134,7 +134,7 @@ fetch_bp_busy_slots(struct bp_busy_slots *slots, struct perf_event *bp,
> enum bp_type_idx type)
> {
> int cpu = bp->cpu;
> - struct task_struct *tsk = bp->ctx->task;
> + struct task_struct *tsk = bp->ctx ? bp->ctx->task : NULL;
>
> if (cpu >= 0) {
> slots->pinned = per_cpu(nr_cpu_bp_pinned[type], cpu);
> @@ -213,7 +213,7 @@ toggle_bp_slot(struct perf_event *bp, bool enable, enum bp_type_idx type,
> int weight)
> {
> int cpu = bp->cpu;
> - struct task_struct *tsk = bp->ctx->task;
> + struct task_struct *tsk = bp->ctx ? bp->ctx->task : NULL;
>
> /* Pinned counter cpu profiling */
> if (!tsk) {
That's identical to writing *tsk = NULL;
You seem to be missing the detail that perf_event->ctx will _always_ be
NULL during pmu::event_init()
> > That'll probably screw over some accounting, not sure what tsk is used
> > for there.
>
>
> Nope it's ok. tsk is used to know if we are dealing with
> a task/cpu bound breakpoint or a cpu wide bound one.
>
> If tsk ends up being NULL, it will think it's a cpu wide bound
> breakpoint, which it is in the case of kgdb breakpoints.
See above, there's currently no way to know that in pmu::event_init().
prev parent reply other threads:[~2010-09-30 11:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 18:04 kgdb segv in the latest tip due to perf ctx changes Jiri Olsa
2010-09-24 20:30 ` Jason Wessel
2010-09-25 0:29 ` Peter Zijlstra
2010-09-25 13:55 ` Frederic Weisbecker
2010-09-27 8:12 ` Jiri Olsa
2010-09-27 15:47 ` Frederic Weisbecker
2010-09-30 11:42 ` Peter Zijlstra
2010-09-30 11:42 ` Peter Zijlstra [this message]
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=1285846921.2144.19.camel@laptop \
--to=peterz@infradead.org \
--cc=fweisbec@gmail.com \
--cc=jason.wessel@windriver.com \
--cc=jolsa@redhat.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox