All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Paul Burton <paul.burton@imgtec.com>,
	Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>,
	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
Date: Tue, 2 Jun 2015 14:44:01 +0200	[thread overview]
Message-ID: <20150602124400.GG29986@linux-mips.org> (raw)
In-Reply-To: <20150602121227.GA1474@macpro.local>

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 <luc.vanoostenryck@gmail.com>
> To: Paul Burton <paul.burton@imgtec.com>
> Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>,
>  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,
> > 
> 
> <snip>
> 
> > > +
> > > +	  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

  reply	other threads:[~2015-06-02 12:44 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02  0:09 [PATCH 0/3] MIPS: SMP memory barriers: lightweight sync, acquire-release Leonid Yegoshin
2015-06-02  0:09 ` Leonid Yegoshin
2015-06-02  0:09 ` [PATCH 1/3] MIPS: R6: Use lightweight SYNC instruction in smp_* memory barriers Leonid Yegoshin
2015-06-02  0:09   ` Leonid Yegoshin
2015-06-02 10:08   ` Paul Burton
2015-06-02 10:08     ` Paul Burton
2015-06-02 12:12     ` Luc Van Oostenryck
2015-06-02 12:44       ` Ralf Baechle [this message]
2015-06-02 18:20       ` Leonid Yegoshin
2015-06-02 18:20         ` Leonid Yegoshin
2015-06-02 10:48   ` James Hogan
2015-06-02 10:48     ` James Hogan
2015-06-02 16:15     ` Maciej W. Rozycki
2015-06-02 23:56       ` David Daney
2015-06-03  1:56         ` Leonid Yegoshin
2015-06-03  1:56           ` Leonid Yegoshin
2015-06-05 13:10   ` Ralf Baechle
2015-06-05 21:18     ` Maciej W. Rozycki
2016-01-28  2:28     ` Joshua Kinard
2016-01-29 13:32       ` Maciej W. Rozycki
2016-01-29 13:32         ` Maciej W. Rozycki
2016-01-30 16:25         ` Joshua Kinard
2015-06-02  0:09 ` [PATCH 2/3] MIPS: enforce LL-SC loop enclosing with SYNC (ACQUIRE and RELEASE) Leonid Yegoshin
2015-06-02  0:09   ` Leonid Yegoshin
2015-06-02 11:39   ` James Hogan
2015-06-02 11:39     ` James Hogan
2015-06-02 18:43     ` Leonid Yegoshin
2015-06-02 18:43       ` Leonid Yegoshin
2015-06-02 18:53       ` Leonid Yegoshin
2015-06-02  0:09 ` [PATCH 3/3] MIPS: bugfix - replace smp_mb with release barrier function in unlocks Leonid Yegoshin
2015-06-02  0:09   ` Leonid Yegoshin
2015-06-02 11:42   ` James Hogan
2015-06-02 11:42     ` James Hogan
2015-06-02 13:22     ` Ralf Baechle
2015-06-02  8:41 ` [PATCH 0/3] MIPS: SMP memory barriers: lightweight sync, acquire-release Joshua Kinard
2015-06-02  9:59   ` Ralf Baechle
2015-06-02 18:59     ` Joshua Kinard
2015-06-02 19:19       ` Ralf Baechle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150602124400.GG29986@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=Leonid.Yegoshin@imgtec.com \
    --cc=Steven.Hill@imgtec.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=macro@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=paul.burton@imgtec.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.