Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-31 Thread Hans Boehm
If we look at using purely store fences and purely load fences in the initialized flag example as in this discussion, I think it's worth distinguishing too possible scenarios: 1) We guarantee some form of dependency-based ordering, as most real computer architectures do. This probably

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-17 Thread Peter Levart
On 12/17/2014 03:28 AM, David Holmes wrote: On 17/12/2014 10:06 AM, Martin Buchholz wrote: On Thu, Dec 11, 2014 at 1:08 AM, Andrew Haley a...@redhat.com wrote: On 11/12/14 00:53, David Holmes wrote: There are many good uses of storestore in the various lock-free algorithms inside hotspot.

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-17 Thread Peter Levart
On 12/17/2014 10:28 AM, Peter Levart wrote: The example would then become: T1: store x.a - 0 load r - x.a store x.a - r+1 ; store-store store x_init - true T2: load r - x.a ; load-load if (r) store x.a - 42 Sorry the above has an error. I meant: T2: load r - x_init ; load-load if (r)

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-16 Thread Martin Buchholz
On Thu, Dec 11, 2014 at 1:08 AM, Andrew Haley a...@redhat.com wrote: On 11/12/14 00:53, David Holmes wrote: There are many good uses of storestore in the various lock-free algorithms inside hotspot. There may be many uses, but I am extremely suspicious of how good they are. I wonder if we

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-16 Thread David Holmes
On 17/12/2014 10:06 AM, Martin Buchholz wrote: On Thu, Dec 11, 2014 at 1:08 AM, Andrew Haley a...@redhat.com wrote: On 11/12/14 00:53, David Holmes wrote: There are many good uses of storestore in the various lock-free algorithms inside hotspot. There may be many uses, but I am extremely

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-11 Thread Andrew Haley
On 11/12/14 00:53, David Holmes wrote: On 11/12/2014 7:02 AM, Andrew Haley wrote: On 12/05/2014 09:49 PM, Martin Buchholz wrote: The actual implementations of storestore (see below) seem to universally give you the stronger ::release barrier, and it seems likely that hotspot engineers are

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread Martin Buchholz
Today I Leaned that release fence and acquire fence are technical terms defined in the C/C++ 11 standards. So my latest version reads instead: * Ensures that loads and stores before the fence will not be reordered with * stores after the fence; a StoreStore plus LoadStore barrier.

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread Andrew Haley
On 12/05/2014 09:49 PM, Martin Buchholz wrote: The actual implementations of storestore (see below) seem to universally give you the stronger ::release barrier, and it seems likely that hotspot engineers are implicitly relying on that, that some uses of ::storestore in the hotspot sources are

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread David Holmes
On 11/12/2014 3:31 AM, Martin Buchholz wrote: Today I Leaned that release fence and acquire fence are technical terms defined in the C/C++ 11 standards. So my latest version reads instead: * Ensures that loads and stores before the fence will not be reordered with * stores after

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread David Holmes
On 11/12/2014 7:02 AM, Andrew Haley wrote: On 12/05/2014 09:49 PM, Martin Buchholz wrote: The actual implementations of storestore (see below) seem to universally give you the stronger ::release barrier, and it seems likely that hotspot engineers are implicitly relying on that, that some uses

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread Martin Buchholz
On Wed, Dec 10, 2014 at 4:52 PM, David Holmes david.hol...@oracle.com wrote: For the email record, as I have written in the bug report, I think the correction of the semantics for storeFence have resulted in problematic naming where storeFence and loadFence have opposite directionality

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-10 Thread Martin Buchholz
On Wed, Dec 10, 2014 at 1:02 PM, Andrew Haley a...@redhat.com wrote: On 12/05/2014 09:49 PM, Martin Buchholz wrote: The actual implementations of storestore (see below) seem to universally give you the stronger ::release barrier, and it seems likely that hotspot engineers are implicitly

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread Martin Buchholz
On Mon, Dec 8, 2014 at 8:51 PM, David Holmes david.hol...@oracle.com wrote: Then please point me to the common industry definition of it because I couldn't find anything definitive. And as you state yourself above one definition of it - the corresponding C11 fence - does not in fact have the

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread Martin Buchholz
On Mon, Dec 8, 2014 at 8:35 PM, David Holmes david.hol...@oracle.com wrote: So (as you say) with TSO you don't have a total order of stores if you read your own writes out of your own CPU's write buffer. However, my interpretation of multiple-copy atomic is that the initial publishing thread

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-09 Thread David Holmes
On 10/12/2014 4:15 AM, Martin Buchholz wrote: On Mon, Dec 8, 2014 at 8:35 PM, David Holmes david.hol...@oracle.com wrote: So (as you say) with TSO you don't have a total order of stores if you read your own writes out of your own CPU's write buffer. However, my interpretation of multiple-copy

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-08 Thread Martin Buchholz
On Sun, Dec 7, 2014 at 2:58 PM, David Holmes david.hol...@oracle.com wrote: I believe the comment _does_ reflect hotspot's current implementation (entirely from exploring the sources). I believe it's correct to say all of the platforms are multiple-copy-atomic except PPC. ... current hotspot

