RFR: 8295282: Use Zicboz/cbo.zero to zero-out memory on RISC-V [v2]

Vladimir Kempik vkempik at openjdk.org
Mon Oct 17 19:18:59 UTC 2022


On Mon, 17 Oct 2022 12:13:18 GMT, Ludovic Henry <luhenry at openjdk.org> wrote:

>> Similarly to AArch64 DC.ZVA, the RISC-V Zicboz [1] extension provides the cbo.zero [2] instruction that allows to zero out memory a cache-line at a time. This should be faster than storing zeroes 64bits at a time.
>> 
>> [1] https://github.com/riscv/riscv-CMOs
>> [2] https://github.com/riscv/riscv-CMOs/blob/master/cmobase/Zicboz.adoc#insns-cbo_zero
>
> Ludovic Henry has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Fix comment
>  - Fix alignement
>  - Merge branch 'master' of github.com:openjdk/jdk into dev/ludovic/upstream-zicboz
>  - 8295282: Use Zicboz/cbo.zero to zero-out memory on RISC-V
>    
>    Similarly to AArch64 DC.ZVA, the RISC-V Zicboz [1] extension provides the cbo.zero [2] instruction that allows to zero out memory a cache-line at a time. This should be faster than storing zeroes 64bits at a time.
>    
>    [1] https://github.com/riscv/riscv-CMOs
>    [2] https://github.com/riscv/riscv-CMOs/blob/master/cmobase/Zicboz.adoc#insns-cbo_zero

src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp line 117:

> 115:   }
> 116: 
> 117:   _cache_line_size = 64;

Cache line size can be different on various cpus. Hardcoding it isn't nice. if it can't be reliably retrieved at runtime, maybe allow specifying it via some XX option ?

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

PR: https://git.openjdk.org/jdk/pull/10718


More information about the hotspot-dev mailing list