Implement isolcpu grub configuration
Separate cpu for host os from workload.
Change-Id: I5b274a6324fe2fa47c09df82c01e3b95dadb5e53
Epic: PROD-8959
diff --git a/README.rst b/README.rst
index cf61802..7f38c2a 100644
--- a/README.rst
+++ b/README.rst
@@ -288,6 +288,20 @@
echo 7 > /sys/class/net/eth1/device/sriov_numvfs; sleep 2; ifup -a
exit 0
+Isolate CPU options
+~~~~~~~~~~~~~~~~~~~
+
+Remove the specified CPUs, as defined by the cpu_number values, from the general kernel
+SMP balancing and scheduler algroithms. The only way to move a process onto or off an
+"isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the
+maximum value is 1 less than the number of CPUs on the system.
+
+.. code-block:: yaml
+
+ linux:
+ system:
+ kernel:
+ isolcpu: 1,2,3,4,5,6,7 # isolate first cpu 0
Repositories
~~~~~~~~~~~~
diff --git a/linux/system/kernel.sls b/linux/system/kernel.sls
index 87cbf9a..11d5a38 100644
--- a/linux/system/kernel.sls
+++ b/linux/system/kernel.sls
@@ -3,6 +3,21 @@
{%- if system.kernel is defined %}
+{%- if system.kernel.isolcpu is defined %}
+
+include:
+ - linux.system.grub
+
+/etc/default/grub.d/90-isolcpu.cfg:
+ file.managed:
+ - contents: 'GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT isolcpu={{ system.kernel.isolcpu }}"'
+ - require:
+ - file: grub_d_directory
+ - watch_in:
+ - cmd: grub_update
+
+{%- endif %}
+
{%- if system.kernel.version is defined %}
linux_kernel_package:
diff --git a/tests/pillar/system.sls b/tests/pillar/system.sls
index 5fddffe..30968e2 100644
--- a/tests/pillar/system.sls
+++ b/tests/pillar/system.sls
@@ -20,6 +20,8 @@
prompt:
default: "test01.local$"
kernel:
+ sriov: True
+ isolcpu: 1,2,3,4
hugepages:
large:
default: true