已开启
Improve UseAVX setting and add cpu descriptions for zhaoxin processors #237
vicwang创建于 5月26日
Improve UseAVX setting and add cpu descriptions for zhaoxin processors #237
已开启
共 2 个文件变更+87-1
| @@ -0,0 +1,81 @@ | |||
| 1 | +diff --git a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp | ||
| 2 | +index a84b37f79..2a8bae37a 100644 | ||
| 3 | +--- a/src/hotspot/cpu/x86/vm_version_ext_x86.cpp | ||
| 4 | ++++ b/src/hotspot/cpu/x86/vm_version_ext_x86.cpp | ||
| 5 | +@@ -419,6 +419,24 @@ const char* VM_Version_Ext::cpu_family_description(void) { | ||
| 6 | + if (is_hygon()) { | ||
| 7 | + return "Dhyana"; | ||
| 8 | + } | ||
| 9 | ++ if (is_zx()) { | ||
| 10 | ++ int cpu_model_id = extended_cpu_model(); | ||
| 11 | ++ if (cpu_family_id == 7) { | ||
| 12 | ++ switch (cpu_model_id) { | ||
| 13 | ++ case 0x1B: | ||
| 14 | ++ return "wudaokou"; | ||
| 15 | ++ case 0x3B: | ||
| 16 | ++ return "lujiazui"; | ||
| 17 | ++ case 0x5B: | ||
| 18 | ++ return "yongfeng"; | ||
| 19 | ++ case 0x6B: | ||
| 20 | ++ return "shijidadao"; | ||
| 21 | ++ } | ||
| 22 | ++ } else if (cpu_family_id == 6) { | ||
| 23 | ++ return "zhangjiang"; | ||
| 24 | ++ } | ||
| 25 | ++ } | ||
| 26 | ++ | ||
| 27 | + return "Unknown x86"; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | +@@ -438,6 +456,9 @@ int VM_Version_Ext::cpu_type_description(char* const buf, size_t buf_len) { | ||
| 31 | + } else if (is_hygon()) { | ||
| 32 | + cpu_type = "Hygon"; | ||
| 33 | + x64 = cpu_is_em64t() ? " AMD64" : ""; | ||
| 34 | ++ } else if (is_zx()) { | ||
| 35 | ++ cpu_type = "Zhaoxin"; | ||
| 36 | ++ x64 = cpu_is_em64t() ? "x86_64" : ""; | ||
| 37 | + } else { | ||
| 38 | + cpu_type = "Unknown x86"; | ||
| 39 | + x64 = cpu_is_em64t() ? " x86_64" : ""; | ||
| 40 | +diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp | ||
| 41 | +index a6b7d27e2..12ea73636 100644 | ||
| 42 | +--- a/src/hotspot/cpu/x86/vm_version_x86.cpp | ||
| 43 | ++++ b/src/hotspot/cpu/x86/vm_version_x86.cpp | ||
| 44 | +@@ -703,9 +703,17 @@ void VM_Version::get_processor_features() { | ||
| 45 | + if (UseSSE < 1) | ||
| 46 | + _features &= ~CPU_SSE; | ||
| 47 | + | ||
| 48 | +- //since AVX instructions is slower than SSE in some ZX cpus, force USEAVX=0. | ||
| 49 | +- if (is_zx() && ((cpu_family() == 6) || (cpu_family() == 7))) { | ||
| 50 | +- UseAVX = 0; | ||
| 51 | ++ //ZX cpus specific settings | ||
| 52 | ++ if (is_zx() && FLAG_IS_DEFAULT(UseAVX)) { | ||
| 53 | ++ if (cpu_family() == 7) { | ||
| 54 | ++ if (extended_cpu_model() == 0x5B || extended_cpu_model() == 0x6B) { | ||
| 55 | ++ UseAVX = 1; | ||
| 56 | ++ } else if (extended_cpu_model() == 0x1B || extended_cpu_model() == 0x3B) { | ||
| 57 | ++ UseAVX = 0; | ||
| 58 | ++ } | ||
| 59 | ++ } else if (cpu_family() == 6) { | ||
| 60 | ++ UseAVX = 0; | ||
| 61 | ++ } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + // first try initial setting and detect what we can support | ||
| 65 | +diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp | ||
| 66 | +index 14f5c0a9f..8917c2755 100644 | ||
| 67 | +--- a/src/hotspot/cpu/x86/vm_version_x86.hpp | ||
| 68 | ++++ b/src/hotspot/cpu/x86/vm_version_x86.hpp | ||
| 69 | +@@ -974,6 +974,12 @@ public: | ||
| 70 | + } else { | ||
| 71 | + return 128; // Athlon | ||
| 72 | + } | ||
| 73 | ++ } else if (is_zx()) { // ZX | ||
| 74 | ++ if (supports_sse2()) { | ||
| 75 | ++ return 256; | ||
| 76 | ++ } else { | ||
| 77 | ++ return 128; | ||
| 78 | ++ } | ||
| 79 | + } else { // Intel | ||
| 80 | + if (supports_sse3() && cpu_family() == 6) { | ||
| 81 | + if (supports_sse4_2() && supports_ht()) { // Nehalem based cpus | ||
| @@ -920,7 +920,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release} | |||
| 920 | 920 | ||
| 921 | Name: java-%{javaver}-%{origin} | 921 | Name: java-%{javaver}-%{origin} |
| 922 | Version: %{newjavaver}.%{buildver} | 922 | Version: %{newjavaver}.%{buildver} |
| 923 | -Release: 9 | 923 | +Release: 10 |
| 924 | 924 | ||
| 925 | # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons | 925 | # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons |
| 926 | # and this change was brought into RHEL-4. java-1.5.0-ibm packages | 926 | # and this change was brought into RHEL-4. java-1.5.0-ibm packages |
| @@ -1096,6 +1096,7 @@ patch97: fix-COH-synchronizer-FastHashCode-bug.patch | |||
| 1096 | patch98: fix-libpng-CVE-2026-25646.patch | 1096 | patch98: fix-libpng-CVE-2026-25646.patch |
| 1097 | patch99: fix-zlib-CVE-2026-27171.patch | 1097 | patch99: fix-zlib-CVE-2026-27171.patch |
| 1098 | patch100: Add-JprofileCache-Conservative-Init.patch | 1098 | patch100: Add-JprofileCache-Conservative-Init.patch |
| 1099 | +patch101: Improve-UseAVX-setting-and-add-cpu-descriptions-for-zhaoxin-processors.patch | ||
| 1099 | 1100 | ||
| 1100 | ############################################ | 1101 | ############################################ |
| 1101 | # | 1102 | # |
| @@ -1414,6 +1415,7 @@ pushd %{top_level_dir_name} | |||
| 1414 | %patch 98 -p1 | 1415 | %patch 98 -p1 |
| 1415 | %patch 99 -p1 | 1416 | %patch 99 -p1 |
| 1416 | %patch 100 -p1 | 1417 | %patch 100 -p1 |
| 1418 | +%patch 101 -p1 | ||
| 1417 | popd # openjdk | 1419 | popd # openjdk |
| 1418 | %endif | 1420 | %endif |
| 1419 | 1421 | ||
| @@ -2038,6 +2040,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect | |||
| 2038 | 2040 | ||
| 2039 | 2041 | ||
| 2040 | %changelog | 2042 | %changelog |
| 2043 | +* Tue May 26 2026 vicwang <vicwang-oc@zhaoxin.com> 1:17.0.18.8-10 | ||
| 2044 | +- add Improve-UseAVX-setting-and-add-cpu-descriptions-for-zhaoxin-processors.patch | ||
| 2045 | + | ||
| 2041 | * Tue Mar 24 2026 lc <lc@wxiat.com> 1:17.0.18.8-9 | 2046 | * Tue Mar 24 2026 lc <lc@wxiat.com> 1:17.0.18.8-9 |
| 2042 | - swjdk-17.0.18-ga update | 2047 | - swjdk-17.0.18-ga update |
| 2043 | 2048 | ||