RFR(M): 8234599: PPC64: Add support on recent CPUs and Linux for JEP-352
Doerr, Martin
martin.doerr at sap.com
Wed Dec 11 16:55:23 UTC 2019
Hi Gustavo,
thanks for implementing it. Unfortunately, we can't test it at the moment.
I have a few change requests:
macroAssembler_ppc.cpp
I don't like silently emitting nothing in case !VM_Version::supports_data_cache_line_flush().
If you want to check for it, I suggest to assert VM_Version::supports_data_cache_line_flush() and avoid generating the stub otherwise (stubGenerator_ppc).
ppc.ad
The predicates are redundant and should better get removed (useless evaluation).
cacheWBPreSync could use cost 0 for clearity. (The costs don't have any effect because there is no choice for the matcher.)
stubGenerator_ppc.cpp
I think checking cmpwi(... is_presync, 1) is ok because the ABI specifies that "bool true" is one Byte with the value 1 and the C calling convention enforces extension to 8 Byte.
I would have used andi_ + bne to be on the safe side, but I believe your version is ok.
Comment "// post sync => emit 'lwsync'" is wrong. We use 'sync'.
Best regards,
Martin
> -----Original Message-----
> From: Gustavo Romero <gromero at linux.vnet.ibm.com>
> Sent: Mittwoch, 11. Dezember 2019 01:05
> Cc: Andrew Dinn <adinn at redhat.com>; Baesken, Matthias
> <matthias.baesken at sap.com>; Doerr, Martin <martin.doerr at sap.com>;
> hotspot-compiler-dev at openjdk.java.net
> Subject: RFR(M): 8234599: PPC64: Add support on recent CPUs and Linux for
> JEP-352
>
> Hi,
>
> Could the following change be reviewed please?
>
> Bug : https://bugs.openjdk.java.net/browse/JDK-8234599
> Webrev: http://cr.openjdk.java.net/~gromero/8234599/v1/
>
> POWER9 does not have any cache management or barrier instructions aimed
> specifically to deal with persistent memory (NVDIMM), hence in Power ISA
> v3.0
> there are no instructions like data cache flush/store or sync instructions
> specific to persistent memory. Nonetheless, in some cases (like through
> hardware
> emulation) POWER9 can support NVDIMM and if Linux supports DAX (direct
> mapping of
> persisnt memory) and a /dev/pmem device is available it's possible to use
> data
> cache and sync instructions in the ISA (which are not explicitly aimed to
> persistent memory) on a memory region backed by DAX, i.e. mapped using
> new
> mmap() flag MAP_SYNC for persistent memory), so these instructions will
> have the
> same semantics as the instructions for data cache flush / store and sync on
> other architectures supporting NVDIMM and that have explicit instructions to
> deal
> with persistent memory.
>
> This change adds support for JEP-352 on POWER9 using 'dcbst' plus a sync
> instruction to sync data to a memory backed by DAX (to persistent memory)
> when
> that's required.
>
> Moreover, that change also paves the way for supporting NVDIMM on
> future
> Power CPUs that might have new data cache management and barrier
> instructions
> explicitly to deal with persistent memory.
>
> The change was developed and tested using a P9 QEMU VM (emulation)
> with NVDIMM
> support. For details on how to setup a proper QEMU + Linux kernel w/ a
> /dev/pmem
> device configured please see recipe in [2].
>
> The JVM on a POWER9 machine with a /dev/pmem device properly set and
> with that
> change applied is able to pass the test for JEP-352 [3]. The JVM is also able
> to pass all tests of Mashona library [4].
>
> When DAX is not supported, like on POWER8 and POWER9 w/o DAX support,
> OS won't
> support mmap()'s MAP_SYNC flag, so kernel will return EOPNOTSUP when
> code will
> try to allocate memory backed by a persistent memory device, so the JVM
> will get
> a "java.io.IOException: Operation not supported". Naturally, on machines
> that don't support writebacks or pmem supports_data_cache_line_flush()
> will
> return false, but even in that case JVM will hit a EOPNOTSUPP and get a
> "java.io.IOException: Operation not supported" sooner than it has the
> chance to
> try to emit any writeback + sync instructions.
>
> Thank you.
>
> Best regards,
> Gustavo
>
> [1] http://man7.org/linux/man-pages/man2/mmap.2.html
> [2] https://github.com/gromero/nvdimm
> [3]
> http://hg.openjdk.java.net/jdk/jdk/file/336885e766af/test/jdk/java/nio/Ma
> ppedByteBuffer/PmemTest.java
> [4] https://github.com/jhalliday/mashona
More information about the hotspot-compiler-dev
mailing list