Skip to contentSkip to conversation

Export save_stack_trace_tsk for ARM and ARM64

PATCH New Dustin Brown 3 participants 11 messages Jun 12, 2017 – Jul 12, 2017

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

PATCH 1/1 Export save_stack_trace_tsk for ARM and ARM64

To help in debugging driver modules on ARM platforms, export save_stack_trace_tsk() for ARM and ARM64 architectures.

---
 arch/arm/kernel/stacktrace.c   | 1 +
 arch/arm64/kernel/stacktrace.c | 1 +
 2 files changed, 2 insertions(+)
arch/arm/kernel/stacktrace.c +1 -0
index 3a2fa203637a..564bb468b7ba 100644
@@ -171,6 +171,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
 	__save_stack_trace(tsk, trace, 1);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
arch/arm64/kernel/stacktrace.c +1 -0
index feac80c22f61..09d37d66b630 100644
@@ -210,6 +210,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 
 	put_task_stack(tsk);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#1 lore raw

PATCH 1/1 Export save_stack_trace_tsk for ARM and ARM64

Quoted 6 lines · Dustin Brown

To help in debugging driver modules on ARM platforms, export save_stack_trace_tsk() for ARM and ARM64 architectures.

---
 arch/arm/kernel/stacktrace.c   | 1 +
 arch/arm64/kernel/stacktrace.c | 1 +
 2 files changed, 2 insertions(+)

If you split this into two patches, I can pick up the arm64 one.

Will

#2 lore raw

PATCH 1/2 arm: Export save_stack_trace_tsk()

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM architecture.

---
 arch/arm/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/kernel/stacktrace.c +1 -0
index 3a2fa203637a..564bb468b7ba 100644
@@ -171,6 +171,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
 	__save_stack_trace(tsk, trace, 1);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#3 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM64 architecture.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/stacktrace.c +1 -0
index feac80c22f61..09d37d66b630 100644
@@ -210,6 +210,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 
 	put_task_stack(tsk);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#4 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

Quoted 5 lines · Dustin Brown

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM64 architecture.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)

Please can you repost with your Signed-off-by line added to the patch? I can't merge anything from you without that.

Thanks,

Will

Quoted 15 lines
arch/arm64/kernel/stacktrace.c +1 -0
index feac80c22f61..09d37d66b630 100644
@@ -210,6 +210,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 
 	put_task_stack(tsk);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#5 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

Quoted 9 lines · Will Deacon
Quoted 5 lines · Dustin Brown

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM64 architecture.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)

Please can you repost with your Signed-off-by line added to the patch? I can't merge anything from you without that.

I think it would also be a good thing to have a little more information about how this is being used in driver modules.

If it's for ad-hoc debugging, then I see no reason for it to be merged into mainline kernels just for the utility of people adding code to drivers to perform that debug - they might as well temporarily add the export at the same time IMHO.

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#6 lore raw

PATCH 1/2 arm: Export save_stack_trace_tsk()

The kernel watchdog is a great debugging tool for finding tasks that consume a disproportionate amount of CPU time in contiguous chunks. One can imagine building a similar watchdog for arbitrary driver threads using save_stack_trace_tsk() and print_stack_trace(). However, this is not viable for dynamically loaded driver modules on ARM platforms because save_stack_trace_tsk() is not exported for those architectures. Export save_stack_trace_tsk() for the ARM architecture to align with x86 and support various debugging use cases such as arbitrary driver thread watchdog timers.

---
 arch/arm/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/kernel/stacktrace.c +1 -0
index 3a2fa203637a..564bb468b7ba 100644
@@ -171,6 +171,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
 	__save_stack_trace(tsk, trace, 1);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#7 lore raw

PATCH 1/2 arm: Export save_stack_trace_tsk()

Hi Everyone,

I just wanted to touch base and see where we are with respect to this one. I see that the arm64 version of this patch has already landed for 4.13. Is there anything needed from me for this? I apologize in advance if I am just being impatient.

Thanks,

-Dustin

-----Original Message-----
From: Dustin Brown [mailto:dustinb at codeaurora.org]
Sent: Tuesday, June 13, 2017 11:41 AM
To: linux at armlinux.org.uk; catalin.marinas at arm.com; will.deacon at arm.com; linux-arm-kernel at lists.infradead.org
Cc: Dustin Brown <[email protected]>
Subject: [PATCH 1/2] arm: Export save_stack_trace_tsk()

