Skip to content
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

tokio: fix cache line size for RISC-V #5994

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

Icenowy
Copy link
Contributor

@Icenowy Icenowy commented Sep 10, 2023

Motivation

When reading the tokio source code, I realized it currently uses 32B cache line size for RISC-V, which seems to be not sufficient. (Go uses 32B too, but it's currently known to be too small, see [1])

[1] https://go-review.googlesource.com/c/go/+/526659

Solution

Removing all set cache line size of 32B for riscv*, and add reference from kernel that uses 64B cache line size.

@github-actions github-actions bot added R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR labels Sep 10, 2023
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Sep 10, 2023
@Darksonn
Copy link
Contributor

Thanks. Please run rustfmt on the file.

(You can't use cargo fmt in our repository because it doesn't support it. You must call rustfmt directly.)

Currently tokio uses cache line size data from Go, which is not
sufficient at least for T-Head C910 cores.

The RISC-V Profiles document defines a maximum 64 bytes cache line for
RVA22U64 (although the maximum is 128 bytes for RVA20U64), and the Linux
kernel currently assumes 64B cache line too.

Change the cache line size used to 64 bytes to match Linux and RVA22U64.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@Darksonn Darksonn enabled auto-merge (squash) September 11, 2023 07:03
@Darksonn Darksonn merged commit 1c428cc into tokio-rs:master Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime R-loom-current-thread Run loom current-thread tests on this PR R-loom-multi-thread Run loom multi-thread tests on this PR R-loom-multi-thread-alt Run loom multi-thread alt tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants