RFR(M): 8154736: enhancement of cmpxchg and copy_to_survivor for ppc64

Michihiro Horie HORIE at jp.ibm.com
Wed May 23 10:49:07 UTC 2018


Hi David,

I shouldn’t have written Release-Consume even though this wording is known
from C++11.


Consume is currently used for accessing the forwardee: One thread releases,
another thread consumes new_obj.


The place where I would like to change the barriers is the CAS. We don't
need to rely on consume there. The release is the important part.


Best regards,
--
Michihiro,
IBM Research - Tokyo



From:	"Doerr, Martin" <martin.doerr at sap.com>
To:	David Holmes <david.holmes at oracle.com>, Kim Barrett
            <kim.barrett at oracle.com>, Michihiro Horie <HORIE at jp.ibm.com>
Cc:	"hotspot-dev at openjdk.java.net" <hotspot-dev at openjdk.java.net>,
            "hotspot-gc-dev at openjdk.java.net"
            <hotspot-gc-dev at openjdk.java.net>, "Gustavo Bueno Romero"
            <gromero at br.ibm.com>, "ppc-aix-port-dev at openjdk.java.net"
            <ppc-aix-port-dev at openjdk.java.net>
Date:	2018/05/23 18:13
Subject:	RE: RFR(M): 8154736: enhancement of cmpxchg and
            copy_to_survivor for ppc64



Hi David,

Michihiro's change does not rely on Consume AFAICS. Only existing code
does.

The CAS is not in the path between "new_obj = o->forwardee();" and the
usage of new_obj.
So the CAS' barrier won't help. There's just ordering by "Consume".

The other thread's CAS (which has set the _mark field) currently has a
post-barrier which won't help the reading thread, either.

Michihiro's change relies on the ordering of the CAS with respect to
"new_obj = o->forwardee();" by accessing the same memory location "_mark"
which is ensured by memory coherency.
And it relies on that compilers don't speculatively load o->forwardee()
before the CAS which is ensured by the integrated compiler barriers
(clobber "memory" in the volatile inline asm code). And it is also
prevented because _mark is declared volatile.

Best regards,
Martin


-----Original Message-----
From: David Holmes [mailto:david.holmes at oracle.com]
Sent: Mittwoch, 23. Mai 2018 10:36
To: Doerr, Martin <martin.doerr at sap.com>; Kim Barrett
<kim.barrett at oracle.com>; Michihiro Horie <HORIE at jp.ibm.com>
Cc: hotspot-dev at openjdk.java.net; hotspot-gc-dev at openjdk.java.net; Gustavo
Bueno Romero <gromero at br.ibm.com>; ppc-aix-port-dev at openjdk.java.net
Subject: Re: RFR(M): 8154736: enhancement of cmpxchg and copy_to_survivor
for ppc64

On 22/05/2018 8:16 PM, Doerr, Martin wrote:
> Hi Kim,
>
> I can't see how a new implicit consume is introduced by Michihiro's
change. He just explained how the existing code works.
>
> If implicit consume has been rejected the current code is wrong:
> "new_obj = o->forwardee();" would need some kind of barrier before using
the new_obj.

But if forwardee is set by a CAS with (default) full bi-directional
fence we have that barrier. The argument is that such a strong barrier
can be relaxed yet maintain correctness - isn't it?

David


> But this issue is not related to what Michihiro wants to change AFAICS.
>
> Best regards,
> Martin
>
>
> -----Original Message-----
> From: ppc-aix-port-dev [mailto:ppc-aix-port-dev-bounces at openjdk.java.net]
On Behalf Of Kim Barrett
> Sent: Montag, 21. Mai 2018 06:00
> To: Michihiro Horie <HORIE at jp.ibm.com>
> Cc: hotspot-dev at openjdk.java.net; hotspot-gc-dev at openjdk.java.net;
Gustavo Bueno Romero <gromero at br.ibm.com>;
ppc-aix-port-dev at openjdk.java.net; david.holmes at oracle.com
> Subject: Re: RFR(M): 8154736: enhancement of cmpxchg and copy_to_survivor
for ppc64
>
>> On May 18, 2018, at 5:12 PM, Michihiro Horie <HORIE at jp.ibm.com> wrote:
>>
>> Dear all,
>>
>> I update the webrev:
http://cr.openjdk.java.net/~mhorie/8154736/webrev.09/

>>
>> With the release barrier before the CAS, new_obj can be observed from
other threads. If the CAS succeeds, the current thread can use new_obj
without barriers. If the CAS fails, "o->forwardee()" is ordered with
respect to CAS by accessing the same memory location "_mark", so no
barriers needed. The order of (1) access to the forwardee and (2) access to
forwardee's fields is preserved due to Release-Consume ordering on
supported platforms. (The ordering between "new_obj = o->forwardee();" and
logging or other usages is not changed.)
>>
>> Regarding the maintainability, the requirement is CAS
(memory_order_release) as Release-Consume to be consistent with C++11. This
requirement is necessary when a weaker platform like DEC Alpha is to be
supported. On currently supported platforms, code change can be safe if the
code meats this requirement (and the order of (1) access to the forwardee
and (2) access to forwardee's fields is the natural way of coding).
>
> Relying on implicit consume has been been discussed and rejected, in
> the earlier thread on this topic and I think elsewhere too.
>
>
http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2016-October/021538.html

>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20180523/346868ca/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20180523/346868ca/graycol.gif>


More information about the hotspot-gc-dev mailing list