From: Peter Zijlstra Subject: Re: [PATCH] mm/kasan: make quarantine_lock a raw_spinlock_t Date: Sat, 13 Oct 2018 15:50:58 +0200 Message-ID: <20181013135058.GC4931@worktop.programming.kicks-ass.net> References: <20181005163320.zkacovxvlih6blpp@linutronix.de> <20181009142742.ikh7xv2dn5skjjbe@linutronix.de> <20181010092929.a5gd3fkkw6swco4c@linutronix.de> <20181010095343.6qxved3owi6yokoa@linutronix.de> <20181010214945.5owshc3mlrh74z4b@linutronix.de> <20181012165655.f067886428a394dc7fbae7af@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sebastian Andrzej Siewior , Dmitry Vyukov , Clark Williams , Alexander Potapenko , kasan-dev , Linux-MM , LKML , linux-rt-users@vger.kernel.org, Thomas Gleixner To: Andrew Morton Return-path: Content-Disposition: inline In-Reply-To: <20181012165655.f067886428a394dc7fbae7af@linux-foundation.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-rt-users.vger.kernel.org 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.