RFR: 8273373: Zero: Cannot invoke JVM in primordial threads on Zero

Aleksey Shipilev shade at openjdk.java.net
Wed Sep 8 09:22:08 UTC 2021


On Wed, 8 Sep 2021 07:43:01 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> Bottomline, we should either be using `pthread_attr_getstack(3)` or our `_initial_thread_stack_(bottom|size)` but not mix them since they may differ. Therefore the proposed patch is correct. The non-zero version of `current_stack_region()` in os_linux.cpp handles the primordial thread stack correctly.

Yes, that seems to be the gist of it. In fact, if I reply `_initial_thread_stack_(bottom|size)` in Zero version of `current_stack_region()` for a primordial thread, gtests also start to pass. But I gather there is no need to continue supporting Zero-specific `current_stack_region()`, and thus dodge the issue altogether by using the code the rest of VM code uses.

> src/hotspot/os/linux/os_linux.cpp line 3371:
> 
>> 3369:       assert((uintptr_t)addr >= stack_extent,
>> 3370:              "Sanity: addr should be larger than extent, " PTR_FORMAT " >= " PTR_FORMAT,
>> 3371:              p2i(addr), stack_extent);
> 
> Should we not do something in non-debug builds too? Maybe guarantee() instead?

Nah, I think `assert` is okay here. It is supposed to aid debugging, not crash hard.

-------------

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


More information about the hotspot-runtime-dev mailing list