linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/dumpstack: make stack name tags more comprehensible
@ 2016-11-18 17:46 Josh Poimboeuf
  2016-11-18 18:54 ` Peter Zijlstra
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Josh Poimboeuf @ 2016-11-18 17:46 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Peter Zijlstra

NMI stack dumps are bracked by the following tags:

  <NMI>
  ...
  <EOE>

The ending tag is kind of confusing if you don't already know what "EOE"
means (end of exception).  The same ending tag is also used to mark the
end of all other exceptions' stacks.  For example:

  <#DF>
  ...
  <EOE>

And similarly, "EOI" is used as the ending tag for interrupts:

  <IRQ>
  ...
  <EOI>

Change the tags to be more comprehensible by making them symmetrical and
more XML-esque:

  <NMI>
  ...
  </NMI>

  <#DF>
  ...
  </#DF>

  <IRQ>
  ...
  </IRQ>

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/include/asm/stacktrace.h |  3 +--
 arch/x86/kernel/dumpstack.c       | 12 ++++++------
 arch/x86/kernel/dumpstack_32.c    | 19 ++++++++-----------
 arch/x86/kernel/dumpstack_64.c    | 22 ++++++++--------------
 4 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 1e375b0..a3269c8 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -30,8 +30,7 @@ bool in_task_stack(unsigned long *stack, struct task_struct *task,
 int get_stack_info(unsigned long *stack, struct task_struct *task,
 		   struct stack_info *info, unsigned long *visit_mask);
 
-void stack_type_str(enum stack_type type, const char **begin,
-		    const char **end);
+const char *stack_type_name(enum stack_type type);
 
 static inline bool on_stack(struct stack_info *info, void *addr, size_t len)
 {
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index bbea45f..0cfd01d 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -76,7 +76,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	 * - hardirq stack
 	 */
 	for (regs = NULL; stack; stack = stack_info.next_sp) {
-		const char *str_begin, *str_end;
+		const char *stack_name;
 
 		/*
 		 * If we overflowed the task stack into a guard page, jump back
@@ -88,9 +88,9 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		if (get_stack_info(stack, task, &stack_info, &visit_mask))
 			break;
 
-		stack_type_str(stack_info.type, &str_begin, &str_end);
-		if (str_begin)
-			printk("%s <%s>\n", log_lvl, str_begin);
+		stack_name = stack_type_name(stack_info.type);
+		if (stack_name)
+			printk("%s <%s>\n", log_lvl, stack_name);
 
 		/*
 		 * Scan the stack, printing any text addresses we find.  At the
@@ -155,8 +155,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 				__show_regs(regs, 0);
 		}
 
-		if (str_end)
-			printk("%s <%s>\n", log_lvl, str_end);
+		if (stack_name)
+			printk("%s </%s>\n", log_lvl, stack_name);
 	}
 }
 
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index d7d20999..bb3b5b9 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -16,18 +16,15 @@
 
 #include <asm/stacktrace.h>
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
-	switch (type) {
-	case STACK_TYPE_IRQ:
-	case STACK_TYPE_SOFTIRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type == STACK_TYPE_SOFTIRQ)
+		return "SOFTIRQ";
+
+	return NULL;
 }
 
 static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info)
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index ab0f8b9..fac189e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -28,23 +28,17 @@ static unsigned long exception_stack_sizes[N_EXCEPTION_STACKS] = {
 	[DEBUG_STACK - 1]			= DEBUG_STKSZ
 };
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
 	BUILD_BUG_ON(N_EXCEPTION_STACKS != 4);
 
-	switch (type) {
-	case STACK_TYPE_IRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	case STACK_TYPE_EXCEPTION ... STACK_TYPE_EXCEPTION_LAST:
-		*begin = exception_stack_names[type - STACK_TYPE_EXCEPTION];
-		*end   = "EOE";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type >= STACK_TYPE_EXCEPTION && type <= STACK_TYPE_EXCEPTION_LAST)
+		return exception_stack_names[type - STACK_TYPE_EXCEPTION];
+
+	return NULL;
 }
 
 static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/dumpstack: make stack name tags more comprehensible
  2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
@ 2016-11-18 18:54 ` Peter Zijlstra
  2016-11-19 15:49 ` Frederic Weisbecker
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2016-11-18 18:54 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: x86, linux-kernel

On Fri, Nov 18, 2016 at 11:46:23AM -0600, Josh Poimboeuf wrote:
> NMI stack dumps are bracked by the following tags:
> 
>   <NMI>
>   ...
>   <EOE>
> 
> The ending tag is kind of confusing if you don't already know what "EOE"
> means (end of exception).  The same ending tag is also used to mark the
> end of all other exceptions' stacks.  For example:
> 
>   <#DF>
>   ...
>   <EOE>
> 
> And similarly, "EOI" is used as the ending tag for interrupts:
> 
>   <IRQ>
>   ...
>   <EOI>
> 
> Change the tags to be more comprehensible by making them symmetrical and
> more XML-esque:
> 
>   <NMI>
>   ...
>   </NMI>
> 
>   <#DF>
>   ...
>   </#DF>
> 
>   <IRQ>
>   ...
>   </IRQ>
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

>  arch/x86/include/asm/stacktrace.h |  3 +--
>  arch/x86/kernel/dumpstack.c       | 12 ++++++------
>  arch/x86/kernel/dumpstack_32.c    | 19 ++++++++-----------
>  arch/x86/kernel/dumpstack_64.c    | 22 ++++++++--------------
>  4 files changed, 23 insertions(+), 33 deletions(-)

And saves lines too, awesome!

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/dumpstack: make stack name tags more comprehensible
  2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
  2016-11-18 18:54 ` Peter Zijlstra
