-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8374056: RISC-V: Fix argument passing for the RiscvFlushIcache::flush #28886
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
base: master
Are you sure you want to change the base?
8374056: RISC-V: Fix argument passing for the RiscvFlushIcache::flush #28886
Conversation
|
Hi @ikarostsin, welcome to this OpenJDK project and thanks for contributing! We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user ikarostsin" as summary for the issue. If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing |
|
❗ This change is not yet ready to be integrated. |
|
@ikarostsin The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
|
/signed |
|
Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated! |
|
This seems related to https://bugs.openjdk.org/browse/JDK-8310656. Before JDK-8310656, we used to do a @robehn : Could you please confirm that? |
RealFYang
left a comment
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.
LGTM.
|
|
||
| RiscvFlushIcache::flush((uintptr_t)addr, ((uintptr_t)lines) << ICache::log2_line_size); | ||
| uintptr_t end = (uintptr_t)addr + ((uintptr_t)lines << ICache::log2_line_size); | ||
| RiscvFlushIcache::flush((uintptr_t)addr, end); |
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.
I checked latest kernel code (6.6 - 6.18), the syscall doesn't currently do anything with the address range.
I think that's why this doesn't affect functionality. But this needs to be fixed to avoid possible confusion.
(Created new JBS: https://bugs.openjdk.org/browse/JDK-8374056)
/*
* Allows the instruction cache to be flushed from userspace. Despite RISC-V
* having a direct 'fence.i' instruction available to userspace (which we
* can't trap!), that's not actually viable when running on Linux because the
* kernel might schedule a process on another hart. There is no way for
* userspace to handle this without invoking the kernel (as it doesn't know the
* thread->hart mappings), so we've defined a RISC-V specific system call to
* flush the instruction cache.
*
* sys_riscv_flush_icache() is defined to flush the instruction cache over an
* address range, with the flush applying to either all threads or just the
* caller. We don't currently do anything with the address range, that's just
* in there for forwards compatibility.
*/
SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, uintptr_t, end,
uintptr_t, flags)
{
/* Check the reserved flags. */
if (unlikely(flags & ~SYS_RISCV_FLUSH_ICACHE_ALL))
return -EINVAL;
flush_icache_mm(current->mm, flags & SYS_RISCV_FLUSH_ICACHE_LOCAL);
return 0;
}
|
Yes, so it looks like I got careless with the argument as I did know they did not matter... My confusion came from: Thanks for fixing ! |
Based on the implementation of RiscvFlushIcache::flush, the second parameter should be the end address rather than the size of the memory region.
So this commit corrects the erroneous parameter passed to RiscvFlushIcache::flush in the icache_flush function call.
Progress
Error
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28886/head:pull/28886$ git checkout pull/28886Update a local copy of the PR:
$ git checkout pull/28886$ git pull https://git.openjdk.org/jdk.git pull/28886/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28886View PR using the GUI difftool:
$ git pr show -t 28886Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28886.diff