RFR: 8367137: RISC-V: Detect Zicboz block size via hwprobe [v3]
Robbin Ehn
rehn at openjdk.org
Tue Sep 9 12:55:42 UTC 2025
On Tue, 9 Sep 2025 08:26:43 GMT, Dingli Zhang <dzhang at openjdk.org> wrote:
>> Hi,
>> Can you help to review this patch? Thanks!
>>
>> We can extends RISC-V hwprobe support to include `RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE`.
>> The probed value is recorded in VM_Version::zicboz_block_size and then used to set the global CacheLineSize.
>> This ensures correct usage of the Zicboz extension, as block zeroing instructions operate on cache-line granularity.
>>
>> FYI: https://docs.kernel.org/arch/riscv/hwprobe.html
>
> Dingli Zhang has updated the pull request incrementally with one additional commit since the last revision:
>
> fix some assert
I looked at the kernel side, there is no gauarantee that ZICBOZ_BLOCK_SIZE and ZICBOM_BLOCK_SIZE are the same value.
Also the kernel seems to have a bug, if it can't retrive those value it will return 0 as value for those.
And your patch doesn't consider a user supplied cache line size, e.g. -XX:CacheLineSize=64 or -XX:+UseZic64b.
You should only change the value if the user didn't change it.
This becomes a bit messy, as e.g. UseRVA23U64 mandates zic64b which mandates 64b cache line.
So if user says rva23 he is setting the cache line to 64b IMHO.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27155#issuecomment-3270608461
More information about the hotspot-dev
mailing list