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

Fix lots of bugs and cleanup code in sysFeatures #637

Merged
merged 67 commits into from
Oct 14, 2024
Merged

Conversation

ipatix
Copy link
Contributor

@ipatix ipatix commented Oct 14, 2024

This PR fixes many small bugs in the sysFeatures module, some of which prevented certain features from working entirely.
In addition, a lot of duplicate code is removed and cleaned up.

field{32,64}set update a value within a bitfield. The extractBitField
function is deprecated as it is already covered by field{32/64}.
Also update uint64-string conversion functions to realloc the result
buffer passed via argument. This way one can simply call the function
repeatedly using the same buffer without having to manually free the
buffer.
Also cleanup the respective getter and setter functions to use bitfield
functions instead of manually shifting around.
Apparently just the wrong bit was tested previously?
Not sure how this was ever supposed to function correctly.
Certainly always showing an error in the debug log in case of the
supposed success does not make any sense.
This commit also distributes header and body code file to be more in
line with the Intel RAPL code. AMD RAPL code is not yet checked for
semantic bugs.
There is still a lot of redundant code for both Intel and AMD. This
should be merged later.
The strings were incorrectly copied when their length exceeded
HWFEATURES_MAX_STR_LENGTH. To solve this we just use strndup, as it is
te perfect fit for correctly copying strings at a maximum size.

In addition adding a feature to an internal feature list used to ignore
the 'tester' and 'unit' field. This would cause corruption later on.
The bounds checking for valid core IDs was wrong, hence why device
creation sometimes failed or succeeded erroneously.
Lots of code tends to iterate over sockets and its available threads.
This commit rewrites the code such that is only done in one place and if
necessary a callback function is used to test for a custom MSR
condition.
@ipatix ipatix merged commit 64eda43 into master Oct 14, 2024
2 checks passed
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.

1 participant