Skip to contentSkip to conversation

x86: unify appropriate bits from dumpstack_32 and dumpstack_64

PATCH Applied Neil Horman 3 participants 5 messages Oct 23, 2008 – Oct 27, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: unify appropriate bits from dumpstack_32 and dumpstack_64

Hey all-
As promised, now that dumpstack_32 and dumpstack_64 have so many bits in
common, we should merge the in-sync bits into a common file, to prevent them from diverging again. This patch removes bits which are common between dumpstack_32.c and dumpstack_64.c and places them in a common dumpstack.c which is built for both 32 and 64 bit arches.

Regards
Neil

 Makefile       |    2 
 dumpstack.c    |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dumpstack.h    |   39 ++++++
 dumpstack_32.c |  294 ----------------------------------------------------
 dumpstack_64.c |  285 --------------------------------------------------
 5 files changed, 363 insertions(+), 576 deletions(-)
arch/x86/kernel/Makefile +1 -1
index 01dc4c7..e657ec7 100644
@@ -25,7 +25,7 @@ CFLAGS_paravirt.o	:= $(nostackp)
 
 obj-y			:= process_$(BITS).o signal_$(BITS).o entry_$(BITS).o
 obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
-obj-y			+= time_$(BITS).o ioport.o ldt.o
+obj-y			+= time_$(BITS).o ioport.o ldt.o dumpstack.o
 obj-y			+= setup.o i8259.o irqinit_$(BITS).o setup_percpu.o
 obj-$(CONFIG_X86_VISWS)	+= visws_quirks.o
 obj-$(CONFIG_X86_32)	+= probe_roms_32.o
arch/x86/kernel/dumpstack.c new file +319 -0

319 lines not on this page · raw message

arch/x86/kernel/dumpstack.h new file +39 -0
new file mode 100644
index 0000000..3119a80
@@ -0,0 +1,39 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *  Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
+ */
+
+#ifndef DUMPSTACK_H
+#define DUMPSTACK_H
+
+#ifdef CONFIG_X86_32
+#define STACKSLOTS_PER_LINE 8
+#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
+#else
+#define STACKSLOTS_PER_LINE 4
+#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
+#endif
+
+extern unsigned long
+print_context_stack(struct thread_info *tinfo,
+		unsigned long *stack, unsigned long bp,
+		const struct stacktrace_ops *ops, void *data,
+		unsigned long *end);
+
+extern void
+show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
+		unsigned long *stack, unsigned long bp, char *log_lvl);
+
+extern void
+show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
+		unsigned long *sp, unsigned long bp, char *log_lvl);
+
+extern unsigned int code_bytes;
+extern int kstack_depth_to_print;
+
+/* The form of the top of the frame on the stack */
+struct stack_frame {
+	struct stack_frame *next_frame;
+	unsigned long return_address;
+};
+#endif
arch/x86/kernel/dumpstack_32.c +2 -292

315 lines not on this page · raw message

arch/x86/kernel/dumpstack_64.c +2 -283

312 lines not on this page · raw message

Signature · 6 lines
/***************************************************
 *Neil Horman
 *[email protected]
 *gpg keyid: 1024D / 0x92A74FA1
 *http://pgp.mit.edu
 ***************************************************/
Applied
#1 lore raw
Quoted 14 lines · Neil Horman

Hey all-
As promised, now that dumpstack_32 and dumpstack_64 have so
many bits in common, we should merge the in-sync bits into a common file, to prevent them from diverging again. This patch removes bits which are common between dumpstack_32.c and dumpstack_64.c and places them in a common dumpstack.c which is built for both 32 and 64 bit arches.

Regards
Neil

Quoted 6 lines
 Makefile       |    2 
 dumpstack.c    |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dumpstack.h    |   39 ++++++
 dumpstack_32.c |  294 ----------------------------------------------------
 dumpstack_64.c |  285 --------------------------------------------------
 5 files changed, 363 insertions(+), 576 deletions(-)

applied to tip/x86/dumpstack, thanks Neil!

Ingo

Acked-by on v1 1/1
#2 lore raw
In reply to Neil Horman
Quoted 11 lines · Neil Horman

Hey all-
As promised, now that dumpstack_32 and dumpstack_64 have so many bits in
common, we should merge the in-sync bits into a common file, to prevent them from diverging again. This patch removes bits which are common between dumpstack_32.c and dumpstack_64.c and places them in a common dumpstack.c which is built for both 32 and 64 bit arches.

Regards
Neil

A bit late, maybe, but if it matters:

Thanks Neil!

Quoted 24 lines
 Makefile       |    2 
 dumpstack.c    |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dumpstack.h    |   39 ++++++
 dumpstack_32.c |  294 ----------------------------------------------------
 dumpstack_64.c |  285 --------------------------------------------------
 5 files changed, 363 insertions(+), 576 deletions(-)

[...]

/***************************************************
*Neil Horman
*[email protected]
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu ***************************************************/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 5 lines
  Alexander van Heukelum
  [email protected]

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own
#3 lore raw
Quoted 9 lines · Alexander van Heukelum
Quoted 7 lines · Neil Horman

Hey all-
As promised, now that dumpstack_32 and dumpstack_64 have so many bits in
common, we should merge the in-sync bits into a common file, to prevent them from diverging again. This patch removes bits which are common between dumpstack_32.c and dumpstack_64.c and places them in a common dumpstack.c which is built for both 32 and 64 bit arches.

Quoted 8 lines
Quoted 4 lines

Regards
Neil

A bit late, maybe, but if it matters:

i've updated the commit, thanks.

Ingo

#4 lore raw
Quoted 17 lines · Ingo Molnar
Quoted 14 lines · Alexander van Heukelum
Quoted 11 lines · Neil Horman

Hey all-
As promised, now that dumpstack_32 and dumpstack_64 have so many bits in
common, we should merge the in-sync bits into a common file, to prevent them from diverging again. This patch removes bits which are common between dumpstack_32.c and dumpstack_64.c and places them in a common dumpstack.c which is built for both 32 and 64 bit arches.

Regards
Neil

Quoted 8 lines
Quoted 3 lines

A bit late, maybe, but if it matters:

i've updated the commit, thanks.

Ingo

Thanks guys!
Neil

Signature · 4 lines
/****************************************************
 * Neil Horman <[email protected]>
 * Software Engineer, Red Hat
 ****************************************************/