Skip to content

CycleClock: use RDTIME instead of RDCYCLE on RISC-V#1727

Merged
dmah42 merged 2 commits into
google:mainfrom
aurel32:riscv-rdtime
Jan 4, 2024
Merged

CycleClock: use RDTIME instead of RDCYCLE on RISC-V#1727
dmah42 merged 2 commits into
google:mainfrom
aurel32:riscv-rdtime

Conversation

@aurel32

@aurel32 aurel32 commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on RISC-V and can't be used directly from userland. There is a sysctl option to change that as a transition period, but it will eventually disappear.

Use RDTIME instead, which while less accurate has the advantage of being synchronized between CPU (and thus monotonic) and of constant frequency.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3

Starting with Linux 6.6 [1], RDCYCLE is a privileged instruction on
RISC-V and can't be used directly from userland. There is a sysctl
option to change that as a transition period, but it will eventually
disappear.

Use RDTIME instead, which while less accurate has the advantage of being
synchronized between CPU (and thus monotonic) and of constant frequency.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3
@dmah42 dmah42 merged commit 99bdb21 into google:main Jan 4, 2024
@dmah42

dmah42 commented Jan 4, 2024

Copy link
Copy Markdown
Member

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants