From: Waiman Long <llong@redhat.com>
To: buckzhang1212 <buckzhang1212@yeah.net>,
"llong@redhat.com" <llong@redhat.com>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"will@kernel.org" <will@kernel.org>,
"boqun.feng@gmail.com" <boqun.feng@gmail.com>,
"linux-kernel@vger.kernel…" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] locking/mutex:add MUTEX_CHCEK_INIT to detect uninitialized mutex lock
Date: Wed, 24 Sep 2025 10:22:39 -0400 [thread overview]
Message-ID: <ad9f8b77-9435-44f6-b316-b6785c9f0089@redhat.com> (raw)
In-Reply-To: <377cba8b.2bd3a.19979cf5b04.Coremail.buckzhang1212@yeah.net>
On 9/23/25 11:40 PM, buckzhang1212 wrote:
> Hey Waiman
> Thank you for your reply.
> I totally agree with you that A mutex must be properly initialized
> before it can be used.
> But my customer engineer often make the mistake like this in TP or
> fingerprint driver.
> I want to warn this mistake at first because it can be used normally
> mostly.
> when enable CONFIG_DEBUG_MUTEXES,we can get more informations.
> This check has provided no additional value and it slows down the
> locking fast path.
> ---- how about move the warning to __mutex_lock_slowpath?
> Can you give me some advices?
As suggested by Peter, additional checks like that should only be
enabled in the debug portion of the code (i.e. within
CONFIG_DEBUG_MUTEXES or other debug kconfig option). The normal way we
test the kernel patches is to build a debug kernel with all the
appropriate debug options enabled and use it for testing purpose as
performance isn't a concern. This enables all the debug code to be
activated and check for correctness. Don't rely your testing just on the
production kernel unless you are testing for some performance related
metrics. Even then, both the debug and production kernels should be used.
Hope this help.
Cheers,
Longman
next prev parent reply other threads:[~2025-09-24 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 2:25 buckzhang1212
2025-09-24 3:10 ` Waiman Long
2025-09-24 6:58 ` Peter Zijlstra
[not found] ` <377cba8b.2bd3a.19979cf5b04.Coremail.buckzhang1212@yeah.net>
2025-09-24 14:22 ` Waiman Long [this message]
2025-09-24 16:15 ` 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=ad9f8b77-9435-44f6-b316-b6785c9f0089@redhat.com \
--to=llong@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=buckzhang1212@yeah.net \
--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®