[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ad9f8b77-9435-44f6-b316-b6785c9f0089@redhat.com>
Date: Wed, 24 Sep 2025 10:22:39 -0400
From: Waiman Long <llong@...hat.com>
To: buckzhang1212 <buckzhang1212@...h.net>,
"llong@...hat.com" <llong@...hat.com>
Cc: "peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>, "will@...nel.org" <will@...nel.org>,
"boqun.feng@...il.com" <boqun.feng@...il.com>,
linux-kernel@...r.kernel…
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] locking/mutex:add MUTEX_CHCEK_INIT to detect
uninitialized mutex lock
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
Powered by blists - more mailing lists