The kernel watchdog is a great debugging tool for finding tasks that consume a disproportionate amount of CPU time in contiguous chunks. One can imagine building a similar watchdog for arbitrary driver threads using save_stack_trace_tsk() and print_stack_trace(). However, this is not viable for dynamically loaded driver modules on ARM platforms because save_stack_trace_tsk() is not exported for those architectures. Export save_stack_trace_tsk() for the ARM architecture to align with x86 and support various debugging use cases such as arbitrary driver thread watchdog timers.

---
 arch/arm/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/kernel/stacktrace.c +0 -0
index 3a2fa203637a..564bb468b7ba 100644
@@ -171,6 +171,7 @@ void save_stack_trace_tsk(struct task_struct *tsk,

struct stack_trace *trace)
{
__save_stack_trace(tsk, trace, 1);
}
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);

void save_stack_trace(struct stack_trace *trace)
{

Signature · 1 line
2.12.2
#8 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

In reply to Dustin Brown

The kernel watchdog is a great debugging tool for finding tasks that consume a disproportionate amount of CPU time in contiguous chunks. One can imagine building a similar watchdog for arbitrary driver threads using save_stack_trace_tsk() and print_stack_trace(). However, this is not viable for dynamically loaded driver modules on ARM platforms because save_stack_trace_tsk() is not exported for those architectures. Export save_stack_trace_tsk() for the ARM64 architecture to align with x86 and support various debugging use cases such as arbitrary driver thread watchdog timers.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/stacktrace.c +1 -0
index feac80c22f61..09d37d66b630 100644
@@ -210,6 +210,7 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 
 	put_task_stack(tsk);
 }
+EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
 
 void save_stack_trace(struct stack_trace *trace)
 {
Signature · 1 line
2.12.2
#9 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

In reply to Russell King - ARM Linux
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Will Deacon
Quoted 5 lines · Dustin Brown

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM64 architecture.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 5 lines
Quoted 2 lines

Please can you repost with your Signed-off-by line added to the patch? I can't merge anything from you without that.

I think it would also be a good thing to have a little more information about how this is being used in driver modules.

That would certainly help to motivate the change; I was just going by the fact that most other architectures export this symbol and therefore it is assumedly useful to somebody.

Quoted 4 lines

If it's for ad-hoc debugging, then I see no reason for it to be merged into mainline kernels just for the utility of people adding code to drivers to perform that debug - they might as well temporarily add the export at the same time IMHO.

A quick look at the Debian archive suggests that it's used by "systemtap" (although this seems to be part of an autoconf helper) and "kpatch".

Dustin -- do you have another use-case behind this?

Will

#10 lore raw

PATCH 2/2 arm64: Export save_stack_trace_tsk()

Hi Will,

I sent out updated patches yesterday with better descriptions, but I am not sure I got the threads associated correctly.

We have a dynamically loaded kernel driver with a worker thread which processes a queue. From time to time, defects get introduced that cause this thread to hang for long periods of time, or deadlock. To catch these quickly, we introduced a watchdog timer that does a bug-on when individual work items take longer than some threshold. This works great when the worker thread is on the CPU at the point of timeout, but in cases where it went to sleep on a mutex or a kmalloc, we want to dump the worker thread's stack trace specifically.

This is code that is expected to live for years, and is not a one-off debugging instance.

Thanks,

-Dustin

-----Original Message-----
From: Will Deacon [mailto:will.deacon at arm.com]
Sent: Wednesday, June 14, 2017 3:07 AM
To: Russell King - ARM Linux <[email protected]>
Cc: Dustin Brown <[email protected]>; catalin.marinas at arm.com; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 2/2] arm64: Export save_stack_trace_tsk()

Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Will Deacon
Quoted 5 lines · Dustin Brown

To aid in debugging driver modules, export save_stack_trace_tsk() for the ARM64 architecture.

---
 arch/arm64/kernel/stacktrace.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 5 lines
Quoted 2 lines

Please can you repost with your Signed-off-by line added to the patch? I can't merge anything from you without that.

I think it would also be a good thing to have a little more information about how this is being used in driver modules.

That would certainly help to motivate the change; I was just going by the fact that most other architectures export this symbol and therefore it is assumedly useful to somebody.

Quoted 4 lines

If it's for ad-hoc debugging, then I see no reason for it to be merged into mainline kernels just for the utility of people adding code to drivers to perform that debug - they might as well temporarily add the export at the same time IMHO.

A quick look at the Debian archive suggests that it's used by "systemtap" (although this seems to be part of an autoconf helper) and "kpatch".

Dustin -- do you have another use-case behind this?

Will