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
undervolt: init at 0.2.8 #44919
undervolt: init at 0.2.8 #44919
Conversation
@GrahamcOfBorg build undervolt Unless I'm missing something, the code itself in a whole looks fine. I made some notes as a review. |
9d6113e
to
4e8a2ad
Compare
Success on aarch64-linux (full log) Attempted: undervolt Partial log (click to expand)
|
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: undervolt Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: undervolt Partial log (click to expand)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said, looks fine. Not approving because of my nitpicks, but not outright requesting changes in case another reviewer feels I'm overly zealous.
target (CPU will throttle when this temperature is reached). | ||
''; | ||
license = licenses.gpl2; | ||
platforms = platforms.linux; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it builds on ARM, I'm pretty sure it won't work as it's for intel hardware. Furthermore, I would be surprised if it did anything for 32-bit processors. Might be better to only target x86_64
platforms = [ "x86_64-linux" ];
undervolt derivation to use. | ||
''; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(In the following options) it might be better to drop the Disregard that as there are more than voltage offsets.Offset
suffix from the option names, pretty redundant and they're all offsets, except for enable
and package
.
It may be worthwhile to look into supporting other options like --temp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I've added temp support and tested that it works on my NixOS machine
8f5dede
to
ab8c757
Compare
Would be better to bump the version to 0.2.8. At least for my dear xps (cough georgewhewell/undervolt#25). sha256 = "0crkqc5zq0gpyg031hfwdxymfc2gc1h8b6m0axzlh7gvnxlf5hra"; |
ab8c757
to
86a183f
Compare
Done! I tested 0.2.8 on my machine and it seems to be working fine. Let me know if there are any other issues :) Edit: I've also rebased this branch against latest master again so hopefully there shouldn't be any conflicts if we feel it's ready to merge |
86a183f
to
3affc59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, can't actually test it, but seeing there are two users already is good.
Just re-reading the code and saw some stuff, do comment/resolve as needed and I think then it'll be good to merge.
ExecStart = '' | ||
${pkgs.undervolt}/bin/undervolt -v \ | ||
${optionalString (cfg.coreOffset != null) "--core ${cfg.coreOffset}"} \ | ||
${optionalString (cfg.coreOffset != null) "--cache ${cfg.coreOffset}"} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it wanted that --cache
uses cfg.coreOffset
?
Yes it is:
Core or Cache offsets have no effect. It is not possible to set different offsets for CPU Core and Cache. The CPU will take the smaller of the two offsets, and apply that to both CPU and Cache. A warning message will be displayed if you attempt to set different offsets.
Please add a comment explaining so there's nobody trying to helpfully "fix" what's not to be fixed.
@@ -0,0 +1,29 @@ | |||
{ stdenv, fetchFromGitHub, python3Packages }: | |||
|
|||
with python3Packages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's generally better to use with
only with flat lists or sets; makes it easier to understand what the identifiers refer to.
In your particular case, removing the with
statement, then changing buildPythonApplication
to python3Packages.buildPythonApplication
works fine.
(Using with stdenv.lib
in meta is fine)
3affc59
to
8f30703
Compare
@samueldr: Thanks for the review! I've implemented your recommendations. I also noticed that the logging in Finally I've rebased this against master so hopefully there shouldn't be any conflicts if we feel it's ready to merge. Thanks again and please let me know if there's anything else preventing this from being merged :) |
We want to be able to configure persistent undervolting in the NixOS configuration
8f30703
to
4142020
Compare
@samueldr: Thanks for approving the changes! I'm just wondering if there's anything else that needs to be done to merge this branch? I don't have permission to merge so I'm not sure if I should just wait for someone else to click the merge button or if I need to make any changes/reach out to anyone to get it sorted out. |
Hey @Vodurden, is there a specific reason the undervolt needs to be applied every 2min? The service activation is spamming my journal. |
Hi @Atemu, I don't think there is any reason it needs to be 2 minutes. I copied the duration from the README of undervolt: https://github.com/georgewhewell/undervolt Re-reading the README it looks like they actually use a 30 second interval. I'm not sure why it needs to be so short but at the time I wrote this PR I didn't dig into the reason why. I wouldn't be surprised if just setting the value on boot works fine but you'd need to test it to be sure :) |
Thanks! I found at least one while hacking around on it, the voltages are reset after resume. |
Yeah that's the reason why there's a timer, I use an alternate version.
|
Thanks! I experimented around a bit with this and found that the first declaration can be condensed down into systemd.services.undervolt.wantedBy = [ "post-resume.target" "multi-user.target" ];
systemd.services.undervolt.after = [ "post-resume.target" ]; What exactly does the second one do? I'm not too familiar with udev but it looks like it's supposed to deal with power supply changes? |
It may be a problem with certain CPUs or computers, anyway if you need more help create a new issue instead of commenting here. |
Motivation for this change
Undervolt is a tool that lets you configure the voltage supplied to Intel CPUs on Linux. This is particularly useful for reducing the thermal footprint of a laptop.
This change almost fits CONTRIBUTING.md but I'm not sure who the maintainer should be. Is that something I should add myself to?
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)