From c08046495c3c1103cf52d1e7ba3d0c03cf70d4c7 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 4 Aug 2024 14:02:27 -0500 Subject: [PATCH] tuned.conf template: support all plugins, update host_vars --- host_vars/localhost.yml | 43 +++++++++++++--------- roles/tuned_amdgpu/tasks/main.yml | 2 + roles/tuned_amdgpu/templates/tuned.conf.j2 | 16 ++++---- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/host_vars/localhost.yml b/host_vars/localhost.yml index 6f93945..fd9fc69 100644 --- a/host_vars/localhost.yml +++ b/host_vars/localhost.yml @@ -10,32 +10,41 @@ gpu_clock_min: "500" # gpu_clock_max: "2675" # default somewhere around 2529 to 2660. -gpu_clock_max: "2750" +gpu_clock_max: "2715" gpumem_clock_static: "1075" gpu_power_multi: - default: 0.869969040247678 # 281W - real default - # overclock: 0.928792569659443 # 300W - slight boost + default: 0.869969040247678 # 281W - real default + # overclock: 0.928792569659443 # 300W + # overclock: 0.959752321981424 # 310W overclock: 1.0 # 323W - full board capability # optional, applies offset (+/-) to GPU voltage by provided mV # only counts for peak and overlock profiles # gpu_mv_offset: "-20" -gpu_mv_offset: "+125" # add 125mV or 0.125V -# gpu_mv_offset: "+50" # add 50mV or 0.05V +# gpu_mv_offset: "+150" # add 150mV or 0.15V +# gpu_mv_offset: "+133" # add 133mV or 0.133V +gpu_mv_offset: "+60" # add 60mV or 0.06V # gpu_mv_offset: "+75" # add 75mV or 0.075V +# gpu_mv_offset: "+125" # add 125mV or 0.125V # '-50' undervolts GPU core voltage 50mV or 0.05V; untested - here be dragons/instability -# optional kernel parameters to set as well -sysctl: # quote ints/cast to string to avoid surprises - kernel.dmesg_restrict: '0' # allow regular users to see the kernel ring buffer - # net.core.default_qdisc: fq # congestion control - # net.ipv4.tcp_congestion_control: bbr2 # cong. control part 2 - # net.core.rmem_max: '33554432' - # net.core.wmem_max: '33554432' - dev.raid.speed_limit_min: '2000000' - dev.raid.speed_limit_max: '6000000' - vm.compaction_proactiveness: '30' # improve THP allocation latency, compact in background - vm.page_lock_unfairness: '1' # make page lock theft slightly more fair - vm.max_map_count: '1048576' # allow some games to run (eg: DayZ) +# 'tuned' plugins - used to set the kernel cmdline via bootloader... and sysctl tunables +plugins: # ref: https://github.com/redhat-performance/tuned/tree/master/tuned/plugins + bootloader: # 'cmdline' allows entries w/ a suffix, names should be unique across *all* profiles. values accept +/- operators + cmdline_amdgpu_general: "delayacct nowatchdog kvm.ignore_msrs=1 kvm_amd.npt=1 amdgpu.ppfeaturemask=0xfff7ffff" + cmdline_amdgpu_hugepages: "default_hugepagesz=1G hugepagesz=1G hugepages=16" + cmdline_amdgpu_iommu: "amd_iommu=on iommu=pt" + cmdline_amdgpu_devs: "nvme_core.default_ps_max_latency_us=0 pci=realloc=off" + sysctl: # quote ints/cast to string to avoid surprises + kernel.dmesg_restrict: '0' # allow regular users to see the kernel ring buffer + # net.core.default_qdisc: fq # congestion control + # net.ipv4.tcp_congestion_control: bbr2 # cong. control part 2 + # net.core.rmem_max: '33554432' + # net.core.wmem_max: '33554432' + dev.raid.speed_limit_min: '65000000' + dev.raid.speed_limit_max: '99999999' + vm.compaction_proactiveness: '30' # improve THP allocation latency, compact in background + vm.page_lock_unfairness: '1' # make page lock theft slightly more fair + vm.max_map_count: '1048576' # allow some games to run (eg: DayZ) diff --git a/roles/tuned_amdgpu/tasks/main.yml b/roles/tuned_amdgpu/tasks/main.yml index 4a2908f..2855c51 100644 --- a/roles/tuned_amdgpu/tasks/main.yml +++ b/roles/tuned_amdgpu/tasks/main.yml @@ -86,6 +86,8 @@ - "{{ base_profiles }}" notify: Restart tuned become: true + tags: + - tuned.conf - name: Ensure tuned is enabled ansible.builtin.service: diff --git a/roles/tuned_amdgpu/templates/tuned.conf.j2 b/roles/tuned_amdgpu/templates/tuned.conf.j2 index 3237eb3..80c71e3 100644 --- a/roles/tuned_amdgpu/templates/tuned.conf.j2 +++ b/roles/tuned_amdgpu/templates/tuned.conf.j2 @@ -4,16 +4,18 @@ include={{ item.1 }} summary={{ item.1 }} + TCP/RAID tweaks + AMDGPU {{ item.0 }} -{% if sysctl is defined %} -[sysctl] -{% for _sysctl, value in sysctl.items() %} -{{ _sysctl }}={{ value }} -{% endfor %} - -{% endif %} # reference/execute AMDGPU control script # used because some sysfs interfaces are transactional # cannot be set by a single param in 'tuned'/[sysfs] [gpuclockscript] type=script script=${i:PROFILE_DIR}/amdgpu-clock.sh +{% if plugins is defined %} +{% for section, options in plugins.items() %} +{#+ give each plugin section some space +#} +[{{ section }}] +{% for key, value in options.items() %} +{{ key }}={{ value }} +{% endfor %} +{% endfor %} +{% endif %}