RE: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-08 Thread David Holmes
PM To: David Holmes Cc: David Holmes; Vladimir Kozlov; core-libs-dev; concurrency-interest Subject: Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics On Sun, Dec 7, 2014 at 2:58 PM, David Holmes david.hol...@oracle.com wrote: I believe

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-08 Thread Martin Buchholz
On Mon, Dec 8, 2014 at 12:46 AM, David Holmes davidchol...@aapt.net.au wrote: Martin, The paper you cite is about ARM and Power architectures - why do you think the lack of mention of x86/sparc implies those architectures are multiple-copy-atomic? Reading some more in the same paper, I

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-08 Thread Martin Buchholz
Webrev updated to remove the comparison with volatile loads and stores. On Sun, Dec 7, 2014 at 2:40 PM, David Holmes david.hol...@oracle.com wrote: On 6/12/2014 7:49 AM, Martin Buchholz wrote: On Thu, Dec 4, 2014 at 5:55 PM, David Holmes david.hol...@oracle.com wrote: In general phrasing

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-08 Thread David Holmes
On 9/12/2014 5:25 AM, Martin Buchholz wrote: Webrev updated to remove the comparison with volatile loads and stores. Thanks. More inline ... On Sun, Dec 7, 2014 at 2:40 PM, David Holmes david.hol...@oracle.com wrote: On 6/12/2014 7:49 AM, Martin Buchholz wrote: On Thu, Dec 4, 2014 at 5:55

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-07 Thread David Holmes
On 6/12/2014 7:49 AM, Martin Buchholz wrote: On Thu, Dec 4, 2014 at 5:55 PM, David Holmes david.hol...@oracle.com wrote: In general phrasing like: also known as a LoadLoad plus LoadStore barrier ... is misleading to me as these are not aliases- the loadFence (in this case) is being specified

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-07 Thread David Holmes
On 6/12/2014 7:29 AM, Martin Buchholz wrote: On Thu, Dec 4, 2014 at 5:36 PM, David Holmes david.hol...@oracle.com wrote: Martin, On 2/12/2014 6:46 AM, Martin Buchholz wrote: Is this finalized then? You can only make one commit per CR. Right. I'd like to commit and then perhaps do another

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-05 Thread Martin Buchholz
On Thu, Dec 4, 2014 at 5:36 PM, David Holmes david.hol...@oracle.com wrote: Martin, On 2/12/2014 6:46 AM, Martin Buchholz wrote: Is this finalized then? You can only make one commit per CR. Right. I'd like to commit and then perhaps do another round of clarifications. I still find this

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-05 Thread Martin Buchholz
On Thu, Dec 4, 2014 at 5:55 PM, David Holmes david.hol...@oracle.com wrote: In general phrasing like: also known as a LoadLoad plus LoadStore barrier ... is misleading to me as these are not aliases- the loadFence (in this case) is being specified to have the same semantics as the

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-04 Thread David Holmes
Martin, On 2/12/2014 6:46 AM, Martin Buchholz wrote: David, Paul (i.e. Reviewers) and Doug, I'd like to commit corrections so we make progress. Is this finalized then? You can only make one commit per CR. I think the current webrev is simple progress with the exception of my attempt to

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-04 Thread David Holmes
On 2/12/2014 6:46 AM, Martin Buchholz wrote: David, Paul (i.e. Reviewers) and Doug, I'd like to commit corrections so we make progress. I think the current webrev is simple progress with the exception of my attempt to translate volatiles into fences, which is marginal (but was a good learning

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-02 Thread Paul Sandoz
On Dec 2, 2014, at 1:58 AM, Doug Lea d...@cs.oswego.edu wrote: On 12/01/2014 03:46 PM, Martin Buchholz wrote: David, Paul (i.e. Reviewers) and Doug, I'd like to commit corrections so we make progress. The current one looks OK to me.

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Stephan Diestelhorst
Am Dienstag, 25. November 2014, 11:15:36 schrieb Hans Boehm: I'm no hardware architect, but fundamentally it seems to me that load x acquire_fence imposes a much more stringent constraint than load_acquire x Consider the case in which the load from x is an L1 hit, but a preceding

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread DT
I see time to time comments in the jvm sources referencing membars and fences. Would you say that they are used interchangeably ? Having the same meaning but for different CPU arch. Sent from my iPhone On Nov 25, 2014, at 6:04 AM, Paul Sandoz paul.san...@oracle.com wrote: Hi Martin,

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Alexander Terekhov
concurrency-inter...@cs.oswego.edu, Martin Buchholz marti...@google.com, core-libs-dev core-libs-dev@openjdk.java.net, dhol...@ieee.org Subject:Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics I basically agree with David's

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Martin Buchholz
Hans, (Thanks for your excellent work on C/C++ 11 and your eternal patience) On Tue, Nov 25, 2014 at 11:15 AM, Hans Boehm bo...@acm.org wrote: It seems to me that a (dubiuously named) loadFence is intended to have essentially the same semantics as the (perhaps slightly less dubiously named)

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Martin Buchholz
David, Paul (i.e. Reviewers) and Doug, I'd like to commit corrections so we make progress. I think the current webrev is simple progress with the exception of my attempt to translate volatiles into fences, which is marginal (but was a good learning exercise for me).

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Hans Boehm
Needless to say, I would clearly also like to see a simple correspondence. But this does raise the interesting question of whether put/get and store(..., memory_order_relaxed)/load(memory_order_relaxed) are intended to have similar semantics. I would guess not, in that the former don't satisfy

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Doug Lea
On 12/01/2014 03:46 PM, Martin Buchholz wrote: David, Paul (i.e. Reviewers) and Doug, I'd like to commit corrections so we make progress. The current one looks OK to me. (http://cr.openjdk.java.net/~martin/webrevs/openjdk9/fence-intrinsics/) -Doug I think the current webrev is simple

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Martin Buchholz
On Mon, Dec 1, 2014 at 1:51 PM, Hans Boehm bo...@acm.org wrote: Needless to say, I would clearly also like to see a simple correspondence. But this does raise the interesting question of whether put/get and store(..., memory_order_relaxed)/load(memory_order_relaxed) are intended to have

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-12-01 Thread Hans Boehm
I think that requiring coherence for ordinary Java accesses would be a performance problem. The pre-2005 Java memory model actually promised it, but implementations ignored that requirement. That was one significant motivation of the 2005 memory model overhaul. The basic problem is that if you

