RFR: 8367137: RISC-V: Detect Zicboz block size via hwprobe [v5]

Dingli Zhang dzhang at openjdk.org
Thu Sep 11 00:49:45 UTC 2025


On Thu, 11 Sep 2025 00:31:27 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> Dingli Zhang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refine comments and formatting
>
> src/hotspot/cpu/riscv/vm_version_riscv.cpp line 190:
> 
>> 188:     }
>> 189:     if (FLAG_IS_DEFAULT(BlockZeroingLowLimit)) {
>> 190:       FLAG_SET_DEFAULT(BlockZeroingLowLimit, 2 * zicboz_block_size.value());
> 
> Seems to me some extra change is needed at the use of `zero_dcache_blocks` in file stubGenerator_riscv.cpp:
> 
> diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
> index 7db426327ee..9ab16dea39b 100644
> --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
> +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp
> @@ -683,10 +683,11 @@ class StubGenerator: public StubCodeGenerator {
>      address start = __ pc();
> 
>      if (UseBlockZeroing) {
> -      // Ensure count >= 2*CacheLineSize so that it still deserves a cbo.zero
> -      // after alignment.
> +      int zicboz_blk_size = VM_Version::zicboz_block_size.value();
> +      // Ensure count >= 2 * zicboz_block_size so that it still deserves
> +      // a cbo.zero after alignment.
>        Label small;
> -      int low_limit = MAX2(2 * CacheLineSize, BlockZeroingLowLimit) / wordSize;
> +      int low_limit = MAX2(2 * zicboz_blk_size, BlockZeroingLowLimit) / wordSize;
>        __ mv(tmp1, low_limit);
>        __ blt(cnt, tmp1, small);
>        __ zero_dcache_blocks(base, cnt, tmp1, tmp2);

Thanks! Fixed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27155#discussion_r2338242027


More information about the hotspot-dev mailing list