@ 2016-11-19 15:49 ` Frederic Weisbecker
  2016-11-19 20:25 ` Josh Poimboeuf
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2016-11-19 15:49 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: the arch/x86 maintainers, LKML, Peter Zijlstra

2016-11-18 18:46 GMT+01:00 Josh Poimboeuf <jpoimboe@redhat.com>:
> NMI stack dumps are bracked by the following tags:
>
>   <NMI>
>   ...
>   <EOE>
>
> The ending tag is kind of confusing if you don't already know what "EOE"
> means (end of exception).  The same ending tag is also used to mark the
> end of all other exceptions' stacks.  For example:
>
>   <#DF>
>   ...
>   <EOE>
>
> And similarly, "EOI" is used as the ending tag for interrupts:
>
>   <IRQ>
>   ...
>   <EOI>
>
> Change the tags to be more comprehensible by making them symmetrical and
> more XML-esque:
>
>   <NMI>
>   ...
>   </NMI>
>
>   <#DF>
>   ...
>   </#DF>
>
>   <IRQ>
>   ...
>   </IRQ>
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

I like that! I hope not too many tools rely on the old namings.
But dmesg isn't supposed to be a stable ABI anyway.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/dumpstack: make stack name tags more comprehensible
  2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
  2016-11-18 18:54 ` Peter Zijlstra
  2016-11-19 15:49 ` Frederic Weisbecker
