From jiangli at openjdk.org Tue Apr 9 01:08:14 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Tue, 9 Apr 2024 01:08:14 GMT Subject: RFR: Merge jdk-21-ga Message-ID: JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` Most manual merge for conflicts are mechanical. - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp - src/hotspot/cpu/x86/templateTable_x86.cpp Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. - src/hotspot/share/runtime/mutexLocker.cpp Update TsanOopMap_lock to use MUTEX_DEFN. - src/hotspot/share/runtime/sharedRuntime.cpp Update unused_reg_map() to reflect RegisterMap change. Additional updates: - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if the state is fully_initialized. Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with `obj`. Testing: Built with following config: $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors $ make test TEST=hotspot/jtreg/tsan ============================== Test summary ============================== TEST TOTAL PASS FAIL ERROR >> jtreg:test/hotspot/jtreg/tsan 79 76 3 0 << ============================== TEST FAILURE Failed tests: - tsan/NonRacyFinalizerLoopTest.java - tsan/NonRacySyncBlockExceptionLoopTest.java - tsan/NonRacyGarbageCollectionLoopTest.java ------------- Commit messages: - Fix trailing whitespace. - - tsanOopMap.cpp - - Remove java_lang_Class::init_lock_addr and java_lang_Class::init_lock_offset_addr. - - Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. - Merge tag 'jdk-21-ga' into jdk-21-merge - 8314062: ProblemList jdk/jfr/tool/TestView.java on macosx-x64 - 8311179: Generational ZGC: gc/z/TestSmallHeap.java failed with OutOfMemoryError - 8313809: String template fails with java.lang.StringIndexOutOfBoundsException if last fragment is UTF16 - 8312814: Compiler crash when template processor type is a captured wildcard - 8313345: SuperWord fails due to CMove without matching Bool pack - ... and 9228 more: https://git.openjdk.org/tsan/compare/83feada7...b2da2298 The webrevs contain the adjustments done while merging with regards to each parent branch: - tsan: https://webrevs.openjdk.org/?repo=tsan&pr=18&range=00.0 - jdk-21-ga: https://webrevs.openjdk.org/?repo=tsan&pr=18&range=00.1 Changes: https://git.openjdk.org/tsan/pull/18/files Stats: 3904603 lines in 24924 files changed: 2391750 ins; 1217503 del; 295350 mod Patch: https://git.openjdk.org/tsan/pull/18.diff Fetch: git fetch https://git.openjdk.org/tsan.git pull/18/head:pull/18 PR: https://git.openjdk.org/tsan/pull/18 From manc at openjdk.org Wed Apr 17 08:09:16 2024 From: manc at openjdk.org (Man Cao) Date: Wed, 17 Apr 2024 08:09:16 GMT Subject: RFR: Merge jdk-21-ga In-Reply-To: References: Message-ID: On Tue, 9 Apr 2024 00:16:14 GMT, Jiangli Zhou wrote: > JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` > > Most manual merge for conflicts are mechanical. > > - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp > - src/hotspot/cpu/x86/templateTable_x86.cpp > Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. > > - src/hotspot/share/runtime/mutexLocker.cpp > Update TsanOopMap_lock to use MUTEX_DEFN. > > - src/hotspot/share/runtime/sharedRuntime.cpp > Update unused_reg_map() to reflect RegisterMap change. > > Additional updates: > > - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) > Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. > > - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) > In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. > > In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. > > In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if > the state is fully_initialized. > > Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and > src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with > `obj`. > > Testing: > > Built with following config: > > > $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors > > > > $ make test TEST=hotspot/jtreg/tsan > > > > ============================== > Test summary > ==================... Great job, and thanks for this! One additional note is that the TSAN changes to `SystemDictionary::double_lock_wait()` and `ObjectMonitor::complete_exit()` are removed, because JDK has removed those methods. They are for the workaround of deadlocks on the class loader lock objects. This merge seems to also fix a bug from [JDK 17 merge PR](https://github.com/openjdk/tsan/pull/17): in `sharedRuntime_aarch64.cpp`, above the instrumentation for `SharedRuntime::tsan_oop_unlock`, there was an unnecessary `__ resolve(IS_NOT_NULL, obj_reg);`. Good that it is deleted now. Below are some small actionable feedback: In `javaClasses.hpp`, the empty block of `#if INCLUDE_TSAN` with a FIXME line above can be removed. In `fieldInfo.hpp`, the removal of empty line above the following context is not needed: // Gadget for decoding and reading the stream of field records. class FieldInfoReader { In `instanceKlass.cpp`, `InstanceKlass::initialize`, the new sentence in comment is a bit hard to understand: `// This is to read/write of natives related to class static initializer.` How about "Native memory accesses in JNI code invoked from class static initializer could rely on this happens-before edge to avoid data races."? Alternatively, we can leave the old comment as-is, and create a separate PR later to add the new sentence, to make this change more conspicuous. In `InstanceKlass::set_initialization_state_and_notify()`, it might be better to wrap the `if (state == fully_initialized)` check inside `TSAN_RUNTIME_ONLY` macro. Also, the indention seems off inside the if block. Change to `jvmtiTagMap.hpp` in unnecessary (added an empty line). In `unsafe.cpp`, in `Unsafe_CompareAndExchangeInt`, it should be `ScopedReleaseAcquire releaseAcquire(addr)` instead of `ScopedReleaseAcquire releaseAcquire(p, offset)`. In `tsanOopMap.cpp`, I can see it is difficult to get `GCTraceCPUTime` working, so it is fine to remove it. But for `GCTraceTime`, do they trigger a build error if they are left as-is? It is better to remove `GCTraceTime` in the later change that fixes the issues with tsanOopMap. ------------- PR Comment: https://git.openjdk.org/tsan/pull/18#issuecomment-2060654960 From jiangli at openjdk.org Wed Apr 17 21:45:16 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Wed, 17 Apr 2024 21:45:16 GMT Subject: RFR: Merge jdk-21-ga In-Reply-To: References: Message-ID: On Tue, 9 Apr 2024 00:16:14 GMT, Jiangli Zhou wrote: > JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` > > Most manual merge for conflicts are mechanical. > > - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp > - src/hotspot/cpu/x86/templateTable_x86.cpp > Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. > > - src/hotspot/share/runtime/mutexLocker.cpp > Update TsanOopMap_lock to use MUTEX_DEFN. > > - src/hotspot/share/runtime/sharedRuntime.cpp > Update unused_reg_map() to reflect RegisterMap change. > > Additional updates: > > - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) > Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. > > - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) > In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. > > In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. > > In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if > the state is fully_initialized. > > Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and > src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with > `obj`. > > Testing: > > Built with following config: > > > $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors > > > > $ make test TEST=hotspot/jtreg/tsan > > > > ============================== > Test summary > ==================... Man, thanks for the detailed and careful review! > TSAN changes to SystemDictionary::double_lock_wait() and ObjectMonitor::complete_exit() are removed, because JDK has removed those methods. They are for the workaround of deadlocks on the class loader lock objects. This merge seems to also fix a bug from https://github.com/openjdk/tsan/pull/17: in sharedRuntime_aarch64.cpp, above the instrumentation for SharedRuntime::tsan_oop_unlock, there was an unnecessary __ resolve(IS_NOT_NULL, obj_reg); Thanks for noticing those. They are probably more explicit when you do diff comparison. I'll take a close look of the remaining review comments and follow up on those. ------------- PR Comment: https://git.openjdk.org/tsan/pull/18#issuecomment-2062455580 From jiangli at openjdk.org Wed Apr 17 22:53:56 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Wed, 17 Apr 2024 22:53:56 GMT Subject: RFR: Merge jdk-21-ga [v2] In-Reply-To: References: Message-ID: > JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` > > Most manual merge for conflicts are mechanical. > > - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp > - src/hotspot/cpu/x86/templateTable_x86.cpp > Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. > > - src/hotspot/share/runtime/mutexLocker.cpp > Update TsanOopMap_lock to use MUTEX_DEFN. > > - src/hotspot/share/runtime/sharedRuntime.cpp > Update unused_reg_map() to reflect RegisterMap change. > > Additional updates: > > - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) > Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. > > - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) > In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. > > In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. > > In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if > the state is fully_initialized. > > Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and > src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with > `obj`. > > Testing: > > Built with following config: > > > $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors > > > > $ make test TEST=hotspot/jtreg/tsan > > > > ============================== > Test summary > ==================... Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision: Address review comments in https://github.com/openjdk/tsan/pull/18#issuecomment-2060654960. ------------- Changes: - all: https://git.openjdk.org/tsan/pull/18/files - new: https://git.openjdk.org/tsan/pull/18/files/b2da2298..b90c974d Webrevs: - full: Webrev is not available because diff is too large - incr: https://webrevs.openjdk.org/?repo=tsan&pr=18&range=00-01 Stats: 16 lines in 5 files changed: 2 ins; 4 del; 10 mod Patch: https://git.openjdk.org/tsan/pull/18.diff Fetch: git fetch https://git.openjdk.org/tsan.git pull/18/head:pull/18 PR: https://git.openjdk.org/tsan/pull/18 From jiangli at openjdk.org Wed Apr 17 22:53:56 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Wed, 17 Apr 2024 22:53:56 GMT Subject: RFR: Merge jdk-21-ga In-Reply-To: References: Message-ID: On Wed, 17 Apr 2024 08:06:08 GMT, Man Cao wrote: > In javaClasses.hpp, the empty block of #if INCLUDE_TSAN with a FIXME line above can be removed. Done. > In fieldInfo.hpp, the removal of empty line above the following context is not needed: Added empty line back. > In instanceKlass.cpp, InstanceKlass::initialize, the new sentence in comment is a bit hard to understand: > // This is to read/write of natives related to class static initializer. > How about "Native memory accesses in JNI code invoked from class static initializer could rely on this happens-> > before edge to avoid data races."? > Alternatively, we can leave the old comment as-is, and create a separate PR later to add the new sentence, to make this change more conspicuous. I reworded your suggested comment as the following: // Memory accesses from JNI native code // invoked from class static initializer may rely on this happens-before // edge to avoid reporting false positive data races. > In InstanceKlass::set_initialization_state_and_notify(), it might be better to wrap the if (state == fully_initialized) check inside TSAN_RUNTIME_ONLY macro. Also, the indention seems off inside the if block. Done. > Change to jvmtiTagMap.hpp in unnecessary (added an empty line). Removed empty line at line# 60. > In unsafe.cpp, in Unsafe_CompareAndExchangeInt, it should be ScopedReleaseAcquire releaseAcquire(addr) instead of ScopedReleaseAcquire releaseAcquire(p, offset). Fixed. > In tsanOopMap.cpp, I can see it is difficult to get GCTraceCPUTime working, so it is fine to remove it. But for GCTraceTime, do they trigger a build error if they are left as-is? It is better to remove GCTraceTime in the later change that fixes the issues with tsanOopMap. Right. As mentioned in offline conversion with you yesterday, the GCTraceCPUTime usages in TsanOopMap was causing build failures. That's why I removed them as part of the current merge change. It's not worth making GCTraceCPUTime code working in the current version than later remove it when making TsanOopMap concurrent. ------------- PR Comment: https://git.openjdk.org/tsan/pull/18#issuecomment-2062611106 From manc at openjdk.org Wed Apr 17 23:09:19 2024 From: manc at openjdk.org (Man Cao) Date: Wed, 17 Apr 2024 23:09:19 GMT Subject: RFR: Merge jdk-21-ga [v2] In-Reply-To: References: Message-ID: On Wed, 17 Apr 2024 22:53:56 GMT, Jiangli Zhou wrote: >> JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` >> >> Most manual merge for conflicts are mechanical. >> >> - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp >> - src/hotspot/cpu/x86/templateTable_x86.cpp >> Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. >> >> - src/hotspot/share/runtime/mutexLocker.cpp >> Update TsanOopMap_lock to use MUTEX_DEFN. >> >> - src/hotspot/share/runtime/sharedRuntime.cpp >> Update unused_reg_map() to reflect RegisterMap change. >> >> Additional updates: >> >> - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) >> Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. >> >> - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) >> In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. >> >> In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. >> >> In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if >> the state is fully_initialized. >> >> Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and >> src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with >> `obj`. >> >> Remove GCTraceTime and GCTraceCPUTime related in tsanOopMap, which will be reworked. >> >> Testing: >> >> Built with following config: >> >> >> $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-erro... > > Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision: > > Address review comments in https://github.com/openjdk/tsan/pull/18#issuecomment-2060654960. LGTM. Make sure to also mention the deletion of `GCTraceTime` in tsanOopMap.cpp in description. ------------- Marked as reviewed by manc (Reviewer). PR Review: https://git.openjdk.org/tsan/pull/18#pullrequestreview-2007510778 From jiangli at openjdk.org Wed Apr 17 23:14:18 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Wed, 17 Apr 2024 23:14:18 GMT Subject: RFR: Merge jdk-21-ga In-Reply-To: References: Message-ID: On Wed, 17 Apr 2024 22:50:12 GMT, Jiangli Zhou wrote: > > In javaClasses.hpp, the empty block of #if INCLUDE_TSAN with a FIXME line above can be removed. > > Done. > > > In fieldInfo.hpp, the removal of empty line above the following context is not needed: > > Added empty line back. > > > In instanceKlass.cpp, InstanceKlass::initialize, the new sentence in comment is a bit hard to understand: > > // This is to read/write of natives related to class static initializer. > > How about "Native memory accesses in JNI code invoked from class static initializer could rely on this happens-> > before edge to avoid data races."? > > Alternatively, we can leave the old comment as-is, and create a separate PR later to add the new sentence, to make this change more conspicuous. > > I reworded your suggested comment as the following: > > ``` > // Memory accesses from JNI native code > // invoked from class static initializer may rely on this happens-before > // edge to avoid reporting false positive data races. > ``` > > > In InstanceKlass::set_initialization_state_and_notify(), it might be better to wrap the if (state == fully_initialized) check inside TSAN_RUNTIME_ONLY macro. Also, the indention seems off inside the if block. > > Done. > > > Change to jvmtiTagMap.hpp in unnecessary (added an empty line). > > Removed empty line at line# 60. > > > In unsafe.cpp, in Unsafe_CompareAndExchangeInt, it should be ScopedReleaseAcquire releaseAcquire(addr) instead of ScopedReleaseAcquire releaseAcquire(p, offset). > > Fixed. > > > In tsanOopMap.cpp, I can see it is difficult to get GCTraceCPUTime working, so it is fine to remove it. But for GCTraceTime, do they trigger a build error if they are left as-is? It is better to remove GCTraceTime in the later change that fixes the issues with tsanOopMap. > > Right. As mentioned in offline conversion with you yesterday, the GCTraceCPUTime usages in TsanOopMap was causing build failures. That's why I removed them as part of the current merge change. It's not worth making GCTraceCPUTime code working in the current version than later remove it when making TsanOopMap concurrent. @caoman and I just had additional offline discussion for clarifications. Both GCTraceTime and GCTraceCPUTime usages were removed from the current version of TsanOopMap of part of my merge. TsanOopMap will need to be reworked. ------------- PR Comment: https://git.openjdk.org/tsan/pull/18#issuecomment-2062631076 From jiangli at openjdk.org Wed Apr 17 23:21:36 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Wed, 17 Apr 2024 23:21:36 GMT Subject: RFR: Merge jdk-21-ga [v3] In-Reply-To: References: Message-ID: > JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` > > Most manual merge for conflicts are mechanical. > > - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp > - src/hotspot/cpu/x86/templateTable_x86.cpp > Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. > > - src/hotspot/share/runtime/mutexLocker.cpp > Update TsanOopMap_lock to use MUTEX_DEFN. > > - src/hotspot/share/runtime/sharedRuntime.cpp > Update unused_reg_map() to reflect RegisterMap change. > > Additional updates: > > - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) > Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. > > - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) > In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. > > In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. > > In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if > the state is fully_initialized. > > Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and > src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with > `obj`. > > Remove GCTraceTime and GCTraceCPUTime related in tsanOopMap, which will be reworked. > > Testing: > > Built with following config: > > > $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors > > > > $ make test TES... Jiangli Zhou has updated the pull request incrementally with one additional commit since the last revision: Fix Whitespace error. ------------- Changes: - all: https://git.openjdk.org/tsan/pull/18/files - new: https://git.openjdk.org/tsan/pull/18/files/b90c974d..7d8186f7 Webrevs: - full: Webrev is not available because diff is too large - incr: https://webrevs.openjdk.org/?repo=tsan&pr=18&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/tsan/pull/18.diff Fetch: git fetch https://git.openjdk.org/tsan.git pull/18/head:pull/18 PR: https://git.openjdk.org/tsan/pull/18 From jiangli at openjdk.org Thu Apr 18 00:11:17 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Thu, 18 Apr 2024 00:11:17 GMT Subject: RFR: Merge jdk-21-ga [v2] In-Reply-To: References: Message-ID: On Wed, 17 Apr 2024 23:06:48 GMT, Man Cao wrote: > LGTM. Make sure to also mention the deletion of `GCTraceTime` in tsanOopMap.cpp in description. Done. ------------- PR Comment: https://git.openjdk.org/tsan/pull/18#issuecomment-2062755606 From jiangli at openjdk.org Thu Apr 18 15:26:37 2024 From: jiangli at openjdk.org (Jiangli Zhou) Date: Thu, 18 Apr 2024 15:26:37 GMT Subject: Integrated: Merge jdk-21-ga In-Reply-To: References: Message-ID: On Tue, 9 Apr 2024 00:16:14 GMT, Jiangli Zhou wrote: > JDK 21 merge command: `$ git merge --no-ff jdk-21-ga` > > Most manual merge for conflicts are mechanical. > > - src/hotspot/cpu/aarch64/templateTable_aarch64.cpp > - src/hotspot/cpu/x86/templateTable_x86.cpp > Add extra `noreg` arg to `access_store_at` in `TemplateTable::lastore` and friends. > > - src/hotspot/share/runtime/mutexLocker.cpp > Update TsanOopMap_lock to use MUTEX_DEFN. > > - src/hotspot/share/runtime/sharedRuntime.cpp > Update unused_reg_map() to reflect RegisterMap change. > > Additional updates: > > - Field access flags related (related to https://github.com/openjdk/jdk21/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33 change) > Change TSAN specific field access flag, JVM_ACC_FIELD_TSAN_IGNORE to be a FieldFlags, _ff_tsan_ignore. Add is_tsan_ignore() and update_tsan_ignore in FieldFlags and replace the existing usages in various places to use the FieldFlags functions for the tsan_ignore flag. Remove the old is_tsan_ignore() and set_tsan_ignore() from FieldInfo. > > - init_lock related (related to https://github.com/jianglizhou/tsan/commit/9099f3e7b58deec50cd8af9db49b2b2e564a6bfe changes) > In instanceKlass.cpp, change to do SharedRuntime::tsan_acquire and SharedRuntime::tsan_release on the class mirror. > > In JDK 21, there is no eager_initialization (removed by https://github.com/openjdk/jdk/commit/cec23b1b078cd0c82063dda1af5a54ea561855c9). So we now only have SharedRuntime::tsan_acquire in InstanceKlass::initialize and SharedRuntime::tsan_release in InstanceKlass::set_initialization_state_and_notify with the latest version. > > In InstanceKlass::set_initialization_state_and_notify, only do SharedRuntime::tsan_release for the mirror if > the state is fully_initialized. > > Remove the code for loading the address of init_lock in src/hotspot/cpu/x86/templateTable_x86.cpp and > src/hotspot/cpu/aarch64/templateTable_aarch64.cpp. SharedRuntime::tsan_acquire calls are done with > `obj`. > > Remove GCTraceTime and GCTraceCPUTime related in tsanOopMap, which will be reworked. > > Testing: > > Built with following config: > > > $ bash configure --with-boot-jdk=/usr/local/google/home/jianglizhou/openjdk/jdk-21.0.1 --with-debug-level=release --disable-warnings-as-errors --with-jtreg=/usr/local/google/home/jianglizhou/github/jtreg/build/images/jtreg --with-stdc++lib=static --disable-precompiled-headers --enable-unlimited-crypto --with-native-debug-symbols=internal --with-default-make-target=jdk-image --disable-warnings-as-errors --with-toolchain-type=clang --disable-warnings-as-errors > > > > $ make test TES... This pull request has now been integrated. Changeset: 46ab1ec9 Author: Jiangli Zhou URL: https://git.openjdk.org/tsan/commit/46ab1ec9ce06cdc406bb3951359e01e5a5bba0fb Stats: 3904605 lines in 24924 files changed: 2391751 ins; 1217506 del; 295348 mod Merge Reviewed-by: manc ------------- PR: https://git.openjdk.org/tsan/pull/18