Skip to content

mpk: allow benchmarking MPK#7787

Merged
alexcrichton merged 3 commits into
bytecodealliance:mainfrom
abrown:pku-benchmark
Jan 18, 2024
Merged

mpk: allow benchmarking MPK#7787
alexcrichton merged 3 commits into
bytecodealliance:mainfrom
abrown:pku-benchmark

Conversation

@abrown
Copy link
Copy Markdown
Member

@abrown abrown commented Jan 17, 2024

These changes allow one to measure the effect of MPK on WebAssembly boundary crossings (guest-host and vice-versa). I also includes some small but distracting bits that affect the measured overhead.

This change takes advantage of the `WASMTIME_TEST_FORCE_MPK` environment
variable to force its use in the `call.rs` benchmarks. I see differences
in several cases when running:

```console
$ taskset --cpu-list 0-15 cargo bench -- async
$ WASMTIME_TEST_FORCE_MPK=1 taskset --cpu-list 0-15 cargo bench -- async
```

To properly isolate the MPK effects, this adds a `sync-pool` option
(`IsAsync::NoPooling`).
@abrown abrown requested review from a team as code owners January 17, 2024 23:57
@abrown abrown requested review from fitzgen and removed request for a team January 17, 2024 23:57
After noticing some minor effects with this PKRU read, I chose to avoid
it unless logging is enabled. A perfectly valid alternative would be to
remove the logging altogether, but I have found this very helpful when
trying to troubleshoot MPK issues.
To avoid any unnecessary call overhead, we hint to the compiler that
`pkru::read` and `pkru::write` should be inlined.
@alexcrichton alexcrichton added this pull request to the merge queue Jan 18, 2024
Merged via the queue into bytecodealliance:main with commit f3b5478 Jan 18, 2024
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