RTM disabled for Linux on PPC64 LE

Doerr, Martin martin.doerr at sap.com
Fri Feb 12 14:52:54 UTC 2016


Hi Gustavo,

the reason why we disabled RTM for linux on PPC64 (big or little endian) was the problematic behavior of syscalls.
The old version of the document
www.kernel.org/doc/Documentation/powerpc/transactional_memory.txt
said:
“Performing syscalls from within transaction is not recommended, and can lead to unpredictable results.“

Transactions need to either pass completely or roll back completely without disturbing side effects of partially executed syscalls.
We rely on the kernel to abort transactions if necessary.

The document has changed and it may possibly work with a new linux kernel.
However, we don't have such a new kernel, yet. So we can't test it at the moment.
I don't know which kernel version exactly contains the change. I guess this exact version number (major + minor) should be used for enabling RTM.

I haven't looked into the tests, yet. There may be a need for additional adaptations and fixes.

We appreciate if you make experiments and/or contributions.

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: Freitag, 12. Februar 2016 14:45
To: hotspot-dev at openjdk.java.net; ppc-aix-port-dev at openjdk.java.net
Subject: RTM disabled for Linux on PPC64 LE
Importance: High

Hi,
As of now (tip 1922:be58b02c11f9, jdk9/jdk9 repo) Hotspot build for Linux on ppc64le of fails due to a simple uninitialized variable error:

hotspot/src/share/vm/ci/ciMethodData.hpp:585:100:       error: ‘data’ may be used uninitialized in this function
hotspot/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp:2408:78: error: ‘md’   may be used uninitialized in this function

So this straightforward patch solves the issue:
 diff -r 534c50395957 src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp
--- a/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp	Thu Jan 28 15:42:23 2016 -0800
+++ b/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp	Mon Feb 08 17:13:14 2016 -0200
@@ -2321,8 +2321,8 @@
     if (reg_conflict) { obj = dst; }
   }
 -  ciMethodData* md;
-  ciProfileData* data;
+  ciMethodData* md = NULL;
+  ciProfileData* data = NULL;
   int mdo_offset_bias = 0; compiler/rtm
   if (should_profile) {
     ciMethod* method = op->profiled_method();

However, after the build, I realized that RTM is still disabled for Linux on ppc64le, failing 25 tests on compiler/rtm suite:

http://hastebin.com/raw/ohoxiwaqih

Hence after applying the following patches that enable RTM for Linux on ppc64le:

diff -r 266fa9bb5297 src/cpu/ppc/vm/vm_version_ppc.cpp
--- a/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu Feb 04 16:48:39 2016 -0800
+++ b/src/cpu/ppc/vm/vm_version_ppc.cpp	Fri Feb 12 10:55:46 2016 -0200
@@ -255,7 +255,9 @@
     }
 #endif
 #ifdef linux
-    // TODO: check kernel version (we currently have too old versions only)
+    if (os::Linux::os_version() >= 4) { // at least Linux kernel version 4
+      os_too_old = false;
+    }
 #endif
     if (os_too_old) {
       vm_exit_during_initialization("RTM is not supported on this OS version.");


diff -r 266fa9bb5297 src/os/linux/vm/os_linux.cpp
--- a/src/os/linux/vm/os_linux.cpp	Thu Feb 04 16:48:39 2016 -0800
+++ b/src/os/linux/vm/os_linux.cpp	Fri Feb 12 10:58:10 2016 -0200
@@ -135,6 +135,7 @@
 int os::Linux::_page_size = -1;
 const int os::Linux::_vm_default_page_size = (8 * K);
 bool os::Linux::_supports_fast_thread_cpu_time = false;
+uint32_t os::Linux::_os_version = 0;
 const char * os::Linux::_glibc_version = NULL;
 const char * os::Linux::_libpthread_version = NULL;
 pthread_condattr_t os::Linux::_condattr[1];
@@ -4332,6 +4333,21 @@
   return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
 }
 +void os::Linux::initialize_os_info() {
+  assert(_os_version == 0, "OS info already initialized");
+
+  struct utsname _uname;
+  +  uname(&_uname); // Not sure yet how deal if ret == -1
+  _os_version = atoi(_uname.release);
+}
+
+uint32_t os::Linux::os_version() {
+  assert(_os_version != 0, "not initialized");
+  return _os_version;
+}
+
+
 /////
 // glibc on Linux platform uses non-documented flag
 // to indicate, that some special sort of signal
@@ -4553,6 +4569,7 @@
   init_page_sizes((size_t) Linux::page_size());
    Linux::initialize_system_info();
+  Linux::initialize_os_info();
    // main_thread points to the aboriginal thread
   Linux::_main_thread = pthread_self();


diff -r 266fa9bb5297 src/os/linux/vm/os_linux.hpp
--- a/src/os/linux/vm/os_linux.hpp	Thu Feb 04 16:48:39 2016 -0800
+++ b/src/os/linux/vm/os_linux.hpp	Fri Feb 12 10:59:01 2016 -0200
@@ -55,7 +55,7 @@
   static bool _supports_fast_thread_cpu_time;
    static GrowableArray<int>* _cpu_to_node;
-
+  static uint32_t _os_version;   protected:
    static julong _physical_memory;
@@ -198,6 +198,9 @@
    static jlong fast_thread_cpu_time(clockid_t clockid);
 +  static void initialize_os_info();
+  static uint32_t os_version(); +
   // pthread_cond clock suppport
  private:
   static pthread_condattr_t _condattr[1];


23 tests are now passing: http://hastebin.com/raw/oyicagusod

Is there a reason to let RTM disabled for Linux on ppc64le by now? Could somebody explain what is currently missing on PPC64 LE RTM implementation in order to make all RTM tests pass?

Thank you.

Regards,
--
Gustavo Romero



More information about the ppc-aix-port-dev mailing list