-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8339771: RISC-V: Reduce icache flushes #20913
Conversation
👋 Welcome back rehn! A progress list of the required criteria for merging this PR into |
@robehn This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
Thank you @luhenry ! |
This is interesting. Thanks for trying this out. |
I am trying to compare this with #9770 which removes unnecessary fence.i used in user space. I was thinking that this PR might add those fence.i back under |
|
We have two major categories of cmodx:
The patch you are referring to was dealing with 1, which we shouldn't IMHO. 1: When we updates oops in code stream during safepoint or with nmethod barrier locked in Relocation::pd_set_data_value we do not need to flush. |
What's the unit of measurement? Also, lower is better? higher is better? |
Those are measured in milliseconds to completion, so lower is better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sharing the performance numbers. It's a pity that I can't try this on my big RV machine for now which runs an older customized 6.1 kernel. BTW: Should we add similar checking like verify_cross_modify_fence_not_required()
which was called in MacroAssembler::read_polling_page()
& MacroAssembler::build_frame()
and removed by #9770? (-XX:+VerifyCrossModifyFence)
As we have two cases: The second case, writing in the code stream in methods with nmethod barrier locked, would be essentially be a verfication of the barrier and the _patching_epoch. So I don't believe this patch require any additional verification, but we may need verification. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated change looks reasonable to me. Thanks for the answers and details.
Thanks @Hamlin-Li, @luhenry and @RealFYang ! |
/integrate |
Going to push as commit 97a3933.
Your commit was automatically rebased without conflicts. |
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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20913/head:pull/20913
$ git checkout pull/20913
Update a local copy of the PR:
$ git checkout pull/20913
$ git pull https://git.openjdk.org/jdk.git pull/20913/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20913
View PR using the GUI difftool:
$ git pr show -t 20913
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20913.diff
Webrev
Link to Webrev Comment