lkml.org 
[lkml]   [2021]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH] spinlock_debug: Save stacktrace at lock acquisition
Date
On 6/29/21 9:28 PM, Guru Das Srinagesh wrote:
> In case of spinlock recursion bugs, knowing which entity acquired the
> lock initially is key to debugging. Therefore, save the stack frames
> when the lock is acquired and print them when spinlock recursion is
> detected.
>
> Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
> ---
> include/linux/spinlock_types.h | 3 +++
> kernel/locking/spinlock_debug.c | 9 +++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
> index b981caa..8a68d55 100644
> --- a/include/linux/spinlock_types.h
> +++ b/include/linux/spinlock_types.h
> @@ -22,6 +22,9 @@ typedef struct raw_spinlock {
> #ifdef CONFIG_DEBUG_SPINLOCK
> unsigned int magic, owner_cpu;
> void *owner;
> +#define MAX_STACK_LEN 16
> + int stack_len;
> + unsigned long stack_trace[MAX_STACK_LEN];
> #endif

Nak

Locking problem like this should be detected by the lockdep code. Adding
136 bytes (64-bit archs) to the size of a spinlock is just too big an
overhead.

Regards,
Longman

\
 
 \ /
  Last update: 2021-06-30 04:02    [W:0.054 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site