From 3354994941d5f8d27c53981dade9dd6c8d276cfb Mon Sep 17 00:00:00 2001 From: Peter Mikus Date: Fri, 6 Jul 2018 05:18:01 +0000 Subject: Add Skylake optimization to ansible - Add kernel params - Add TurboBoost managing Change-Id: I9d9561290f8f6780ff41f3a418a1f335d935d843 Signed-off-by: Peter Mikus --- .../roles/tg_sut/files/disable-turbo-boost.service | 10 +++++++ .../ansible/roles/tg_sut/tasks/main.yaml | 33 ++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service (limited to 'resources/tools/testbed-setup') diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service new file mode 100644 index 0000000000..e04729de50 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/disable-turbo-boost.service @@ -0,0 +1,10 @@ +[Unit] +Description=Disable Turbo Boost on Intel CPU + +[Service] +ExecStart=/bin/sh -c 'for core in `cat /proc/cpuinfo | grep processor | awk \'{print $3}\'`; do sudo wrmsr -p$core 0x1a0 0x4000850089; done' +ExecStop=/bin/sh -c 'for core in `cat /proc/cpuinfo | grep processor | awk \'{print $3}\'`; do sudo wrmsr -p$core 0x1a0 0x850089; done' +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml index eeaeed4ffb..1774134abe 100644 --- a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml @@ -52,7 +52,7 @@ path: '/etc/default/grub' state: 'present' regexp: '^GRUB_CMDLINE_LINUX=' - line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt"' + line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} numa_balancing=disable intel_pstate=disable intel_iommu=on iommu=pt nmi_watchdog=0 audit=0 nosoftlockup processor.max_cstate=1 intel_idle.max_cstate=1 hpet=disable tsc=reliable mce=off"' notify: ['Update GRUB'] tags: set-grub @@ -68,5 +68,34 @@ tags: install-pip - name: Load vfio-pci by default - raw: 'echo vfio-pci | sudo tee -a /etc/modules' + lineinfile: + path: '/etc/modules' + state: 'present' + line: 'vfio-pci' tags: load-vfio-pci + +- name: Load msr by default + lineinfile: + path: '/etc/modules' + state: 'present' + line: 'msr' + tags: disable-turbo-boost + +- name: Disable Turbo-Boost by service + copy: + src: 'files/disable-turbo-boost.service' + dest: '/etc/systemd/system/disable-turbo-boost.service' + owner: 'root' + group: 'root' + mode: '0644' + when: > + inventory_hostname in groups['skylake'] + tags: disable-turbo-boost + +- name: Disable Turbo-Boost by service on startup + service: + name: disable-turbo-boost + enabled: yes + when: > + inventory_hostname in groups['skylake'] + tags: disable-turbo-boost -- cgit 1.2.3-korg