From: "J. R. Okajima" <hooanon05g@gmail.com>
To: peterz@infradead.org, penguin-kernel@I-love.SAKURA.ne.jp
Cc: linux-kernel@vger.kernel.org
Subject: LOCKDEP customizable numbers upper limit
Date: Thu, 13 May 2021 22:39:51 +0900 [thread overview]
Message-ID: <30795.1620913191@jrobl> (raw)
Hello,
According to the commit in v5.13-rc1,
5dc33592e9553 2021-04-05 lockdep: Allow tuning tracing capacity constants.
several lockdep numbers have their own range as 10--30.
But if we set all 30s, we got a compilation error.
kernel/locking/lockdep.c:3536:2: note: in expansion of macro 'BUILD_BUG_ON'
BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
kernel/locking/lockdep.c
----------------------------------------
static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS];
:::
BUILD_BUG_ON((1UL << 24) <= ARRAY_SIZE(chain_hlocks));
:::
----------------------------------------
MAX_LOCKDEP_CHAIN_HLOCKS is defined in kernel/locking/lockdep_internal.h
as this.
#define MAX_LOCKDEP_CHAINS_BITS CONFIG_LOCKDEP_CHAINS_BITS
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
I don't know what this 'multiply by 5' means and why
ARRAY_SIZE(chain_hlocks) is limited to (1UL << 24), but setting 30 to
CONFIG_LOCKDEP_CHAINS_BITS obviously causes BUILD_BUG.
'*5' is more than 2 bits shift, so CONFIG_LOCKDEP_CHAINS_BITS has to be
less than (24-2), limited to the range 10--21.
Hmm, I tried.
CONFIG_LOCKDEP_BITS=30
CONFIG_LOCKDEP_CHAINS_BITS=21
CONFIG_LOCKDEP_STACK_TRACE_BITS=30
CONFIG_LOCKDEP_STACK_TRACE_HASH_BITS=30
CONFIG_LOCKDEP_CIRCULAR_QUEUE_BITS=30
Arg, LD failed.
ld: kernel/locking/lockdep.o: in function `lockdep_hlock_class':
lockdep.c:(.text+0x84f): relocation truncated to fit: R_X86_64_PC32 against `.bss'
I am afraid these LOCKDEP configurations need some sort of balancing.
J. R. Okajima
next reply other threads:[~2021-05-13 13:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 13:39 J. R. Okajima [this message]
2021-05-13 14:27 ` LOCKDEP customizable numbers upper limit Tetsuo Handa
2021-05-14 18:22 ` PATCH: " hooanon05g
2021-05-14 22:41 ` Tetsuo Handa
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=30795.1620913191@jrobl \
--to=hooanon05g@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--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;
as well as URLs for NNTP newsgroup(s).