From: Peter Zijlstra Subject: Re: [PATCH v7 1/5] locking/qspinlock: Rename mcs lock/unlock macros and make them more generic Date: Wed, 22 Jan 2020 10:15:47 +0100 Message-ID: <20200122091547.GU14879@hirez.programming.kicks-ass.net> References: <20191125210709.10293-1-alex.kogan@oracle.com> <20191125210709.10293-2-alex.kogan@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20191125210709.10293-2-alex.kogan@oracle.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane-mx.org@lists.infradead.org To: Alex Kogan Cc: linux-arch@vger.kernel.org, guohanjun@huawei.com, arnd@arndb.de, dave.dice@oracle.com, jglauber@marvell.com, x86@kernel.org, will.deacon@arm.com, linux@armlinux.org.uk, steven.sistare@oracle.com, linux-kernel@vger.kernel.org, rahul.x.yadav@oracle.com, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, longman@redhat.com, tglx@linutronix.de, daniel.m.jordan@oracle.com, linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org On Mon, Nov 25, 2019 at 04:07:05PM -0500, Alex Kogan wrote: > --- a/arch/arm/include/asm/mcs_spinlock.h > +++ b/arch/arm/include/asm/mcs_spinlock.h > @@ -6,7 +6,7 @@ > #include > > /* MCS spin-locking. */ > -#define arch_mcs_spin_lock_contended(lock) \ > +#define arch_mcs_spin_lock(lock) \ > do { \ > /* Ensure prior stores are observed before we enter wfe. */ \ > smp_mb(); \ > @@ -14,9 +14,9 @@ do { \ > wfe(); \ > } while (0) \ > > -#define arch_mcs_spin_unlock_contended(lock) \ > +#define arch_mcs_pass_lock(lock, val) \ > do { \ > - smp_store_release(lock, 1); \ > + smp_store_release((lock), (val)); \ > dsb_sev(); \ > } while (0) So I hate those names; it used to be clear this was the contended path, not so anymore. arch_mcs_spin_lock() in particular is grossly misnamed now. 's/arch_mcs_spin_lock/arch_mcs_spin_wait/g' could perhaps work, if you really want to get rid of the _contended suffix. Also, pass_lock seems unfortunately named...