From: akpm@osdl.org
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, ak@suse.de,
jbeulich@novell.com, jfv@bluesong.net, jim.houston@ccur.com,
kaos@sgi.com, prasanna@in.ibm.com
Subject: [patch 095/198] x86_64: Keep only a single debug notifier chain
Date: Tue, 12 Apr 2005 03:32:02 -0700 [thread overview]
Message-ID: <200504121032.j3CAW8dV005514@shell0.pdx.osdl.net> (raw)
From: "Andi Kleen" <ak@suse.de>
Calling a notifier three times in the debug handler does not make much sense,
because a debugger can figure out the various conditions by itself. Remove
the additional calls to DIE_DEBUG and DIE_DEBUGSTEP completely.
This matches what i386 does now.
This also makes sure interrupts are always still disabled when calling a
debugger, which prevents:
BUG: using smp_processor_id() in preemptible [00000001] code: tpopf/1470
caller is post_kprobe_handler+0x9/0x70
Call Trace:<ffffffff8024f10f>{smp_processor_id+191} <ffffffff80120e69>{post_kpro
be_handler+9}
<ffffffff80120f7a>{kprobe_exceptions_notify+58}
<ffffffff80144fc0>{notifier_call_chain+32} <ffffffff80110daf>{do_debug+335}
<ffffffff8010f513>{debug+127} <EOE>
on preemptible debug kernels with kprobes when single stepping in user space.
This was probably a bug even on non preempt kernels, this function was
supposed to be running with interrupts off according to a comment there.
Note to third part debugger maintainers: please double check your debugger can
still single step.
Cc: <prasanna@in.ibm.com>
Cc: <jbeulich@novell.com>
Cc: <kaos@sgi.com>
Cc: <jim.houston@ccur.com>
Cc: <jfv@bluesong.net>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/arch/x86_64/kernel/traps.c | 14 +++-----------
25-akpm/include/asm-x86_64/kdebug.h | 1 -
2 files changed, 3 insertions(+), 12 deletions(-)
diff -puN arch/x86_64/kernel/traps.c~x86_64-keep-only-a-single-debug-notifier-chain arch/x86_64/kernel/traps.c
--- 25/arch/x86_64/kernel/traps.c~x86_64-keep-only-a-single-debug-notifier-chain 2005-04-12 03:21:25.729225464 -0700
+++ 25-akpm/arch/x86_64/kernel/traps.c 2005-04-12 03:21:25.734224704 -0700
@@ -659,9 +659,9 @@ asmlinkage void do_debug(struct pt_regs
asm("movq %%db6,%0" : "=r" (condition));
if (notify_die(DIE_DEBUG, "debug", regs, condition, error_code,
- SIGTRAP) == NOTIFY_STOP) {
+ SIGTRAP) == NOTIFY_STOP)
return;
- }
+
conditional_sti(regs);
/* Mask out spurious debug traps due to lazy DR7 setting */
@@ -674,9 +674,7 @@ asmlinkage void do_debug(struct pt_regs
tsk->thread.debugreg6 = condition;
/* Mask out spurious TF errors due to lazy TF clearing */
- if ((condition & DR_STEP) &&
- (notify_die(DIE_DEBUGSTEP, "debugstep", regs, condition,
- 1, SIGTRAP) != NOTIFY_STOP)) {
+ if (condition & DR_STEP) {
/*
* The TF error should be masked out only if the current
* process is not traced and if the TRAP flag has been set
@@ -711,16 +709,10 @@ asmlinkage void do_debug(struct pt_regs
force_sig_info(SIGTRAP, &info, tsk);
clear_dr7:
asm volatile("movq %0,%%db7"::"r"(0UL));
- notify_die(DIE_DEBUG, "debug", regs, condition, 1, SIGTRAP);
return;
clear_TF_reenable:
set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
-
-clear_TF:
- /* RED-PEN could cause spurious errors */
- if (notify_die(DIE_DEBUG, "debug2", regs, condition, 1, SIGTRAP)
- != NOTIFY_STOP)
regs->eflags &= ~TF_MASK;
}
diff -puN include/asm-x86_64/kdebug.h~x86_64-keep-only-a-single-debug-notifier-chain include/asm-x86_64/kdebug.h
--- 25/include/asm-x86_64/kdebug.h~x86_64-keep-only-a-single-debug-notifier-chain 2005-04-12 03:21:25.730225312 -0700
+++ 25-akpm/include/asm-x86_64/kdebug.h 2005-04-12 03:21:25.734224704 -0700
@@ -23,7 +23,6 @@ enum die_val {
DIE_OOPS = 1,
DIE_INT3,
DIE_DEBUG,
- DIE_DEBUGSTEP,
DIE_PANIC,
DIE_NMI,
DIE_DIE,
_
reply other threads:[~2005-04-12 19:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200504121032.j3CAW8dV005514@shell0.pdx.osdl.net \
--to=akpm@osdl.org \
--cc=ak@suse.de \
--cc=jbeulich@novell.com \
--cc=jfv@bluesong.net \
--cc=jim.houston@ccur.com \
--cc=kaos@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=prasanna@in.ibm.com \
--cc=torvalds@osdl.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
all inboxes | Powered by JetHome®