Re: RFR: 8274196: Crashes in VM_HeapDumper::work after JDK-8252842 [v4]

2021-09-27 Thread Lin Zang
On Mon, 27 Sep 2021 13:06:57 GMT, Per Liden  wrote:

>> Lin Zang has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   remove redundant empty line
>
> src/hotspot/share/services/heapDumper.cpp line 1601:
> 
>> 1599: void JNILocalsDumper::do_oop(oop* obj_p) {
>> 1600:   // ignore null handles
>> 1601:   oop o = NativeAccess::oop_load(obj_p);
> 
> The JNI Local roots do not need a load barrier, only JNI Global roots need 
> that. The JNI Local roots are processed on safepoint entry as part of the 
> "thread head" (via 
> `ZStackWatermark::ZStackWatermark::start_processing_impl()` -> 
> `Thread::oops_do_no_frames()`), so once you are in 
> `VM_HeapDumper::do_thread()` the JNI Local roots have already passed a load 
> barrier.

Get it, Thanks!

-

PR: https://git.openjdk.java.net/jdk/pull/5681


Re: RFR: 8274196: Crashes in VM_HeapDumper::work after JDK-8252842 [v4]

2021-09-27 Thread Per Liden
On Mon, 27 Sep 2021 12:02:53 GMT, Lin Zang  wrote:

>> The root cause for crash in ZGC is that the JNIHandles are processed before 
>> object iteration. And ZGC would update the JNIHandles at object iteration 
>> with read barrier. So the crash is cause by accessing the invalid address 
>> which can be dummy info after zgc, and hence crash.
>> 
>> The lock rank issue can be fixed because the related mutexes are acquired in 
>> safepoint. so the safepoint_check_required could be safepoint_check_always.
>> 
>> The Epsilon issue is caused by wrong _num_dumper_thread calculated when the 
>> gang==NULL.
>
> Lin Zang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   remove redundant empty line

src/hotspot/share/services/heapDumper.cpp line 1601:

> 1599: void JNILocalsDumper::do_oop(oop* obj_p) {
> 1600:   // ignore null handles
> 1601:   oop o = NativeAccess::oop_load(obj_p);

The JNI Local roots do not need a load barrier, only JNI Global roots need 
that. The JNI Local roots are processed on safepoint entry as part of the 
"thread head" (via `ZStackWatermark::ZStackWatermark::start_processing_impl()` 
-> `Thread::oops_do_no_frames()`), so once you are in 
`VM_HeapDumper::do_thread()` the JNI Local roots have already passed a load 
barrier.

-

PR: https://git.openjdk.java.net/jdk/pull/5681


Re: RFR: 8274196: Crashes in VM_HeapDumper::work after JDK-8252842 [v4]

2021-09-27 Thread Lin Zang
> The root cause for crash in ZGC is that the JNIHandles are processed before 
> object iteration. And ZGC would update the JNIHandles at object iteration 
> with read barrier. So the crash is cause by accessing the invalid address 
> which can be dummy info after zgc, and hence crash.
> 
> The lock rank issue can be fixed because the related mutexes are acquired in 
> safepoint. so the safepoint_check_required could be safepoint_check_always.
> 
> The Epsilon issue is caused by wrong _num_dumper_thread calculated when the 
> gang==NULL.

Lin Zang has updated the pull request incrementally with one additional commit 
since the last revision:

  remove redundant empty line

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5681/files
  - new: https://git.openjdk.java.net/jdk/pull/5681/files/c1658e19..f6cb2123

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5681&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5681&range=02-03

  Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5681.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5681/head:pull/5681

PR: https://git.openjdk.java.net/jdk/pull/5681