RFR: 8330275: Crash in XMark::follow_array [v3]
Stefan Karlsson
stefank at openjdk.org
Fri Apr 26 12:47:36 UTC 2024
On Thu, 25 Apr 2024 14:28:47 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
>> This PR addresses the issue in ZGC where the number of address offset bits can go beyond the limit imposed by the encoding scheme in mark stack, thereby causing the encoding to fail.
>> Encoding of partial array offset in mark stack requires that the address offset be no more than 44 bits. But the current mechanism to probe maximum address offset bits on aarch64, riscv and ppc platforms can return value larger that 44 bits. This patch sets the maximum address offset bits to 44.
>>
>> I have updated the generational mode to avoid subtracting 3 bits from the maximum address offset bit probed by the system, as the generational mode does not use multi-mapping.
>>
>> I have also updated the code to set MarkPartialArrayMinSizeShift dynamically depending on the number of address offset bits used. This would avoid running into such problem again if in future maximum address offset bits is increased beyond 44.
>>
>> For some reason (that I can't comprehend from the code) the existing implementation for probing the max addressable bit for ppc in non-generation ZGC is very different from other platforms and from generational mode as well. I have kept the existing implementation as is and just fixed it to ensure it does not return value greater than 44 bits.
>>
>> Testing: test/hotspot/jtreg/gc/z and test/hotspot/jtreg/gc/x on x86
>
> Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix typos
>
> Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>
So, the absolute minimal point-fix would be to change the value 47 to 46, which would be very easy to backport, right?
If we still want to make the change that is currently in the PR I would like to tweak the code along the lines of what I've in my branch here:
https://github.com/openjdk/jdk/compare/master...stefank:jdk:pr_18941
The extra patch:
* Moves the global constants to the file I think they more belong to
* Moves all the probe bit handling into `ZPlatformAddressOffsetBits`
* Extracts some of the "bit-to-bits" calculations into intermediate constants
The last two points where done to (at least for me) see and understand why the various plus and minuses where performed.
I didn't touch the PPC code, since it's quite difference and I don't want to risk messing it up.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18941#issuecomment-2079316745
More information about the hotspot-gc-dev
mailing list