guarantee RTMSpinLoopCount > 0
Gustavo Romero
gromero at linux.vnet.ibm.com
Thu Dec 15 14:05:08 UTC 2016
Hi Martin,
On 13-12-2016 08:38, Doerr, Martin wrote:
> Btw. RTMSpinLoopCount = 0 leads to the same behavior as RTMSpinLoopCount = 1 on x86. Maybe it's a bug and should better be " movptr(scr_Reg, RTMSpinLoopCount + 1)".
> I think this was the reason for not supporting the value 0 on PPC64.
> Checking for "if (RTMSpinLoopCount > 1)" would be more reasonable in my code below.
hmm, right. Well, anyway I understood that we've decided to follow x64's
behavior, so I used RTMSpinLoopCount > 1 as you suggested.
I also changed a nit on input description: s/box_Reg/owner_addr_Reg/.
And thought it would be a good idea to not exit abruptly if RTMSpinLoopCount < 0
is passed, so I set RTMSpinLoopCount = 0 issuing a warning to the user in that
case.
One thing that caught my attention is the use of smt_yield(), because in an
internal discussion I've learned that yield, mdoio, and mdoom are not
implemented on POWER8 (although listed in the ISA 2.07). The toolchain team
suggested an or 31,31,31 instead for setting low priority in that case. But,
of course, it's another story and since smt_yield() use is restricted to the RTM
feature we can discuss that in another thread (I'll experiment a little on it by
myself and report back).
Finally, do you know exactly what marks (if anything formal) the transition from
an experimental JVM feature (like RTM in general) to a non-experimental one?
I filed a bug here: https://bugs.openjdk.java.net/browse/JDK-8171266
and updated a "draft" webrev here: http://cr.openjdk.java.net/~gromero/8171266/0/
Thank you.
Regards,
Gustavo
>
> -----Original Message-----
> From: ppc-aix-port-dev [mailto:ppc-aix-port-dev-bounces at openjdk.java.net] On Behalf Of Doerr, Martin
> Sent: Dienstag, 13. Dezember 2016 11:21
> To: Gustavo Romero <gromero at linux.vnet.ibm.com>; ppc-aix-port-dev at openjdk.java.net
> Subject: RE: guarantee RTMSpinLoopCount > 0
>
> Hi Gustavo,
>
> I think it's good to support RTMSpinLoopCount = 0.
> I'd simply not generate the loop code in this case:
>
> if (RTMSpinLoopCount > 0) {
> li(R0, RTMSpinLoopCount);
> mtctr(R0);
> }
>
> if (RTMSpinLoopCount > 0) {
> bdz(retryLabel);
> ld(R0, 0, owner_addr_Reg);
> cmpdi(CCR0, R0, 0);
> bne(CCR0, SpinLoop);
> }
>
> Generated RTM code is already very large so making it shorter sounds good :-)
>
> Thanks and best regards,
> Martin
>
>
> -----Original Message-----
> From: ppc-aix-port-dev [mailto:ppc-aix-port-dev-bounces at openjdk.java.net] On Behalf Of Gustavo Romero
> Sent: Dienstag, 13. Dezember 2016 00:01
> To: ppc-aix-port-dev at openjdk.java.net
> Subject: guarantee RTMSpinLoopCount > 0
>
> Hi!
>
> Jtreg test hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java is failing on POWER8 due to the guarantee in
>
> http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/88847a1b3718#l21.110
>
> hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java uses
> -XX:RTMSpinLoopCount=0 and so the JVM exit in one occasion through VMError::report_and_die().
>
> x64 seems to not have that restriction since it checks for RTMSpinLoopCount less or equal to zero:
>
> http://hg.openjdk.java.net/jdk9/hs/hotspot/file/3b4e4dbb855d/src/cpu/x86/vm/macroAssembler_x86.cpp#l1457
>
> Could we do the same check on PPC64, i.e. in
> http://hg.openjdk.java.net/jdk9/hs/hotspot/file/3b4e4dbb855d/src/cpu/ppc/vm/macroAssembler_ppc.cpp#l2585
>
> check for a less or equal on decrement and guarantee(RTMSpinLoopCount >= 0) instead?
>
> Thanks.
>
> Gustavo
>
More information about the ppc-aix-port-dev
mailing list