public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dipankar Sarma <dipankar@in.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Prasanna Panchamukhi <prasanna@in.ibm.com>
Subject: [PATCH] 2.6.17-rt1 : fix x86_64 oops
Date: Wed, 28 Jun 2006 23:51:37 +0530	[thread overview]
Message-ID: <20060628182137.GA23979@in.ibm.com> (raw)
In-Reply-To: <20060627200105.GA13966@in.ibm.com>

On Wed, Jun 28, 2006 at 01:31:05AM +0530, Dipankar Sarma wrote:
> I used the attached patch below to work around the already known
> compilation problem and a bunch of warnings in slab.c. In my
> 4-way x86_64 box, I get a few oops and then the machine panics.
> 
> Starting udevd
> Creating devices
> BUG: scheduling while atomic: udevd/0x00000001/1875
> BUG: scheduling while atomic: swapper/0x00000001/0
> 
> Call Trace:
>        <ffffffff804fcd76>{__schedule+158}
>        <ffffffff804ffcdf>{_raw_spin_unlock_irqrestore+48}
>        <ffffffff8024998b>{task_blocks_on_rt_mutex+518}
>        <ffffffff80502986>{kprobe_flush_task+21}

Turns out that kprobe_flush_task() is called from finish_task_switch()
with preemption disabled and it uses a converted spin lock. The following
patch fixed the problem for me and I was able to boot my x86_64 box.

Thanks
Dipankar


kprobe_flush_task() is called from finish_task_switch() with
preemption disabled. This requires kretprobe_lock to be a
raw spinlock. Without this, I get a lot of scheduling while
atomic oopses and then an eventual panic in my x86_64 box.
Tested by booting my x86_64 box.

Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
---



diff -puN kernel/kprobes.c~fix-kprobe-atomic-sched kernel/kprobes.c
--- linux-2.6.17-rt1-rcu/kernel/kprobes.c~fix-kprobe-atomic-sched	2006-06-28 23:23:06.000000000 +0530
+++ linux-2.6.17-rt1-rcu-dipankar/kernel/kprobes.c	2006-06-28 23:24:43.000000000 +0530
@@ -49,7 +49,11 @@ static struct hlist_head kprobe_table[KP
 static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE];
 
 DEFINE_MUTEX(kprobe_mutex);		/* Protects kprobe_table */
-DEFINE_SPINLOCK(kretprobe_lock);	/* Protects kretprobe_inst_table */
+/*
+ * It is acquired from finish_task_switch() with preemption disbaled.
+ * Needs to be raw.
+ */
+DEFINE_RAW_SPINLOCK(kretprobe_lock);	/* Protects kretprobe_inst_table */
 static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL;
 
 #ifdef __ARCH_WANT_KPROBES_INSN_SLOT
diff -puN include/linux/kprobes.h~fix-kprobe-atomic-sched include/linux/kprobes.h
--- linux-2.6.17-rt1-rcu/include/linux/kprobes.h~fix-kprobe-atomic-sched	2006-06-28 23:30:55.000000000 +0530
+++ linux-2.6.17-rt1-rcu-dipankar/include/linux/kprobes.h	2006-06-28 23:32:20.000000000 +0530
@@ -152,7 +152,7 @@ struct kretprobe_instance {
 	struct task_struct *task;
 };
 
-extern spinlock_t kretprobe_lock;
+extern raw_spinlock_t kretprobe_lock;
 extern struct mutex kprobe_mutex;
 extern int arch_prepare_kprobe(struct kprobe *p);
 extern void arch_arm_kprobe(struct kprobe *p);

_

  reply	other threads:[~2006-06-28 18:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-27 20:01 2.6.17-rt1 : x86_64 oops Dipankar Sarma
2006-06-28 18:21 ` Dipankar Sarma [this message]
2006-06-28 19:32   ` [PATCH] 2.6.17-rt1 : fix " Ingo Molnar
2006-06-28 20:02     ` Dipankar Sarma
2006-06-29 14:24       ` Ingo Molnar
2006-06-29 16:32         ` Paul E. McKenney
2006-06-29 19:41           ` Paul E. McKenney
2006-06-29 20:11             ` Ingo Molnar
2006-06-29 21:35               ` Paul E. McKenney
2006-07-03 16:57               ` Dipankar Sarma
2006-07-04  4:15                 ` Dipankar Sarma
2006-07-04  6:43                   ` Ingo Molnar
2006-07-04  6:50                     ` Ingo Molnar
2006-07-05  9:11                       ` Dipankar Sarma
2006-07-26  7:36                         ` Dipankar Sarma
2006-07-06 20:06                       ` Paul E. McKenney

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=20060628182137.GA23979@in.ibm.com \
    --to=dipankar@in.ibm.com \
    --cc=ananth@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=prasanna@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox