From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807AbdBVMJI (ORCPT ); Wed, 22 Feb 2017 07:09:08 -0500 Received: from merlin.infradead.org ([205.233.59.134]:35118 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754773AbdBVMI4 (ORCPT ); Wed, 22 Feb 2017 07:08:56 -0500 Date: Wed, 22 Feb 2017 13:08:49 +0100 From: Peter Zijlstra To: Stafford Horne Cc: Jonas Bonn , Stefan Kristiansson , linux@roeck-us.net, openrisc@lists.librecores.org, linux-kernel@vger.kernel.org, Ingo Molnar Subject: Re: [PATCH v3 10/25] openrisc: add spinlock implementation Message-ID: <20170222120849.GR6536@twins.programming.kicks-ass.net> References: <9ec913b47790e9412d5b71a5fc52794ce4ebafb9.1487702890.git.shorne@gmail.com> <20170222114117.GR6515@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170222114117.GR6515@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 22, 2017 at 12:41:17PM +0100, Peter Zijlstra wrote: > On Wed, Feb 22, 2017 at 04:11:39AM +0900, Stafford Horne wrote: > > +static inline void arch_spin_unlock(arch_spinlock_t *lock) > > +{ > > + smp_mb(); > > + lock->tickets.owner++; > > +} > > This is putting a lot of trust in the compiler, nothing is volatile so > it can do horrible things. Also, your architecture manual seems to not explicitly mention how l.lwa/l.swa interact with overlapping l.sh. In fact, I can read the text such that its done 'wrong'. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Date: Wed, 22 Feb 2017 13:08:49 +0100 Subject: [OpenRISC] [PATCH v3 10/25] openrisc: add spinlock implementation In-Reply-To: <20170222114117.GR6515@twins.programming.kicks-ass.net> References: <9ec913b47790e9412d5b71a5fc52794ce4ebafb9.1487702890.git.shorne@gmail.com> <20170222114117.GR6515@twins.programming.kicks-ass.net> Message-ID: <20170222120849.GR6536@twins.programming.kicks-ass.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Wed, Feb 22, 2017 at 12:41:17PM +0100, Peter Zijlstra wrote: > On Wed, Feb 22, 2017 at 04:11:39AM +0900, Stafford Horne wrote: > > +static inline void arch_spin_unlock(arch_spinlock_t *lock) > > +{ > > + smp_mb(); > > + lock->tickets.owner++; > > +} > > This is putting a lot of trust in the compiler, nothing is volatile so > it can do horrible things. Also, your architecture manual seems to not explicitly mention how l.lwa/l.swa interact with overlapping l.sh. In fact, I can read the text such that its done 'wrong'.