@ 2016-11-19 20:25 ` Josh Poimboeuf
  2016-11-21 10:38 ` [tip:x86/asm] x86/dumpstack: Make " tip-bot for Josh Poimboeuf
  2016-11-21 12:07 ` tip-bot for Josh Poimboeuf
  4 siblings, 0 replies; 6+ messages in thread
From: Josh Poimboeuf @ 2016-11-19 20:25 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Peter Zijlstra

On Fri, Nov 18, 2016 at 11:46:23AM -0600, Josh Poimboeuf wrote:
> NMI stack dumps are bracked by the following tags:

s/bracked/bracketed/

-- 
Josh

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/asm] x86/dumpstack: Make stack name tags more comprehensible
  2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
                   ` (2 preceding siblings ...)
  2016-11-19 20:25 ` Josh Poimboeuf
@ 2016-11-21 10:38 ` tip-bot for Josh Poimboeuf
  2016-11-21 12:07 ` tip-bot for Josh Poimboeuf
  4 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2016-11-21 10:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, peterz, bp, fweisbec, linux-kernel, tglx, dvlasenk, hpa,
	brgerst, jpoimboe, luto, torvalds

Commit-ID:  2e080881993d6a018d2c2ee1901f933e4a17ea5a
Gitweb:     http://git.kernel.org/tip/2e080881993d6a018d2c2ee1901f933e4a17ea5a
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Fri, 18 Nov 2016 11:46:23 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 21 Nov 2016 11:11:03 +0100

x86/dumpstack: Make stack name tags more comprehensible

NMI stack dumps are bracketed by the following tags:

  <NMI>
  ...
  <EOE>

The ending tag is kind of confusing if you don't already know what "EOE"
means (end of exception).  The same ending tag is also used to mark the
end of all other exceptions' stacks.  For example:

  <#DF>
  ...
  <EOE>

And similarly, "EOI" is used as the ending tag for interrupts:

  <IRQ>
  ...
  <EOI>

Change the tags to be more comprehensible by making them symmetrical and
more XML-esque:

  <NMI>
  ...
  </NMI>

  <#DF>
  ...
  </#DF>

  <IRQ>
  ...
  </IRQ>

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/180196e3754572540b595bc56b947d43658979a7.1479491159.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/stacktrace.h |  3 +--
 arch/x86/kernel/dumpstack.c       | 12 ++++++------
 arch/x86/kernel/dumpstack_32.c    | 19 ++++++++-----------
 arch/x86/kernel/dumpstack_64.c    | 22 ++++++++--------------
 4 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 1e375b0..a3269c8 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -30,8 +30,7 @@ bool in_task_stack(unsigned long *stack, struct task_struct *task,
 int get_stack_info(unsigned long *stack, struct task_struct *task,
 		   struct stack_info *info, unsigned long *visit_mask);
 
-void stack_type_str(enum stack_type type, const char **begin,
-		    const char **end);
+const char *stack_type_name(enum stack_type type);
 
 static inline bool on_stack(struct stack_info *info, void *addr, size_t len)
 {
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 1e057b0..0e5c9d0 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -76,7 +76,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	 * - hardirq stack
 	 */
 	for (regs = NULL; stack; stack = stack_info.next_sp) {
-		const char *str_begin, *str_end;
+		const char *stack_name;
 
 		/*
 		 * If we overflowed the task stack into a guard page, jump back
@@ -88,9 +88,9 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		if (get_stack_info(stack, task, &stack_info, &visit_mask))
 			break;
 
-		stack_type_str(stack_info.type, &str_begin, &str_end);
-		if (str_begin)
-			printk("%s <%s>\n", log_lvl, str_begin);
+		stack_name = stack_type_name(stack_info.type);
+		if (stack_name)
+			printk("%s <%s>\n", log_lvl, stack_name);
 
 		/*
 		 * Scan the stack, printing any text addresses we find.  At the
@@ -155,8 +155,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 				__show_regs(regs, 0);
 		}
 
-		if (str_end)
-			printk("%s <%s>\n", log_lvl, str_end);
+		if (stack_name)
+			printk("%s </%s>\n", log_lvl, stack_name);
 	}
 }
 
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index d7d20999..bb3b5b9 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -16,18 +16,15 @@
 
 #include <asm/stacktrace.h>
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
-	switch (type) {
-	case STACK_TYPE_IRQ:
-	case STACK_TYPE_SOFTIRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type == STACK_TYPE_SOFTIRQ)
+		return "SOFTIRQ";
+
+	return NULL;
 }
 
 static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info)
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index ab0f8b9..fac189e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -28,23 +28,17 @@ static unsigned long exception_stack_sizes[N_EXCEPTION_STACKS] = {
 	[DEBUG_STACK - 1]			= DEBUG_STKSZ
 };
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
 	BUILD_BUG_ON(N_EXCEPTION_STACKS != 4);
 
-	switch (type) {
-	case STACK_TYPE_IRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	case STACK_TYPE_EXCEPTION ... STACK_TYPE_EXCEPTION_LAST:
-		*begin = exception_stack_names[type - STACK_TYPE_EXCEPTION];
-		*end   = "EOE";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type >= STACK_TYPE_EXCEPTION && type <= STACK_TYPE_EXCEPTION_LAST)
+		return exception_stack_names[type - STACK_TYPE_EXCEPTION];
+
+	return NULL;
 }
 
 static bool in_exception_stack(unsigned long *stack, struct stack_info *info)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [tip:x86/asm] x86/dumpstack: Make stack name tags more comprehensible
  2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
                   ` (3 preceding siblings ...)
  2016-11-21 10:38 ` [tip:x86/asm] x86/dumpstack: Make " tip-bot for Josh Poimboeuf
@ 2016-11-21 12:07 ` tip-bot for Josh Poimboeuf
  4 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2016-11-21 12:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: brgerst, fweisbec, linux-kernel, hpa, luto, bp, mingo, tglx,
	torvalds, dvlasenk, peterz, jpoimboe

Commit-ID:  3d02a9c48d479eb58841805baaf93c5a084b6010
Gitweb:     http://git.kernel.org/tip/3d02a9c48d479eb58841805baaf93c5a084b6010
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Fri, 18 Nov 2016 11:46:23 -0600
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 21 Nov 2016 13:00:42 +0100

x86/dumpstack: Make stack name tags more comprehensible

NMI stack dumps are bracketed by the following tags:

  <NMI>
  ...
  <EOE>

The ending tag is kind of confusing if you don't already know what "EOE"
means (end of exception).  The same ending tag is also used to mark the
end of all other exceptions' stacks.  For example:

  <#DF>
  ...
  <EOE>

