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

nixos/auto-cpufreq: init module #109065

Merged
merged 1 commit into from Feb 5, 2021

Conversation

Technical27
Copy link
Contributor

@Technical27 Technical27 commented Jan 12, 2021

Motivation for this change

auto-cpufreq was added in #106985, this module provides a systemd service for the daemon.

Things done

add a basic module, fix the attribute name for auto-cpufreq, and include systemd service in the package.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add it to nixos/modules/module-list.nix.

nixos/modules/services/hardware/auto-cpufreq.nix Outdated Show resolved Hide resolved
@Technical27
Copy link
Contributor Author

I just realized that the attribute name is wrong (autocpu-freq instead of auto-cpufreq). I'm just going to have to include that in this PR.

@aanderse
Copy link
Member

@Technical27 does the program itself takes care of log rotation, or does it depend on the distribution to do this?

@Technical27
Copy link
Contributor Author

I just did some tests and the log file doesn't seem to clear on reboot or service stop. We could add some timer/service to do echo > /var/log/auto-cpufreq.log. The file needs to exist, but the echo would clear the file.

@aanderse
Copy link
Member

Strange... upstream doesn't handle this or provide a recommendation. It looks like arch doesn't explicitly handle this either 🤔

Can you please create an issue upstream asking what distributions are supposed to do?

@Technical27
Copy link
Contributor Author

Since AdnanHodzic/auto-cpufreq#146 got merged, I need to update the package to 1.5.3. The log file clears itself now and the size doesn't go above 1KB.

@aanderse
Copy link
Member

Exceptional work @Technical27! You really went above and beyond there. Thanks for fixing this upstream so every distro benefits now. Full bonus points awarded!

@Technical27
Copy link
Contributor Author

Alright, I rebased to master and updated the module.

@bbigras
Copy link
Contributor

bbigras commented Jan 25, 2021

I have a dumb question. Why not log to stdout and let journald take care of the rotation/deleting old entries?

@Technical27
Copy link
Contributor Author

The problem was that auto-cpufreq prints a giant amount of info like current distro, kernel, cpu state and more. The file grows about 1-2KB every 5 seconds, and it got to 126MB on my laptop. letting journald take care of the log rotation would have clogged the logs with not very critical info. With my changes to upstream, the file clears itself after every refresh so the size remains at around 1-2KB max.

@bbigras
Copy link
Contributor

bbigras commented Jan 25, 2021

Gotcha. Thanks

@Technical27
Copy link
Contributor Author

/marvin opt-in
/status needs_reviewer

@marvin-mk2
Copy link

marvin-mk2 bot commented Jan 28, 2021

Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here.

@marvin-mk2
Copy link

marvin-mk2 bot commented Feb 1, 2021

Reminder: Please review!

This Pull Request is awaiting review. If you are the assigned reviewer, please have a look. Try to find another reviewer if necessary. If you can't, please say so. If the status is not accurate, please change it. If nothing happens, this PR will be should be put back in the needs_reviewer queue in one day.


Note: This feature is currently broken. The bot will not actually change the status. If you see this message multiple times, please request a status change manually.

@Technical27
Copy link
Contributor Author

/status needs_reviewer

@bbigras
Copy link
Contributor

bbigras commented Feb 4, 2021

I'll give this a try.

Copy link
Contributor

@bbigras bbigras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work fine.

@bbigras
Copy link
Contributor

bbigras commented Feb 5, 2021

/status needs_merger

@marvin-mk2 marvin-mk2 bot requested a review from kevincox February 5, 2021 01:16
@kevincox kevincox merged commit 48f6dbe into NixOS:master Feb 5, 2021
@Technical27 Technical27 deleted the add-auto-cpufreq-module branch February 10, 2021 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants