-
Notifications
You must be signed in to change notification settings - Fork 28
Adds timestamped polling #174
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
Open
rountree
wants to merge
24
commits into
llnl:main
Choose a base branch
from
rountree:polling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+579
−309
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The type of (((struct class *)0)->devnode) has changed at least twice in the mainline kernel. Coding based on mainline kernel versions has repeatedly run into the problem of distros backporting features to older kernels. Solved here using _Generic and multiple function definitions.
Compiling under Linux 6.9.9 and gcc 10.3.1.
msr_version.h #defines for major, minor, and patch versions of msr-safe as well as helper macros to generate _u32 and string representation. Makefile Removes CURRENT_VERSION and -DVERSION from build. msrsave now gets the version string from msr_version.h msrsave_main.c msr_entry.c Now #includes msr_version.h and uses MSR_SAFE_VERSION_STR msr_safe.h Repurposes a bit of struct padding to hold a _u32-format msr-safe version number. README.md Updates documentation of struct msr_batch_array to note the new version field. Explains how this will remain unused in the 1.x.y series. Version 2.x.y will begin checking this version field to make sure what the user compiled against is the same version as the loaded kernel module. This is necessary due to anticipated batch API changes in version 2.0.0. Tested on serif (Ubuntu 24.04.1 LTS, Linux 6.8.0, gcc 13.2.0)
README.md Describes new error (ENOPROTOOP) that results from a mismatch between the loaded kernel module and what's in the batch request. examples/example.c Updated to use versioning. msr_batch.c Checks for correct version as part of batch request parsing. msr_version.h Bumped version to 2.0.0. Tested on serif.
README.md Added desription of new msr_batch_op struct. Removed example code that no longer compiles in v2.0. examples/example.c Modified to be working example of polling via batch. msr-smp.c Replaced previous read/write code with read/write/poll + timestamp msr_batch.c Small patch to keep allowlist functional. msr_safe.h New op struct.
Documentation not updated Previous code only commented out, not removed.
Debugging enabled in the Makefile. That should be turning off in production. TSC (maybe) and thermal (almost certainly) MSRs are Intel- specific. Would like the flexibility to specify which additional MSRs to read when. module_param() and module_param_array() may be the way forward, but not on this branch. Polling is working very well.
Knowing how long it took to read an MSR hasn't been useful. Nor has knowning both starting and ending temperatures. This version allows for recording TSC, APERF, MPERF, THERM_STATUS, and PACKAGE_THERM_STATUS after the read/write/poll op(s) complete. MPERF and TSC are almost certainly indentical when the core/thread does not leave C0, but the documentation goes out of its way to not say that.
Massive rearrangement of msr_safe.h, including removing "initial_*" measurements, restoring aperf, adding package temperature, and several structs/enums/arrays for userspace.
gcc v9.0 made -Wmissing-attributes more strict, and as a result the #defines around module_init() and cleanup_module() started generating warnings. The #defines were fixed around kernel 5.0. This PR #undefs those two symbols and #defines them according to this patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b999ae3614d09d97a1575936bcee884f912b10e Not tested for icc or clang.
Fixes llnl#188. gcc v8+ can, during compilation, mark code as "cold" that cannot be executed during compliant runs (e.g., executes via undefined behavior). Users can also add the "cold" attribute to functions to indicate they are executed rarely, can be optimized for size rather than speed, and may be placed together with other "cold" functions elsewhere in the binary to improve locality of hot functions. The 4.18 kernel builds an objdump tool that (erroneously?) detects code fallthrough between the write_allowlist() and write_allowlist.cold() functions (and vice versa). Rather than force the use of a more recent objdump, we simple declare the entire function as "cold" for kernels older that v5. The warnings are not present with gcc 15.2.0 and kernel/objdump 6.14.0.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #173.
Adds polling.
Tested on serif.
The example code needs work and the README.md needs a cleanup pass.