Re: [PATCH] mm/kasan: make quarantine_lock a raw_spinlock_t

From: Peter Zijlstra
Date: Sat Oct 13 2018 - 09:51:13 EST


On Fri, Oct 12, 2018 at 04:56:55PM -0700, Andrew Morton wrote:
> There are several reasons for using raw_*, so an explanatory comment at
> each site is called for.
>
> However it would be smarter to stop "using raw_* for several reasons".
> Instead, create a differently named variant for each such reason. ie, do
>
> /*
> * Nice comment goes here. It explains all the possible reasons why -rt
> * might use a raw_spin_lock when a spin_lock could otherwise be used.
> */
> #define raw_spin_lock_for_rt raw_spinlock
>
> Then use raw_spin_lock_for_rt() at all such sites.

The whole raw_spinlock_t is for RT, no other reason. It is the one true
spinlock.

>From this, it naturally follows that:

- nesting order: raw_spinlock_t < spinlock_t < mutex_t
- raw_spinlock_t sections must be bounded

The patch under discussion is the result of the nesting order rule; and
is allowed to violate the second rule, by virtue of it being debug code.

There are no other reasons; and I'm somewhat confused by what you
propose.