Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758911AbbFBMoX (ORCPT ); Tue, 2 Jun 2015 08:44:23 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:60349 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752948AbbFBMoP (ORCPT ); Tue, 2 Jun 2015 08:44:15 -0400 Date: Tue, 2 Jun 2015 14:44:01 +0200 From: Ralf Baechle To: Luc Van Oostenryck Cc: Paul Burton , Leonid Yegoshin , linux-mips@linux-mips.org, benh@kernel.crashing.org, will.deacon@arm.com, linux-kernel@vger.kernel.org, markos.chandras@imgtec.com, macro@linux-mips.org, Steven.Hill@imgtec.com, alexander.h.duyck@redhat.com, davem@davemloft.net Subject: Re: [PATCH 1/3] MIPS: R6: Use lightweight SYNC instruction in smp_* memory barriers Message-ID: <20150602124400.GG29986@linux-mips.org> References: <20150602000818.6668.76632.stgit@ubuntu-yegoshin> <20150602000934.6668.43645.stgit@ubuntu-yegoshin> <20150602100835.GG24014@NP-P-BURTON> <20150602121227.GA1474@macpro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150602121227.GA1474@macpro.local> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3384 Lines: 77 On Tue, Jun 02, 2015 at 02:12:29PM +0200, Luc Van Oostenryck wrote: > Date: Tue, 2 Jun 2015 14:12:29 +0200 > From: Luc Van Oostenryck > To: Paul Burton > Cc: Leonid Yegoshin , > linux-mips@linux-mips.org, benh@kernel.crashing.org, will.deacon@arm.com, > linux-kernel@vger.kernel.org, ralf@linux-mips.org, > markos.chandras@imgtec.com, macro@linux-mips.org, Steven.Hill@imgtec.com, > alexander.h.duyck@redhat.com, davem@davemloft.net > Subject: Re: [PATCH 1/3] MIPS: R6: Use lightweight SYNC instruction in > smp_* memory barriers > Content-Type: text/plain; charset=us-ascii > > On Tue, Jun 02, 2015 at 11:08:35AM +0100, Paul Burton wrote: > > Hi Leonid, > > > > > > > > + > > > + If that instructions are not implemented in processor then it is > > > + converted to generic "SYNC 0". > > > > I think this would read better as something like: > > > > If a processor does not implement the lightweight sync operations then > > the architecture requires that they interpret the corresponding sync > > instructions as the typical heavyweight "sync 0". Therefore this > > should be safe to enable on all CPUs implementing release 2 or > > later of the MIPS architecture. > > > > Is it really the case for release 2? > > I'm asking because recently I needed to do something similar and I couldn't > find this garantee in the revision 2.00 of the manual. > May it's just poorly formulated but here is what I find in it: > - "The stype values 1-31 are reserved for future extensions to the architecture." > (ok) > - "A value of zero will always be defined such that it performs all defined > synchronization operations." (ok) > - "Non-zero values may be defined to remove some synchronization operations." > (ok, certainly if we understand the word "weaker" instead of "remove") Yes, "weaker" is what was meant here. > - "As such, software should never use a non-zero value of the stype field, as > this may inadvertently cause future failures if non-zero values remove > synchronization operations." (Mmmm, ok but ...) > Nowhere is there something close to what is found in the revision 5.0 or later: I think that's just a very convoluted way to say non-zero values are reserved and the CPU may bite you and your kittens if you dare to use such values. > "If an implementation does not use one of these non-zero values to define a > different synchronization behavior, then that non-zero value of stype must > act the same as stype zero completion barrier." "We try to be nice to bad code but ... you've been warned!" :-) > The wording may have changed since revision 2.8 but I don't have access to the > corresponding manual. The page about the SYNC instruction has changed significantly over time - the SYNC instruction's documentation manual has grown from one page for the R4000 to four pages for MIPS32 R1 and R2.5 to five pages for MIPS64 R3.02 and newer. R3 added read, write, rw, acquire and release sync types. But the sentence in question exists unchanged even in the R6 manual. Ralf -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/