Merge pull request #115 from michaelpj/imp/throttled

Replace ad hoc throttling fix with throttled
This commit is contained in:
Jörg Thalheim 2019-10-21 14:52:29 +01:00 committed by GitHub
commit 1ea7efa262
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 47 deletions

View file

@ -1,38 +0,0 @@
{ config, pkgs, ... }:
{
# Temporary fix for cpu throttling issues visible in the kernel log
# (journalctl -k) by setting the same temperature limits used by
# Window$
# See https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues
systemd.services.cpu-throttling = {
enable = true;
description = "CPU Throttling Fix";
documentation = [
"https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues"
];
path = [ pkgs.msr-tools ];
script = "wrmsr -a 0x1a2 0x3000000";
serviceConfig = {
Type = "oneshot";
};
wantedBy = [
"timers.target"
];
};
systemd.timers.cpu-throttling = {
enable = true;
description = "CPU Throttling Fix";
documentation = [
"https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#Power_management.2FThrottling_issues"
];
timerConfig = {
OnActiveSec = 60;
OnUnitActiveSec = 60;
Unit = "cpu-throttling.service";
};
wantedBy = [
"timers.target"
];
};
}

View file

@ -5,7 +5,6 @@
../../../common/cpu/intel/kaby-lake ../../../common/cpu/intel/kaby-lake
../../../common/pc/laptop ../../../common/pc/laptop
../../../common/pc/laptop/acpi_call.nix ../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/cpu-throttling-bug.nix
]; ];
# Force S3 sleep mode. See README.wiki for details. # Force S3 sleep mode. See README.wiki for details.
@ -13,4 +12,6 @@
# touchpad goes over i2c # touchpad goes over i2c
boot.blacklistedKernelModules = [ "psmouse" ]; boot.blacklistedKernelModules = [ "psmouse" ];
services.throttled.enable = lib.mkDefault true;
} }

View file

@ -1,9 +1,10 @@
{ nixos, pkgs, config, stdenv, ... }: { nixos, pkgs, lib, config, stdenv, ... }:
{ {
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix ../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/cpu-throttling-bug.nix
../. ../.
]; ];
services.throttled.enable = lib.mkDefault true;
} }

View file

@ -4,7 +4,8 @@
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix ../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/cpu-throttling-bug.nix
../. ../.
]; ];
services.throttled.enable = lib.mkDefault true;
} }

View file

@ -1,9 +1,8 @@
{ nixos, pkgs, config, stdenv, ... }: { nixos, lib, pkgs, config, stdenv, ... }:
{ {
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix ../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/cpu-throttling-bug.nix
../. ../.
]; ];
@ -26,5 +25,7 @@
LABEL="pulseaudio_end" LABEL="pulseaudio_end"
''; '';
throttled.enable = lib.mkDefault true;
}; };
} }

View file

@ -5,7 +5,6 @@ with lib;
{ {
imports = [ imports = [
../. ../.
../../../../common/pc/laptop/cpu-throttling-bug.nix
]; ];
# Fixes an issue with incorrect battery reporting. See # Fixes an issue with incorrect battery reporting. See
@ -44,4 +43,6 @@ with lib;
videoDrivers = [ "intel" ]; videoDrivers = [ "intel" ];
}) })
]; ];
services.throttled.enable = lib.mkDefault true;
} }

View file

@ -5,15 +5,16 @@
# #
# Enable the lower-power S3 suspend state by upgrading the BIOS to version >= 1.30, # Enable the lower-power S3 suspend state by upgrading the BIOS to version >= 1.30,
# then manually selecting Linux in the power management section. # then manually selecting Linux in the power management section.
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ imports = [
../. ../.
../../../../common/pc/laptop/acpi_call.nix ../../../../common/pc/laptop/acpi_call.nix
../../../../common/pc/laptop/cpu-throttling-bug.nix
]; ];
# New ThinkPads have a different TrackPoint manufacturer/name. # New ThinkPads have a different TrackPoint manufacturer/name.
# See also https://certification.ubuntu.com/catalog/component/input/5313/input%3ATPPS/2ElanTrackPoint/ # See also https://certification.ubuntu.com/catalog/component/input/5313/input%3ATPPS/2ElanTrackPoint/
hardware.trackpoint.device = "TPPS/2 Elan TrackPoint"; hardware.trackpoint.device = "TPPS/2 Elan TrackPoint";
services.throttled.enable = lib.mkDefault true;
} }