NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.15k stars 13.42k forks source link

Powertop no longer shows cpufreq_stats ( CPU_FREQ_STATS is turned off in kernel ) #56102

Open dysinger opened 5 years ago

dysinger commented 5 years ago

Issue description

Powertop service doesn't load with systemd

Steps to reproduce

Enable the powertop service in your nixos config

  powerManagement.enable = true;
  powerManagement.powertop.enable = true;

Technical details

After powertop tries to load (& fails) you can see why:

➜ sudo -i journalctl -xe|grep -i cpufreq_stats
[sudo] password for tim: 
Feb 20 11:26:58 deneb powertop[1068]: modprobe cpufreq_stats failedLoaded 0 prior measurements
Feb 20 11:28:02 deneb powertop[2898]: modprobe cpufreq_stats failedLoaded 0 prior measurements
Feb 20 11:28:45 deneb sudo[3153]:      tim : TTY=pts/0 ; PWD=/home/tim ; USER=root ; COMMAND=/run/current-system/sw/bin/modprobe cpufreq_stats
Feb 20 11:35:55 deneb sudo[5938]:      tim : TTY=pts/0 ; PWD=/home/tim ; USER=root ; COMMAND=/run/current-system/sw/bin/modprobe cpufreq_stats

➜ zcat /proc/config.gz|grep -i CONFIG_CPU_FREQ
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
# CONFIG_CPU_FREQ_STAT is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=m
CONFIG_CPU_FREQ_GOV_USERSPACE=m
CONFIG_CPU_FREQ_GOV_ONDEMAND=m
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
teto commented 5 years ago

Hoping something like https://github.com/NixOS/nixpkgs/pull/55755 would help.

CrazedProgrammer commented 5 years ago

Shouldn't this be enabled by default in common-config.nix?

EDIT: Tried compiling with CONFIG_CPU_FREQ_STAT=y, which succeeded (checked in /proc/config.gz), but I can't find the cpufreq_stats module anywhere. Powertop still doesn't work because of this.

mixmixmix commented 4 years ago

Apologies for my ignorance. Does modprobe cpufreq_stats failed mean that powertop has no way of controlling CPU throttling and is therefore very limited in what it can tune? I have powertop setup on an old laptop with Nix and my battery life is significantly lower than reported by others with this model. Thanks

thechitowncubs commented 4 years ago

It needs to be patched to load the different modules of cpufreq based on CPU type.

It's less useful for managing CPU frequency in newer kernels.

stale[bot] commented 3 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

andrew-d commented 3 years ago

This is still important to me

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

pannal commented 3 years ago

This is still an issue.

Strazil001 commented 1 year ago

And still is

Xses-1 commented 1 year ago

And still is

mrobbetts commented 10 months ago

Wait, what needs to be done here? Is compiling the kernel with CONFIG_CPU_FREQ_STAT not enough? How do other distros make this thing work?

ParetoOptimalDev commented 10 months ago

Also interested in this. It might be one of the reasons I seem to have worse battery life on my framework laptop using NixOS.