Merge branch 'power_management'

This commit is contained in:
Tom Alexander 2022-10-15 20:55:16 -04:00
commit 22ec0d596c
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
12 changed files with 84 additions and 7 deletions

View File

@ -11,3 +11,4 @@ network_rc: "homeserver_network.conf"
rc_conf: "homeserver_rc.conf"
loader_conf: "homeserver_loader.conf"
cputype: "intel"
hwpstate: false

View File

@ -11,3 +11,5 @@ network_rc: "odofreebsd_network.conf"
rc_conf: "odofreebsd_rc.conf"
loader_conf: "odofreebsd_loader.conf"
cputype: "intel"
hwpstate: true
cores: 8

View File

@ -4,6 +4,6 @@ sendmail_enable="NONE"
hostname="computer"
local_unbound_enable="YES"
sshd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"

View File

@ -4,7 +4,6 @@ sendmail_enable="NONE"
hostname="odo"
local_unbound_enable="YES"
sshd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"

View File

@ -0,0 +1 @@
aesni_load="YES"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#
# Tell speedshift whether to maximize CPU performance (100) or energy
# efficiency (0).
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
perc=$1
epp=$((100 - perc))
sysctl -N dev.hwpstate_intel | grep -E 'dev.hwpstate_intel.[0-9]+.epp' | while read var; do
sysctl "$var=$epp"
done

View File

@ -0,0 +1 @@
cpuctl_load="YES"

View File

@ -0,0 +1,2 @@
# Control each core individually
machdep.hwpstate_pkg_ctrl=0

View File

@ -0,0 +1,2 @@
powerdxx_enable=YES
powerdxx_flags="-n adaptive -a adaptive -b adaptive"

View File

@ -1,3 +1,10 @@
- name: Install packages
package:
name:
- lscpu # need to kldload cpuctl
- powermon # need to kldload cpuctl
state: present
- name: Install loader.conf
copy:
src: "files/{{ item }}_loader.conf"
@ -7,6 +14,8 @@
group: wheel
loop:
- coretemp
- cpuctl
- aesni
- name: Install Configuration
copy:
@ -18,3 +27,54 @@
loop:
- src: power_profile.conf
dest: /etc/rc.conf.d/power_profile
- name: Install packages
when: hwpstate is defined and not hwpstate
package:
name:
- powerdxx
state: present
- name: Install service configuration
when: hwpstate is defined and not hwpstate
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0644
owner: root
group: wheel
with_items:
- src: powerdxxrc.conf
dest: /etc/rc.conf.d/powerdxx
- name: Favor energy efficiency for Speed Shift
when: hwpstate is defined and hwpstate and cores is defined
sysctl:
name: "dev.hwpstate_intel.{{ item }}.epp"
value: 100
state: present
sysctl_file: "/etc/sysctl.conf.local"
loop: "{{ range(0, cores, 1)|list }}"
- name: Install scripts
when: hwpstate is defined and hwpstate
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: cpu_set_perf_perc
dest: /usr/local/bin/cpu_set_perf_perc
- name: Install loader.conf
when: hwpstate is defined and hwpstate
copy:
src: "files/{{ item }}_loader.conf"
dest: "/boot/loader.conf.d/{{ item }}.conf"
mode: 0644
owner: root
group: wheel
loop:
- percorespeedshift

View File

@ -1,4 +0,0 @@
- name: restart ntpdate
service:
name: ntpdate
state: restarted

View File

@ -1,5 +1,4 @@
- name: Install Configuration
notify: restart ntpdate
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"