[lkml]   [2018]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] locking/rwsem: Add DEBUG_RWSEMS to look for lock/unlock mismatches

* Waiman Long <> 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"
> + 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.



 \ /
  Last update: 2018-03-27 08:08    [W:0.105 / U:3.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site