From: Waiman Long <longman@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2] locking/rwsem: Add DEBUG_RWSEMS to look for lock/unlock mismatches
Date: Tue, 27 Mar 2018 09:59:53 -0400 [thread overview]
Message-ID: <72b8a73c-bfc0-5884-199d-349ee3311802@redhat.com> (raw)
In-Reply-To: <20180327060655.25zjgqlgbfsp6b3p@gmail.com>
On 03/27/2018 02:06 AM, Ingo Molnar wrote:
> * Waiman Long <longman@redhat.com> wrote:
>
>> For a rwsem, locking can either be exclusive or shared. The corresponding
>> exclusive or shared unlock must be used. Otherwise, the protected data
>> structures may get corrupted or the lock may be in an inconsistent state.
>>
>> In order to detect such anomaly, a new configuration option DEBUG_RWSEMS
>> is added which can be enabled to look for such mismatches and print
>> warnings that that happens.
>> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>> index 64155e3..0958192 100644
>> --- a/lib/Kconfig.debug
>> +++ b/lib/Kconfig.debug
>> @@ -1075,6 +1075,13 @@ config DEBUG_WW_MUTEX_SLOWPATH
>> even a debug kernel. If you are a driver writer, enable it. If
>> you are a distro, do not.
>>
>> +config DEBUG_RWSEMS
>> + bool "RW Semaphore debugging: basic checks"
>> + depends on DEBUG_KERNEL && RWSEM_SPIN_ON_OWNER
>> + help
>> + This feature allows mismatched rw semaphore locks and unlocks
>> + to be detected and reported.
>> +
> Makes sense - but this should also be integrated into the rest of lock debugging
> Kconfig hierarchy similar to DEBUG_MUTEXES: i.e. DEBUG_LOCK_ALLOC, PROVE_LOCKING,
> etc. should select this new lock debugging option as well.
>
> People generally are not supposed to know and configure the finer details,
> CONFIG_LOCK_DEBUGGING=y is a one-stop-shop in this regard.
I can add a patch to rework lock debugging configuration code. Do you
want to hide the individual config options but still allow them to be
enabled manually? Alternatively we can also just add a master lock
debugging option to select them all.
Cheers,
Longman
next prev parent reply other threads:[~2018-03-27 13:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 19:17 Waiman Long
2018-03-27 6:06 ` Ingo Molnar
2018-03-27 13:59 ` Waiman Long [this message]
2018-03-27 15:54 ` Davidlohr Bueso
2018-03-27 19:56 ` Ingo Molnar
2018-03-27 20:37 ` Waiman Long
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=72b8a73c-bfc0-5884-199d-349ee3311802@redhat.com \
--to=longman@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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®