RFR: 8339771: RISC-V: Reduce icache flushes [v3]

Robbin Ehn rehn at openjdk.org
Thu Sep 19 07:45:13 UTC 2024


> Hey, please consider,
> 
> All code which is offline (behind a barrier) do not need global icache flushes.
> As we can instead in slow path locally (thread and hart) emit fence.i.
> But if we were to be context switch do a hart which have not had fence.i emitted we can still fetch stale instructions.
> To handle this case new now have kernel support:
> https://docs.kernel.org/arch/riscv/cmodx.html
> 
> It's not perfect as we will be emitting fence.i on any context switch for any thread with this patch, even if that thread do not execute on code heap (non attached native thread), and even if there was no changes to code heap.
> But this is in many cases much faster as the icache flush global IPI is very intrusive.
> Particular cases are running a concurrent gc with small head room.
> In such scenario I measured 15% increased throughput on VF2.
> A large CPU or less head room (faster GC cycles) will yield even more performance boost.
> 
> Note that this requires 6.10 kernel.
> 
> I'm running VF2 with 6.11-rc3 kernel and this passed tier1-3. (With setting on)
> 
> Later we probably want this default on, but as it's hard to test I'll leave default off.

Robbin Ehn 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:

 - Merge branch 'master' into cmodx-fence
 - Comment, moved init after feature enabling
 - Fixed ws
 - Draft

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/20913/files
  - new: https://git.openjdk.org/jdk/pull/20913/files/8411301b..5489a0d5

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=20913&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20913&range=01-02

  Stats: 158400 lines in 898 files changed: 147978 ins; 6116 del; 4306 mod
  Patch: https://git.openjdk.org/jdk/pull/20913.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20913/head:pull/20913

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


More information about the hotspot-dev mailing list