Blame SOURCES/8181055-pr3394-rh1448880.patch

0ad01d
# HG changeset patch
0ad01d
# User zgu
0ad01d
# Date 1496236768 14400
0ad01d
#      Wed May 31 09:19:28 2017 -0400
0ad01d
# Node ID 8330ff7914ec54c46fd19300221f72d774423405
0ad01d
# Parent  55a34e4962e10c822affe8f89273a87e84cade92
0ad01d
8181055: PPC64: "mbind: Invalid argument" still seen after 8175813
0ad01d
Summary: Use numa_interleave_memory v2 api when available
0ad01d
Reviewed-by: dholmes, shade
0ad01d
0ad01d
diff -r 74c81011375b src/os/linux/vm/os_linux.cpp
0ad01d
--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp	Wed May 17 17:52:34 2017 -0400
0ad01d
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp	Wed May 31 12:27:00 2017 -0400
0ad01d
@@ -2819,11 +2819,8 @@
0ad01d
 extern "C" JNIEXPORT void numa_error(char *where) { }
0ad01d
 extern "C" JNIEXPORT int fork1() { return fork(); }
0ad01d
 
0ad01d
-
0ad01d
-// If we are running with libnuma version > 2, then we should
0ad01d
-// be trying to use symbols with versions 1.1
0ad01d
-// If we are running with earlier version, which did not have symbol versions,
0ad01d
-// we should use the base version.
0ad01d
+// Handle request to load libnuma symbol version 1.1 (API v1). If it fails
0ad01d
+// load symbol from base version instead.
0ad01d
 void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
0ad01d
   void *f = dlvsym(handle, name, "libnuma_1.1");
0ad01d
   if (f == NULL) {
0ad01d
@@ -2832,6 +2829,12 @@
0ad01d
   return f;
0ad01d
 }
0ad01d
 
0ad01d
+// Handle request to load libnuma symbol version 1.2 (API v2) only.
0ad01d
+// Return NULL if the symbol is not defined in this particular version.
0ad01d
+void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
0ad01d
+  return dlvsym(handle, name, "libnuma_1.2");
0ad01d
+}
0ad01d
+
0ad01d
 bool os::Linux::libnuma_init() {
0ad01d
   // sched_getcpu() should be in libc.
0ad01d
   set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t,
0ad01d
@@ -2856,6 +2859,8 @@
0ad01d
                                             libnuma_dlsym(handle, "numa_tonode_memory")));
0ad01d
       set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t,
0ad01d
                                                 libnuma_dlsym(handle, "numa_interleave_memory")));
0ad01d
+      set_numa_interleave_memory_v2(CAST_TO_FN_PTR(numa_interleave_memory_v2_func_t,
0ad01d
+                                                libnuma_v2_dlsym(handle, "numa_interleave_memory")));
0ad01d
       set_numa_set_bind_policy(CAST_TO_FN_PTR(numa_set_bind_policy_func_t,
0ad01d
                                               libnuma_dlsym(handle, "numa_set_bind_policy")));
0ad01d
       set_numa_bitmask_isbitset(CAST_TO_FN_PTR(numa_bitmask_isbitset_func_t,
0ad01d
@@ -2975,6 +2980,7 @@
0ad01d
 os::Linux::numa_available_func_t os::Linux::_numa_available;
0ad01d
 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory;
0ad01d
 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory;
0ad01d
+os::Linux::numa_interleave_memory_v2_func_t os::Linux::_numa_interleave_memory_v2;
0ad01d
 os::Linux::numa_set_bind_policy_func_t os::Linux::_numa_set_bind_policy;
0ad01d
 os::Linux::numa_bitmask_isbitset_func_t os::Linux::_numa_bitmask_isbitset;
0ad01d
 os::Linux::numa_distance_func_t os::Linux::_numa_distance;
0ad01d
diff -r 74c81011375b src/os/linux/vm/os_linux.hpp
0ad01d
--- openjdk/hotspot/src/os/linux/vm/os_linux.hpp	Wed May 17 17:52:34 2017 -0400
0ad01d
+++ openjdk/hotspot/src/os/linux/vm/os_linux.hpp	Wed May 31 12:27:00 2017 -0400
0ad01d
@@ -1,5 +1,5 @@
0ad01d
 /*
0ad01d
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
0ad01d
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
0ad01d
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0ad01d
  *
0ad01d
  * This code is free software; you can redistribute it and/or modify it
0ad01d
@@ -190,6 +190,9 @@
0ad01d
   static void libpthread_init();
0ad01d
   static bool libnuma_init();
0ad01d
   static void* libnuma_dlsym(void* handle, const char* name);
0ad01d
+  // libnuma v2 (libnuma_1.2) symbols
0ad01d
+  static void* libnuma_v2_dlsym(void* handle, const char* name);
0ad01d
+
0ad01d
   // Minimum stack size a thread can be created with (allowing
0ad01d
   // the VM to completely create the thread and enter user code)
0ad01d
   static size_t min_stack_allowed;
0ad01d
@@ -250,6 +253,8 @@
0ad01d
   typedef int (*numa_available_func_t)(void);
0ad01d
   typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
0ad01d
   typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
0ad01d
+  typedef void (*numa_interleave_memory_v2_func_t)(void *start, size_t size, struct bitmask* mask);
0ad01d
+
0ad01d
   typedef void (*numa_set_bind_policy_func_t)(int policy);
0ad01d
   typedef int (*numa_bitmask_isbitset_func_t)(struct bitmask *bmp, unsigned int n);
0ad01d
   typedef int (*numa_distance_func_t)(int node1, int node2);
0ad01d
@@ -261,6 +266,7 @@
0ad01d
   static numa_available_func_t _numa_available;
0ad01d
   static numa_tonode_memory_func_t _numa_tonode_memory;
0ad01d
   static numa_interleave_memory_func_t _numa_interleave_memory;
0ad01d
+  static numa_interleave_memory_v2_func_t _numa_interleave_memory_v2;
0ad01d
   static numa_set_bind_policy_func_t _numa_set_bind_policy;
0ad01d
   static numa_bitmask_isbitset_func_t _numa_bitmask_isbitset;
0ad01d
   static numa_distance_func_t _numa_distance;
0ad01d
@@ -275,6 +281,7 @@
0ad01d
   static void set_numa_available(numa_available_func_t func) { _numa_available = func; }
0ad01d
   static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; }
0ad01d
   static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; }
0ad01d
+  static void set_numa_interleave_memory_v2(numa_interleave_memory_v2_func_t func) { _numa_interleave_memory_v2 = func; }
0ad01d
   static void set_numa_set_bind_policy(numa_set_bind_policy_func_t func) { _numa_set_bind_policy = func; }
0ad01d
   static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
0ad01d
   static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
0ad01d
@@ -296,7 +303,10 @@
0ad01d
     return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1;
0ad01d
   }
0ad01d
   static void numa_interleave_memory(void *start, size_t size) {
0ad01d
-    if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) {
0ad01d
+    // Use v2 api if available
0ad01d
+    if (_numa_interleave_memory_v2 != NULL && _numa_all_nodes_ptr != NULL) {
0ad01d
+      _numa_interleave_memory_v2(start, size, _numa_all_nodes_ptr);
0ad01d
+    } else if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) {
0ad01d
       _numa_interleave_memory(start, size, _numa_all_nodes);
0ad01d
     }
0ad01d
   }
0ad01d