mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org, Waiman Long <longman@redhat.com>
Subject: [PATCH] locking/lockdep: Make MAX_STACK_TRACE_ENTRIES configurable
Date: Wed, 23 Aug 2017 14:18:58 -0400	[thread overview]
Message-ID: <1503512338-25312-1-git-send-email-longman@redhat.com> (raw)

A "BUG: MAX_STACK_TRACE_ENTRIES too low!" error was hit when running a
networking test on a 4.11 kernel. So even 512k of stack trace entries
wasn't enough in this case.

Instead of hardcoding a larger MAX_STACK_TRACE_ENTRIES value,
it is now made to be dependent on a new kernel configuration entry
LOCKDEP_MAX_STACK_TRACE_ENTRIES so that kernel builders can configure
a proper value depending on how the kernel is being used.

The default for this new config option is the same as the current
value - 256k if LOCKDEP_SMALL and 512k otherwise.

Signed-off-by: Waiman Long <longman@redhat.com>
---
 kernel/locking/lockdep_internals.h |  6 ++++++
 lib/Kconfig.debug                  | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_internals.h
index 1da4669..0873e9b 100644
--- a/kernel/locking/lockdep_internals.h
+++ b/kernel/locking/lockdep_internals.h
@@ -77,6 +77,12 @@ enum {
 #define MAX_STACK_TRACE_ENTRIES	524288UL
 #endif
 
+#ifdef CONFIG_LOCKDEP_MAX_STACK_TRACE_ENTRIES
+#undef MAX_STACK_TRACE_ENTRIES
+#define MAX_STACK_TRACE_ENTRIES	\
+	((unsigned long)CONFIG_LOCKDEP_MAX_STACK_TRACE_ENTRIES)
+#endif
+
 #define MAX_LOCKDEP_CHAINS	(1UL << MAX_LOCKDEP_CHAINS_BITS)
 
 #define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index ee9e534..0e8fc4e 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1230,6 +1230,18 @@ config WW_MUTEX_SELFTEST
 	  Say M if you want these self tests to build as a module.
 	  Say N if you are unsure.
 
+# Allow 256k - 4M of lockdep stack trace entries
+config LOCKDEP_MAX_STACK_TRACE_ENTRIES
+	int "Maximum number of lockdep stack trace entries" if LOCKDEP
+	range 262144 4194304
+	default "262144" if LOCKDEP_SMALL
+	default "524288" if !LOCKDEP_SMALL
+	---help---
+	  This specifies the maximum number of lockdep stack trace
+	  entries that can be used by the locking correctness
+	  validator.  If this limit is exceeded, the validator will
+	  be turned off.
+
 endmenu # lock debugging
 
 config TRACE_IRQFLAGS
-- 
1.8.3.1

                 reply	other threads:[~2017-08-23 18:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1503512338-25312-1-git-send-email-longman@redhat.com \
    --to=longman@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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®