!565 Fix aarch64 runtime thread signal transfer bug
From: @neu-mobi Reviewed-by: @alexanderbill Signed-off-by: @alexanderbill
This commit is contained in:
commit
ce66e574b2
@ -1,16 +1,82 @@
|
||||
From c4fd69c76c41b7b6168f1071d50143566f7d269e Mon Sep 17 00:00:00 2001
|
||||
From c4fd69c76c41b7b6168f1071d50143566f7d269e
|
||||
Date: Fri, 22 Sep 2023 14:48:33 +0800
|
||||
Subject: [PATCH] add Fix-aarch64-runtime-thread-signal-transfer-bug
|
||||
|
||||
---
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 7 ++
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 3 +
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 69 +++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 2 +
|
||||
4 files changed, 82 insertions(+), 5 deletions(-)
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.cpp | 47 +++++----
|
||||
.../src/cpu/aarch64/vm/vm_version_aarch64.hpp | 8 ++
|
||||
hotspot/src/os/linux/vm/os_linux.cpp | 7 ++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.cpp | 97 +++++++++++++++++++
|
||||
.../linux_aarch64/vm/thread_linux_aarch64.hpp | 3 +
|
||||
5 files changed, 141 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
index 27ab00dd..839df4a3 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp
|
||||
@@ -169,27 +169,7 @@ void VM_Version::get_processor_features() {
|
||||
_features_str = strdup(buf);
|
||||
_cpuFeatures = auxv;
|
||||
|
||||
- int cpu_lines = 0;
|
||||
- if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
- char buf[128], *p;
|
||||
- while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
- if ((p = strchr(buf, ':')) != NULL) {
|
||||
- long v = strtol(p+1, NULL, 0);
|
||||
- if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
- _cpu = v;
|
||||
- cpu_lines++;
|
||||
- } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
- _variant = v;
|
||||
- } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
- if (_model != v) _model2 = _model;
|
||||
- _model = v;
|
||||
- } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
- _revision = v;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- fclose(f);
|
||||
- }
|
||||
+ int cpu_lines = get_cpu_model();
|
||||
|
||||
// Enable vendor specific features
|
||||
if (_cpu == CPU_CAVIUM) {
|
||||
@@ -346,6 +326,31 @@ void VM_Version::get_processor_features() {
|
||||
#endif
|
||||
}
|
||||
|
||||
+int VM_Version::get_cpu_model() {
|
||||
+ int cpu_lines = 0;
|
||||
+ if (FILE *f = fopen("/proc/cpuinfo", "r")) {
|
||||
+ char buf[128], *p;
|
||||
+ while (fgets(buf, sizeof (buf), f) != NULL) {
|
||||
+ if ((p = strchr(buf, ':')) != NULL) {
|
||||
+ long v = strtol(p+1, NULL, 0);
|
||||
+ if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||
+ _cpu = v;
|
||||
+ cpu_lines++;
|
||||
+ } else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||
+ _variant = v;
|
||||
+ } else if (strncmp(buf, "CPU part", sizeof "CPU part" - 1) == 0) {
|
||||
+ if (_model != v) _model2 = _model;
|
||||
+ _model = v;
|
||||
+ } else if (strncmp(buf, "CPU revision", sizeof "CPU revision" - 1) == 0) {
|
||||
+ _revision = v;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ }
|
||||
+ return cpu_lines;
|
||||
+}
|
||||
+
|
||||
void VM_Version::initialize() {
|
||||
ResourceMark rm;
|
||||
|
||||
diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
index 7f3a53262..9dfc3465e 100644
|
||||
index 7f3a5326..47353df9 100644
|
||||
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
@ -21,7 +87,14 @@ index 7f3a53262..9dfc3465e 100644
|
||||
CPU_INFINEON = 'I',
|
||||
CPU_MOTOROLA = 'M',
|
||||
CPU_NVIDIA = 'N',
|
||||
@@ -93,6 +94,12 @@ public:
|
||||
@@ -87,12 +88,19 @@ public:
|
||||
CPU_DMB_ATOMICS = (1 << 31),
|
||||
} cpuFeatureFlags;
|
||||
|
||||
+ static int get_cpu_model();
|
||||
static const char* cpu_features() { return _features_str; }
|
||||
static int cpu_family() { return _cpu; }
|
||||
static int cpu_model() { return _model; }
|
||||
static int cpu_variant() { return _variant; }
|
||||
static int cpu_revision() { return _revision; }
|
||||
static int cpu_cpuFeatures() { return _cpuFeatures; }
|
||||
@ -35,10 +108,21 @@ index 7f3a53262..9dfc3465e 100644
|
||||
static ByteSize ctr_el0_offset() { return byte_offset_of(PsrInfo, ctr_el0); }
|
||||
static bool is_zva_enabled() {
|
||||
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
index 197b5c193..3ed8cde6b 100644
|
||||
index 2dde2587..647ef582 100644
|
||||
--- a/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
|
||||
@@ -5754,6 +5754,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
@@ -5576,6 +5576,10 @@ jint os::init_2(void)
|
||||
Linux::is_floating_stack() ? "floating stack" : "fixed stack");
|
||||
}
|
||||
|
||||
+#ifdef AARCH64
|
||||
+ JavaThread::os_linux_aarch64_options(active_processor_count(), argv_for_execvp);
|
||||
+#endif
|
||||
+
|
||||
if (UseNUMA) {
|
||||
if (!Linux::libnuma_init()) {
|
||||
UseNUMA = false;
|
||||
@@ -5760,6 +5764,9 @@ void os::set_native_thread_name(const char *name) {
|
||||
const int rc = Linux::_pthread_setname_np(pthread_self(), buf);
|
||||
// ERANGE should not happen; all other errors should just be ignored.
|
||||
assert(rc != ERANGE, "pthread_setname_np failed");
|
||||
@ -49,7 +133,7 @@ index 197b5c193..3ed8cde6b 100644
|
||||
}
|
||||
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
index 87e42318a..bc4b03561 100644
|
||||
index 87e42318..8b0e2c98 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
@ -60,7 +144,7 @@ index 87e42318a..bc4b03561 100644
|
||||
|
||||
// For Forte Analyzer AsyncGetCallTrace profiling support - thread is
|
||||
// currently interrupted by SIGPROF
|
||||
@@ -39,6 +40,74 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
@@ -39,6 +40,102 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
|
||||
return pd_get_top_frame(fr_addr, ucontext, isInJava);
|
||||
}
|
||||
|
||||
@ -131,23 +215,52 @@ index 87e42318a..bc4b03561 100644
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void JavaThread::os_linux_aarch64_options(int apc, char **name) {
|
||||
+ if (name == NULL) {
|
||||
+ return;
|
||||
+ }
|
||||
+ VM_Version::get_cpu_model();
|
||||
+ if (VM_Version::is_hisi_enabled()) {
|
||||
+ int i = 0;
|
||||
+ int step = 0;
|
||||
+ while (name[i] != NULL) {
|
||||
+ if (stringHash(name[i]) == 1396789436) {
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && (UseG1GC || UseParallelGC) && apc > 8)
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, 8);
|
||||
+ break;
|
||||
+ } else if (stringHash(name[i]) == 1594786418) {
|
||||
+ step = 1;
|
||||
+ } else if (step == 1 && stringHash(name[i]) == 237006690) {
|
||||
+ if (name[i+1] != NULL) {
|
||||
+ int cores = atoi(name[i+1]);
|
||||
+ if (FLAG_IS_DEFAULT(ActiveProcessorCount) && cores > 0)
|
||||
+ FLAG_SET_DEFAULT(ActiveProcessorCount, cores);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) {
|
||||
assert(this->is_Java_thread(), "must be JavaThread");
|
||||
JavaThread* jt = (JavaThread *)this;
|
||||
diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
index a2f0135c2..251e523df 100644
|
||||
index a2f0135c..f14ace0d 100644
|
||||
--- a/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/thread_linux_aarch64.hpp
|
||||
@@ -66,6 +66,8 @@
|
||||
@@ -66,6 +66,9 @@
|
||||
bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
|
||||
bool isInJava);
|
||||
|
||||
+ void os_linux_aarch64_options(const char *name);
|
||||
+ static void os_linux_aarch64_options(int apc, char **name);
|
||||
+
|
||||
bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
private:
|
||||
bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava);
|
||||
--
|
||||
2.22.0
|
||||
2.19.1
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
|
||||
|
||||
Name: java-%{javaver}-%{origin}
|
||||
Version: %{javaver}.%{updatever}.%{buildver}
|
||||
Release: 5
|
||||
Release: 6
|
||||
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
|
||||
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
||||
# also included the epoch in their virtual provides. This created a
|
||||
@ -2624,6 +2624,9 @@ cjc.mainProgram(arg)
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Jun 18 2024 neu-mobi <liuyulong35@huawei.com> -1:1.8.0.412-b08.6
|
||||
- Fix aarch64 runtime thread signal transfer bug
|
||||
|
||||
* Thu May 23 2024 Dingli Zhang <dingli@iscas.ac.cn> -1:1.8.0.412-b08.5
|
||||
- Fix build on riscv64 in prep stage
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user