From: Waiman Long <llong@redhat.com>
To: Guru Das Srinagesh <gurus@codeaurora.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] spinlock_debug: Save stacktrace at lock acquisition
Date: Tue, 29 Jun 2021 22:01:01 -0400 [thread overview]
Message-ID: <98f4a7f1-bce7-8e74-c124-7f5183b8cdfc@redhat.com> (raw)
In-Reply-To: <1625016485-32581-1-git-send-email-gurus@codeaurora.org>
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
next prev parent reply other threads:[~2021-06-30 2:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 1:28 Guru Das Srinagesh
2021-06-30 2:01 ` Waiman Long [this message]
2021-07-07 9:22 ` [spinlock_debug] 0263428b26: kernel-selftests.dma.dma_map_benchmark.average_unmap_latency 87.5% regression kernel test robot
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=98f4a7f1-bce7-8e74-c124-7f5183b8cdfc@redhat.com \
--to=llong@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=gurus@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/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®