mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Louis Rilling <Louis.Rilling@kerlabs.com>
To: Alexander van Heukelum <heukelum@fastmail.fm>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] dumpstack: x86: various small unification steps
Date: Mon, 6 Oct 2008 11:35:29 +0200	[thread overview]
Message-ID: <20081006093529.GA29198@hawkmoon.kerlabs.com> (raw)
In-Reply-To: <1223154766-19350-8-git-send-email-heukelum@fastmail.fm>

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

On Sat, Oct 04, 2008 at 11:12:46PM +0200, Alexander van Heukelum wrote:
>  - define STACKSLOTS_PER_LINE and use it
>  - define get_bp macro to hide the %%ebp/%%rbp difference
>  - i386: check task==NULL in dump_trace, like x86_64
>  - i386: show_trace(NULL, ...) uses current automatically
>  - x86_64: use [#%d] for die_counter, like i386
>  - whitespace and comments
> 
[...]

> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index 6ac80f0..ddc8a38 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -16,8 +16,11 @@
>  
>  #include <asm/stacktrace.h>
>  
> +#define STACKSLOTS_PER_LINE 4
> +#define get_bp(bp) asm("movl %%rbp, %0" : "=r" (bp) :)
                           ^^^^
Should be movq.

Louis

>  int panic_on_unrecovered_nmi;
> -int kstack_depth_to_print = 12;
> +int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
>  static unsigned int code_bytes = 64;
>  static int die_counter;
>  
> @@ -177,7 +180,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
>  	if (!bp) {
>  		if (task == current) {
>  			/* Grab bp right from our regs */
> -			asm("movq %%rbp, %0" : "=r" (bp) : );
> +			get_bp(bp);
>  		} else {
>  			/* bp is the last reg pushed by switch_to */
>  			bp = *(unsigned long *) task->thread.sp;
> @@ -329,7 +332,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
>  		if (((long) stack & (THREAD_SIZE-1)) == 0)
>  			break;
>  		}
> -		if (i && ((i % 4) == 0))
> +		if (i && ((i % STACKSLOTS_PER_LINE) == 0))
>  			printk("\n%s", log_lvl);
>  		printk(" %016lx", *stack++);
>  		touch_nmi_watchdog();
> @@ -353,7 +356,7 @@ void dump_stack(void)
>  
>  #ifdef CONFIG_FRAME_POINTER
>  	if (!bp)
> -		asm("movq %%rbp, %0" : "=r" (bp) : );
> +		get_bp(bp);
>  #endif
>  
>  	printk("Pid: %d, comm: %.20s %s %s %.*s\n",
> @@ -396,7 +399,7 @@ void show_registers(struct pt_regs *regs)
>  
>  		ip = (u8 *)regs->ip - code_prologue;
>  		if (ip < (u8 *)PAGE_OFFSET || probe_kernel_address(ip, c)) {
> -			/* try starting at RIP */
> +			/* try starting at IP */
>  			ip = (u8 *)regs->ip;
>  			code_len = code_len - code_prologue + 1;
>  		}
> @@ -477,7 +480,7 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
>  
>  int __kprobes __die(const char *str, struct pt_regs *regs, long err)
>  {
> -	printk(KERN_EMERG "%s: %04lx [%u] ", str, err & 0xffff, ++die_counter);
> +	printk(KERN_EMERG "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
>  #ifdef CONFIG_PREEMPT
>  	printk("PREEMPT ");
>  #endif
> -- 
> 1.5.4.3
> 
> --
> 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/

-- 
Dr Louis Rilling			Kerlabs
Skype: louis.rilling			Batiment Germanium
Phone: (+33|0) 6 80 89 08 23		80 avenue des Buttes de Coesmes
http://www.kerlabs.com/			35700 Rennes

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2008-10-06  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-04 21:12 Alexander van Heukelum
2008-10-04 21:12 ` [PATCH] dumpstack: x86: move die_nmi to dumpstack_32.c Alexander van Heukelum
2008-10-04 21:12   ` [PATCH] dumpstack: x86: make printk_address equal Alexander van Heukelum
2008-10-04 21:12     ` [PATCH] dumpstack: x86: add "end" parameter to valid_stack_ptr and print_context_stack Alexander van Heukelum
2008-10-04 21:12       ` [PATCH] dumptrace: x86: consistently include loglevel, print stack switch Alexander van Heukelum
2008-10-04 21:12         ` [PATCH] dumpstack: x86: use log_lvl and unify trace formatting Alexander van Heukelum
2008-10-04 21:12           ` [PATCH] dumpstack: i386: make kstack= an early boot-param and add oops=panic Alexander van Heukelum
2008-10-04 21:12             ` [PATCH] dumpstack: x86: various small unification steps Alexander van Heukelum
2008-10-06  9:35               ` Louis Rilling [this message]
2008-10-06  9:43                 ` Alexander van Heukelum
2008-10-05  9:35 ` Ingo Molnar
2008-10-05  9:46   ` Ingo Molnar
2008-10-05 10:39     ` Alexander van Heukelum
2008-10-05 16:38       ` Ingo Molnar
2008-10-05 11:40   ` Alexander van Heukelum

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=20081006093529.GA29198@hawkmoon.kerlabs.com \
    --to=louis.rilling@kerlabs.com \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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®