Re: [concurrency-interest] RFR: 8065804: JEP 171:Clarifications/corrections for fence intrinsics

2014-11-27 Thread Doug Lea
On 11/26/2014 09:56 PM, David Holmes wrote: Martin Buchholz writes: On Wed, Nov 26, 2014 at 5:08 PM, David Holmes david.hol...@oracle.com wrote: Please explain why you have changed the defined semantics for storeFence. You have completely reversed the direction of the barrier. Yes. I

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread Martin Buchholz
On Tue, Nov 25, 2014 at 6:04 AM, Paul Sandoz paul.san...@oracle.com wrote: Hi Martin, Thanks for looking into this. 1141 * Currently hotspot's implementation of a Java language-level volatile 1142 * store has the same effect as a storeFence followed by a relaxed store, 1143

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread Martin Buchholz
On Tue, Nov 25, 2014 at 1:41 PM, Andrew Haley a...@redhat.com wrote: On 11/24/2014 08:56 PM, Martin Buchholz wrote: + * Currently hotspot's implementation of a Java language-level volatile + * store has the same effect as a storeFence followed by a relaxed store, + * although that

RE: [concurrency-interest] RFR: 8065804: JEP 171:Clarifications/corrections for fence intrinsics

2014-11-26 Thread David Holmes
Martin Buchholz writes: On Wed, Nov 26, 2014 at 5:08 PM, David Holmes david.hol...@oracle.com wrote: Please explain why you have changed the defined semantics for storeFence. You have completely reversed the direction of the barrier. Yes. I believe the current spec of storeFence was a

RE: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread David Holmes
Can I make an observation about acquire() and release() - to me they are meaningless when considered in isolation. Given their definitions they allow anything to move into a region bounded by acquire() and release(), then you can effectively move the whole program into the region and thus the

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread Martin Buchholz
On Wed, Nov 26, 2014 at 7:00 PM, David Holmes davidchol...@aapt.net.au wrote: Can I make an observation about acquire() and release() - to me they are meaningless when considered in isolation. Given their definitions they allow anything to move into a region bounded by acquire() and release(),

RE: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread David Holmes
Martin writes: On Wed, Nov 26, 2014 at 7:00 PM, David Holmes davidchol...@aapt.net.au wrote: Can I make an observation about acquire() and release() - to me they are meaningless when considered in isolation. Given their definitions they allow anything to move into a region bounded by

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-26 Thread Peter Levart
On 11/27/2014 04:00 AM, David Holmes wrote: Can I make an observation about acquire() and release() - to me they are meaningless when considered in isolation. Given their definitions they allow anything to move into a region bounded by acquire() and release(), then you can effectively move the

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-25 Thread Paul Sandoz
Hi Martin, Thanks for looking into this. 1141 * Currently hotspot's implementation of a Java language-level volatile 1142 * store has the same effect as a storeFence followed by a relaxed store, 1143 * although that may be a little stronger than needed. IIUC to emulate hotpot's

Re: [concurrency-interest] RFR: 8065804: JEP 171: Clarifications/corrections for fence intrinsics

2014-11-25 Thread Andrew Haley
On 11/24/2014 08:56 PM, Martin Buchholz wrote: Hi folks, Review carefully - I am trying to learn about fences by explaining them! I have borrowed some wording from my reviewers! + * Currently hotspot's implementation of a Java language-level volatile + * store has the same effect as

RE: [concurrency-interest] RFR: 8065804: JEP 171:Clarifications/corrections for fence intrinsics

2014-11-25 Thread David Holmes
Stephan Diestelhorst writes: Am Dienstag, 25. November 2014, 11:15:36 schrieb Hans Boehm: I'm no hardware architect, but fundamentally it seems to me that load x acquire_fence imposes a much more stringent constraint than load_acquire x Consider the case in which the load