RFR(M): 8234599: PPC64: Add support on recent CPUs and Linux for JEP-352

Gustavo Romero gromero at linux.vnet.ibm.com
Wed Dec 11 00:04:31 UTC 2019


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/MappedByteBuffer/PmemTest.java
[4] https://github.com/jhalliday/mashona


More information about the hotspot-compiler-dev mailing list