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

MSR Read #211

Closed
wants to merge 20 commits into from
Closed

MSR Read #211

wants to merge 20 commits into from

Conversation

Shuzhengz
Copy link
Collaborator

Reads information from the MSR registries
Also reads current CPU and GPU TDP if used correctly
Closes #41 #131

@Shuzhengz Shuzhengz added the enhancement New ideas or features to add label Feb 6, 2022
@Shuzhengz
Copy link
Collaborator Author

tiny problem
use of unstable library feature 'asm': inline assembly is not stable enough for use and is subject to change

@Shuzhengz Shuzhengz added the help wanted Extra attention is needed label Feb 6, 2022
@Shuzhengz Shuzhengz linked an issue Feb 6, 2022 that may be closed by this pull request
@JakeRoggenbuck
Copy link
Owner

Thanks for going after this one!

@Shuzhengz
Copy link
Collaborator Author

yee

@Shuzhengz
Copy link
Collaborator Author

but yeah if we solve this asm problem we will be able to use it to read MSR, and we can get TDP, GPU TDP, clockspeed, max temp target, and potentially undervolting

@Shuzhengz
Copy link
Collaborator Author

@JakeRoggenbuck okay heres the big brain idea, what if we read from MSR in C, then export the values to rust

@JakeRoggenbuck
Copy link
Owner

MSR

Yea! Does an MSR exist for rust? If not, we could make that library then use it as a dependency in case someone else needs MSR as well.

@JakeRoggenbuck
Copy link
Owner

This is a thing, not sure if it's the right thing, or the best thing https://docs.rs/x86_64/0.1.2/x86_64/registers/msr/index.html

We can always use our own if it's easier and more efficient

@Shuzhengz
Copy link
Collaborator Author

MSR

Yea! Does an MSR exist for rust? If not, we could make that library then use it as a dependency in case someone else needs MSR as well.

Yeah rust does have a MSR library, but it cannot be used in production because asm is nightly and development only

I tried to make a read msr function but it also doesn't build due to unstable inline assembly

@Shuzhengz
Copy link
Collaborator Author

This is a thing, not sure if it's the right thing, or the best thing https://docs.rs/x86_64/0.1.2/x86_64/registers/msr/index.html

We can always use our own if it's easier and more efficient

Yeah I tried to use that one, but the entire core::arch::asm is not available and the library doesn't build properly with our project

@Shuzhengz
Copy link
Collaborator Author

dat's why I said it might be a good idea to read it in c cuz intel actually gives the method to read from MSR in c

@Shuzhengz
Copy link
Collaborator Author

asm is still not stablize enough to be used, stablization PR not made

ill try using C/C++ and see if it works

@JakeRoggenbuck
Copy link
Owner

Great work with this! Looks super good

@JakeRoggenbuck
Copy link
Owner

This is going to be a great addition to acs

@Shuzhengz
Copy link
Collaborator Author

Thx!
I'm still trying to verify if the thing actually works tho, and I haven't integrated it with rust yet

@Shuzhengz
Copy link
Collaborator Author

The documentation on this is... well, intel didn't even bother to make a readme for it

@JakeRoggenbuck
Copy link
Owner

The documentation on this is... well, intel didn't even bother to make a readme for it

Ooof, we might be able to help them out and write some docs for this, and then give it to them lol

@Shuzhengz
Copy link
Collaborator Author

well... yea...

image

@JakeRoggenbuck
Copy link
Owner

Lol, yea, that's a little while ago

@JakeRoggenbuck
Copy link
Owner

Seven years before GitHub was created

@Shuzhengz
Copy link
Collaborator Author

this code is older than anyone here lol

@Shuzhengz
Copy link
Collaborator Author

ayyy got reading msr in hex working in c
image

@Shuzhengz
Copy link
Collaborator Author

probably work on this a later time when we can use asm outside of experimental

@Shuzhengz Shuzhengz closed this Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New ideas or features to add help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPU Find a way to check power usage
2 participants