public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: a.p.zijlstra@chello.nl, kgdb-bugreport@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: kgdb segv in the latest tip due to perf ctx changes
Date: Fri, 24 Sep 2010 15:30:58 -0500	[thread overview]
Message-ID: <4C9D0A82.5020406@windriver.com> (raw)
In-Reply-To: <20100924180417.GC1818@jolsa.brq.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 957 bytes --]

Jiri,

Can you try this simple patch which is attached?



On 09/24/2010 01:04 PM, Jiri Olsa wrote:
> while starting kgdb early debug on latest tip tree,
> I got SIGSEGV inside kernel in following location:
>
>   
[clip]
> I found out it's due to foolowing commit, that's causing the init code
> to be called without the ctx field being defined...
>
> commit c3f00c70276d8ae82578c8b773e2db657f69a478
> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Date:   Wed Aug 18 14:37:15 2010 +0200
>
>
>   

I took a look at the tip core, and the ctx parameter is no longer passed
into the perf_event_alloc() from perf_event_create_kernel_counter() kgdb
no longer gets it filled in for free.

The reality is that kgdb never had a true context or a way to mark the
hw breakpoint as a kernel only context for the hw breakpoint
reservations.  The patch is only a short term fix perhaps until on of
the perf guys explains the right way to use it. :-)

Thanks,
Jason.


[-- Attachment #2: 0001-Fix-null-dereference-when-using-early-kgdb.patch --]
[-- Type: text/x-diff, Size: 822 bytes --]

>From 17f3febd001a26aee9a75c61152b60b7e0ae1ea9 Mon Sep 17 00:00:00 2001
From: Jason Wessel <jason.wessel@windriver.com>
Date: Fri, 24 Sep 2010 15:21:11 -0500
Subject: [PATCH] Fix null dereference when using early kgdb

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 kernel/hw_breakpoint.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index 3b714e8..3c7ccdf 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -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) {
-- 
1.6.3.3


  reply	other threads:[~2010-09-24 20:31 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 [this message]
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

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=4C9D0A82.5020406@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=a.p.zijlstra@chello.nl \
    --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