And similarly, "EOI" is used as the ending tag for interrupts:

  <IRQ>
  ...
  <EOI>

Change the tags to be more comprehensible by making them symmetrical and
more XML-esque:

  <NMI>
  ...
  </NMI>

  <#DF>
  ...
  </#DF>

  <IRQ>
  ...
  </IRQ>

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/180196e3754572540b595bc56b947d43658979a7.1479491159.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/stacktrace.h |  3 +--
 arch/x86/kernel/dumpstack.c       | 12 ++++++------
 arch/x86/kernel/dumpstack_32.c    | 19 ++++++++-----------
 arch/x86/kernel/dumpstack_64.c    | 22 ++++++++--------------
 4 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 1e375b0..a3269c8 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -30,8 +30,7 @@ bool in_task_stack(unsigned long *stack, struct task_struct *task,
 int get_stack_info(unsigned long *stack, struct task_struct *task,
 		   struct stack_info *info, unsigned long *visit_mask);
 
-void stack_type_str(enum stack_type type, const char **begin,
-		    const char **end);
+const char *stack_type_name(enum stack_type type);
 
 static inline bool on_stack(struct stack_info *info, void *addr, size_t len)
 {
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 1e057b0..0e5c9d0 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -76,7 +76,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	 * - hardirq stack
 	 */
 	for (regs = NULL; stack; stack = stack_info.next_sp) {
-		const char *str_begin, *str_end;
+		const char *stack_name;
 
 		/*
 		 * If we overflowed the task stack into a guard page, jump back
@@ -88,9 +88,9 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 		if (get_stack_info(stack, task, &stack_info, &visit_mask))
 			break;
 
-		stack_type_str(stack_info.type, &str_begin, &str_end);
-		if (str_begin)
-			printk("%s <%s>\n", log_lvl, str_begin);
+		stack_name = stack_type_name(stack_info.type);
+		if (stack_name)
+			printk("%s <%s>\n", log_lvl, stack_name);
 
 		/*
 		 * Scan the stack, printing any text addresses we find.  At the
@@ -155,8 +155,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 				__show_regs(regs, 0);
 		}
 
-		if (str_end)
-			printk("%s <%s>\n", log_lvl, str_end);
+		if (stack_name)
+			printk("%s </%s>\n", log_lvl, stack_name);
 	}
 }
 
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index d7d20999..bb3b5b9 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -16,18 +16,15 @@
 
 #include <asm/stacktrace.h>
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
-	switch (type) {
-	case STACK_TYPE_IRQ:
-	case STACK_TYPE_SOFTIRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type == STACK_TYPE_SOFTIRQ)
+		return "SOFTIRQ";
+
+	return NULL;
 }
 
 static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info)
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index ab0f8b9..fac189e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -28,23 +28,17 @@ static unsigned long exception_stack_sizes[N_EXCEPTION_STACKS] = {
 	[DEBUG_STACK - 1]			= DEBUG_STKSZ
 };
 
-void stack_type_str(enum stack_type type, const char **begin, const char **end)
+const char *stack_type_name(enum stack_type type)
 {
 	BUILD_BUG_ON(N_EXCEPTION_STACKS != 4);
 
-	switch (type) {
-	case STACK_TYPE_IRQ:
-		*begin = "IRQ";
-		*end   = "EOI";
-		break;
-	case STACK_TYPE_EXCEPTION ... STACK_TYPE_EXCEPTION_LAST:
-		*begin = exception_stack_names[type - STACK_TYPE_EXCEPTION];
-		*end   = "EOE";
-		break;
-	default:
-		*begin = NULL;
-		*end   = NULL;
-	}
+	if (type == STACK_TYPE_IRQ)
+		return "IRQ";
+
+	if (type >= STACK_TYPE_EXCEPTION && type <= STACK_TYPE_EXCEPTION_LAST)
+		return exception_stack_names[type - STACK_TYPE_EXCEPTION];
+
+	return NULL;
 }
 
 static bool in_exception_stack(unsigned long *stack, struct stack_info *info)

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-21 12:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 17:46 [PATCH] x86/dumpstack: make stack name tags more comprehensible Josh Poimboeuf
2016-11-18 18:54 ` Peter Zijlstra
2016-11-19 15:49 ` Frederic Weisbecker
2016-11-19 20:25 ` Josh Poimboeuf
2016-11-21 10:38 ` [tip:x86/asm] x86/dumpstack: Make " tip-bot for Josh Poimboeuf
2016-11-21 12:07 ` tip-bot for Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).