public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: jmerkey@wolfmountaingroup.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.27-rc1-git5 2/26] mdb: correct kprobes int3 trap
Date: Tue, 05 Aug 2008 11:33:25 -0400	[thread overview]
Message-ID: <489872C5.2040508@redhat.com> (raw)
In-Reply-To: <200808050626.m756QZ1g003755@wolfmountaingroup.com>

Hi Jeffery,

Could you explain what is MDB and how it works?
And please check your patch style by using scripts/checkpatch.pl.
Your cording style seem to be different from linux coding style...

Thank you,

jmerkey@wolfmountaingroup.com wrote:
> Centralized external definitions into include files and corrected 
> the file to conform to Linux coding practices.  fixed word wrap
> problems with patches.
> 
> Corrected kprobes section for int3 trap where CONFIG_MDB is always 
> true.
> 
> Signed-off-by: Jeffrey Vernon Merkey (jmerkey@wolfmountaingroup.com)
> 
> --- a/arch/x86/kernel/traps_32.c	2008-08-04 15:53:24.000000000 -0600
> +++ b/arch/x86/kernel/traps_32.c	2008-08-04 16:00:25.000000000 -0600
> @@ -46,6 +46,10 @@
>  #include <linux/edac.h>
>  #endif
>  
> +#ifdef CONFIG_MDB
> +#include <linux/mdb.h>
> +#endif // CONFIG_MDB
> +
>  #include <asm/arch_hooks.h>
>  #include <asm/stacktrace.h>
>  #include <asm/processor.h>
> @@ -452,8 +456,15 @@
>   */
>  void die(const char *str, struct pt_regs *regs, long err)
>  {
> -	unsigned long flags = oops_begin();
> +#ifdef	CONFIG_MDB
> +	unsigned long flags;
>  
> +        mdb_oops = (unsigned char *)str;
> +        mdb(SOFTWARE_EXCEPTION, err, regs); 
> +	flags = oops_begin();
> +#else
> +	unsigned long flags = oops_begin();
> +#endif // CONFIG_MDB	
>  	if (die_nest_count < 3) {
>  		report_bug(regs->ip, regs);
>  
> @@ -573,9 +584,9 @@
>  }
>  
>  DO_VM86_ERROR_INFO(0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->ip)
> -#ifndef CONFIG_KPROBES
> +#if !defined(CONFIG_KPROBES) && !defined(CONFIG_MDB)
>  DO_VM86_ERROR(3, SIGTRAP, "int3", int3)
> -#endif
> +#endif // CONFIG_MDB
>  DO_VM86_ERROR(4, SIGSEGV, "overflow", overflow)
>  DO_VM86_ERROR(5, SIGSEGV, "bounds", bounds)
>  DO_ERROR_INFO(6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->ip, 0)
> @@ -718,6 +729,9 @@
>  {
>  	if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
>  		return;
> +#ifdef	CONFIG_MDB
> +        mdb(NMI_EXCEPTION, reason, regs); // nmi is code 2
> +#endif // CONFIG_MDB
>  #ifdef CONFIG_MCA
>  	/*
>  	 * Might actually be able to figure out what the guilty party
> @@ -756,6 +770,9 @@
>  	printk(" on CPU%d, ip %08lx, registers:\n",
>  		smp_processor_id(), regs->ip);
>  	show_registers(regs);
> +#ifdef	CONFIG_MDB
> +        mdb(NMI_EXCEPTION, 0, regs); // nmi is code 2
> +#endif // CONFIG_MDB
>  	if (do_panic)
>  		panic("Non maskable interrupt");
>  	console_silent();
> @@ -785,6 +802,10 @@
>  	if (!cpu)
>  		reason = get_nmi_reason();
>  
> +#if defined(CONFIG_SMP) && defined(CONFIG_MDB)
> +        if (mdb(NMI_EXCEPTION, 0, regs))
> +           return;
> +#endif // CONFIG_MDB
>  	if (!(reason & 0xc0)) {
>  		if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
>  								== NOTIFY_STOP)
> @@ -850,6 +871,10 @@
>  #ifdef CONFIG_KPROBES
>  void __kprobes do_int3(struct pt_regs *regs, long error_code)
>  {
> +#ifdef	CONFIG_MDB
> +        if (mdb(BREAKPOINT_EXCEPTION, error_code, regs))
> +           return;
> +#endif // CONFIG_MDB
>  	trace_hardirqs_fixup();
>  
>  	if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP)
> @@ -865,6 +890,16 @@
>  }
>  #endif
>  
> +#if !defined(CONFIG_KPROBES)
> +fastcall void do_int3(struct pt_regs * regs, long error_code)
> +{
> +#if defined(CONFIG_MDB)
> +        if (mdb(BREAKPOINT_EXCEPTION, error_code, regs))
> +           return;
> +#endif // CONFIG_MDB
> +	do_trap(3, SIGTRAP, "int3", 1, regs, error_code, NULL);
> +}
> +#endif	
>  /*
>   * Our handling of the processor debug registers is non-trivial.
>   * We do not clear them on entry and exit from the kernel. Therefore
> @@ -895,6 +930,10 @@
>  	trace_hardirqs_fixup();
>  
>  	get_debugreg(condition, 6);
> +#ifdef	CONFIG_MDB
> +        if (mdb(DEBUGGER_EXCEPTION, error_code, regs))
> +           return;
> +#endif // CONFIG_MDB	
>  
>  	/*
>  	 * The processor cleared BTF, so don't mark that we need it set.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


  reply	other threads:[~2008-08-05 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05  6:26 [PATCH 2.6.27-rc1-git5 2/26] mdb: correct kprobes int3 trap jmerkey
2008-08-05 15:33 ` Masami Hiramatsu [this message]
2008-08-05 15:28   ` jmerkey
2008-08-06  8:15     ` Stefan Richter
     [not found]       ` <44714.166.70.238.45.1218029717.squirrel@webmail.wolfmountaingroup.com>
2008-08-06 16:32         ` Stefan Richter
2008-08-06 16:51     ` Masami Hiramatsu
2008-08-06 19:03       ` jmerkey
2008-08-06  8:40 ` Ananth N Mavinakayanahalli
2008-08-06 13:36   ` jmerkey
2008-08-06 12:21 ` Abhishek Sagar

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=489872C5.2040508@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=jmerkey@wolfmountaingroup.com \
    --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