Skip to content

Commit

Permalink
Bump TuneD to the latest OCP-shipped TuneD upstream version
Browse files Browse the repository at this point in the history
Changed Makefile and ran: "make clone-tuned".
  • Loading branch information
jmencak committed Feb 7, 2024
1 parent 51e073f commit 20ffe15
Show file tree
Hide file tree
Showing 59 changed files with 911 additions and 366 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -14,7 +14,7 @@ REV=$(shell git describe --long --tags --match='v*' --always --dirty)

# Upstream tuned daemon variables
TUNED_REPO:=https://github.com/redhat-performance/tuned.git
TUNED_COMMIT:=850368d2f89681725e9bd5eb2dfb44ad2226bc73
TUNED_COMMIT:=954bc4624db8fb345e9fb264ee2ac09d1736105a
TUNED_DIR:=daemon

# API-related variables
Expand Down
20 changes: 20 additions & 0 deletions assets/tuned/daemon/com.redhat.tuned.policy
Expand Up @@ -227,4 +227,24 @@
</defaults>
</action>

<action id="com.redhat.tuned.get_instances">
<description>Get list of active TuneD plugin instances</description>
<message>Authentication is required to get list of active TuneD plugin instances</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

<action id="com.redhat.tuned.instance_get_devices">
<description>Get list of devices assigned to the instance</description>
<message>Authentication is required to get list of devices assigned to the instance</message>
<defaults>
<allow_any>yes</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

</policyconfig>
19 changes: 18 additions & 1 deletion assets/tuned/daemon/man/tuned-adm.8
Expand Up @@ -24,7 +24,7 @@
tuned\-adm - command line tool for switching between different tuning profiles
.SH SYNOPSIS
.B tuned\-adm
.RB [ list " | " active " | " "profile \fI[profile]\fP..." " | " "profile_info \fI[profile]\fP..." " | " off " | " auto_profile " | " profile_mode " | " "verify \fI[\-i | \-\-ignore\-missing]\fP" " | " recommend ]
.RB [ list " | " active " | " "profile \fI[profile]\fP..." " | " "profile_info \fI[profile]\fP..." " | " off " | " auto_profile " | " profile_mode " | " "verify \fI[\-i | \-\-ignore\-missing]\fP" " | " recommend " | " "instance_acquire_devices \fIdevices\fP \fIinstance\fP" " | " "get_instances \fI[plugin]\fP" " | " "instance_get_devices \fIinstance\fP" ]

.SH DESCRIPTION
This command line utility allows you to switch between user definable tuning
Expand Down Expand Up @@ -110,6 +110,23 @@ Enable automatic profile selection mode, switch to the recommended profile.
.B profile_mode
Show current profile selection mode.

.TP
.B "instance_acquire_devices \fIdevices\fP \fIinstance\fP"
Move all provided \fIdevices\fP under the given plugin \fIinstance\fP. The plugin
instance is identified using its name from the TuneD profile.

The devices are specified using a comma-separated list. When moving a set of CPUs,
it is possible to use the cpulist syntax by including the 'cpulist:' prefix.
For instance, 'cpulist:0,2-4' will move the devices cpu0, cpu1, cpu2, and cpu4.

.TP
.B "get_instances \fI[plugin]\fP"
List active instances of a given plugin or all active instances if no plugin is specified.

.TP
.B "instance_get_devices \fIinstance\fP"
List devices currently assigned to a given instance.

.TP
.B off
Unload tunings.
Expand Down
6 changes: 0 additions & 6 deletions assets/tuned/daemon/profiles/cpu-partitioning/tuned.conf
Expand Up @@ -37,12 +37,6 @@ assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_exp

cmd_isolcpus=${f:regex_search_ternary:${no_balance_cores}:\s*[0-9]: isolcpus=${no_balance_cores}:}

[sysctl]
kernel.hung_task_timeout_secs = 600
kernel.nmi_watchdog = 0
vm.stat_interval = 10
kernel.timer_migration = 0

[sysfs]
/sys/bus/workqueue/devices/writeback/cpumask = ${not_isolated_cpumask}
/sys/devices/virtual/workqueue/cpumask = ${not_isolated_cpumask}
Expand Down
4 changes: 2 additions & 2 deletions assets/tuned/daemon/profiles/functions
Expand Up @@ -566,7 +566,7 @@ disable_ksm()
die "failed to create $KSM_MASK_FILE"
fi
# Do not run any systemctl commands if $KSM_SERVICES units do not exist
systemctl cat -- $KSM_SERVICES &> /dev/null || return
systemctl cat -- $KSM_SERVICES &> /dev/null || return 0
systemctl --now --quiet mask $KSM_SERVICES
# Unmerge all shared pages
test -f $KSM_RUN_PATH && echo 2 > $KSM_RUN_PATH
Expand All @@ -578,7 +578,7 @@ enable_ksm()
{
if [ -f $KSM_MASK_FILE ]; then
# Do not run any systemctl commands if $KSM_SERVICES units do not exist
systemctl cat -- $KSM_SERVICES &> /dev/null || return
systemctl cat -- $KSM_SERVICES &> /dev/null || return 0
if systemctl --quiet unmask $KSM_SERVICES; then
rm -f $KSM_MASK_FILE
fi
Expand Down
8 changes: 7 additions & 1 deletion assets/tuned/daemon/profiles/network-latency/tuned.conf
Expand Up @@ -14,6 +14,12 @@ net.core.busy_read=50
net.core.busy_poll=50
net.ipv4.tcp_fastopen=3
kernel.numa_balancing=0
kernel.hung_task_timeout_secs = 600
kernel.nmi_watchdog = 0
vm.stat_interval = 10
kernel.timer_migration = 0

[bootloader]
cmdline_network_latency=skew_tick=1
cmdline_network_latency=skew_tick=1 tsc=reliable rcupdate.rcu_normal_after_boot=1

[rtentsk]
Expand Up @@ -38,11 +38,6 @@ group.ktimersoftd=0:f:3:*:^\[ktimersoftd

ps_blacklist=^\[ksoftirqd;^\[ktimers;^\[rcuc;^\[rcub;^\[ktimersoftd

[sysfs]
# Perform lockless check for timer softirq on isolated CPUs.
#
/sys/kernel/ktimer_lockless_check = 1

[script]
script=${i:PROFILE_DIR}/script.sh

Expand Down
4 changes: 0 additions & 4 deletions assets/tuned/daemon/profiles/realtime-virtual-host/tuned.conf
Expand Up @@ -51,10 +51,6 @@ ps_blacklist=^\[ksoftirqd;^\[ktimers;^\[rcuc;^\[rcub;^\[ktimersoftd;pmd;PMD;^DPD
# 2: stop ksmd, unmerge all pages
/sys/kernel/mm/ksm/run = 2

# Perform lockless check for timer softirq on isolated CPUs.
#
/sys/kernel/ktimer_lockless_check = 1

[script]
script=${i:PROFILE_DIR}/script.sh

Expand Down
8 changes: 1 addition & 7 deletions assets/tuned/daemon/profiles/realtime/tuned.conf
Expand Up @@ -39,11 +39,7 @@ managed_irq=${f:regex_search_ternary:${isolate_managed_irq}:\b[y,Y,1,t,T]\b:mana
channels=combined ${f:check_net_queue_count:${netdev_queue_count}}

[sysctl]
kernel.hung_task_timeout_secs = 600
kernel.nmi_watchdog = 0
kernel.sched_rt_runtime_us = -1
vm.stat_interval = 10
kernel.timer_migration = 0

[sysfs]
/sys/bus/workqueue/devices/writeback/cpumask = ${not_isolated_cpumask}
Expand All @@ -52,7 +48,7 @@ kernel.timer_migration = 0
/sys/devices/system/machinecheck/machinecheck*/ignore_ce = 1

[bootloader]
cmdline_realtime=+isolcpus=${managed_irq}${isolated_cores} intel_pstate=disable nosoftlockup tsc=reliable
cmdline_realtime=+isolcpus=${managed_irq}${isolated_cores} intel_pstate=disable nosoftlockup

[irqbalance]
banned_cpus=${isolated_cores}
Expand All @@ -62,5 +58,3 @@ script = ${i:PROFILE_DIR}/script.sh

[scheduler]
isolated_cores=${isolated_cores}

[rtentsk]
Expand Up @@ -8,3 +8,5 @@ relevancy: |
distro = rhel-4, rhel-5, rhel-6: False
summary: Test for BZ#1688371 (Program tuned tried to access /dev/mem between)
framework: beakerlib
require:
- library(tuned/basic)
Expand Up @@ -24,6 +24,9 @@ rlJournalStart
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlImport "tuned/basic"

tunedDisableSystemdRateLimitingStart
rlServiceStop "tuned"
# systemd can have some issues with quick restarts sometimes
sleep 1
Expand All @@ -36,6 +39,7 @@ rlJournalStart
rlPhaseEnd

rlPhaseStartCleanup
tunedDisableSystemdRateLimitingEnd
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlServiceRestore "tuned"
Expand Down
Expand Up @@ -8,3 +8,8 @@ relevancy: |
distro = rhel-4, rhel-5, rhel-6: False
summary: Test for BZ#1663412 (TuneD takes too long to reload/start when \"ulimit)
framework: beakerlib
require:
- library(tuned/basic)
recommend:
- psmisc
- tuned
Expand Up @@ -22,6 +22,8 @@ PACKAGE="tuned"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlImport "tuned/basic"
tunedDisableSystemdRateLimitingStart
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStop "tuned"
Expand All @@ -41,6 +43,11 @@ rlJournalStart
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"

killall tuned
rlRun "sleep 3"
killall tuned

tunedDisableSystemdRateLimitingEnd
rlFileRestore
rlServiceRestore "tuned"
rlPhaseEnd
Expand Down
Expand Up @@ -7,7 +7,8 @@ contact:
component:
- tuned
require:
- tuned
- tuned
- library(tuned/basic)
duration: 5m
extra-task: /CoreOS/tuned/Regression/bz1798183-RFE-support-post-loaded-profile
framework: beakerlib
Expand Up @@ -61,6 +61,8 @@ function wait_for_tuned_stop()
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlImport "tuned/basic"
tunedDisableSystemdRateLimitingStart
rlRun "for PYTHON in $PYTHON_CHECK; do \$PYTHON --version 2>/dev/null && break; done" 0 "Detect python"
rlRun "rlFileBackup --clean $PROFILE_DIR"
rlRun "cp -r parent $PROFILE_DIR"
Expand Down Expand Up @@ -259,6 +261,7 @@ rlJournalStart
rlPhaseEnd

rlPhaseStartCleanup
tunedDisableSystemdRateLimitingEnd
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "rlFileRestore"
Expand Down
2 changes: 2 additions & 0 deletions assets/tuned/daemon/tests/beakerlib/error-messages/main.fmf
Expand Up @@ -8,3 +8,5 @@ relevancy: |
distro = rhel-4, rhel-5: False
summary: Test for BZ#1416712 (TuneD logs error message if)
framework: beakerlib
require:
- library(tuned/basic)
28 changes: 15 additions & 13 deletions assets/tuned/daemon/tests/beakerlib/error-messages/runtest.sh
Expand Up @@ -23,30 +23,32 @@ rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlImport "tuned/basic"
tunedDisableSystemdRateLimitingStart
rlServiceStart "tuned"
tunedProfileBackup
rlPhaseEnd

rlPhaseStartTest "Test of profile balanced"
rlRun "cat /usr/lib/tuned/balanced/tuned.conf | grep alpm="
echo > /var/log/tuned/tuned.log
rlRun "tuned-adm profile balanced"
rlRun "tuned-adm active | grep balanced"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'ERROR tuned.utils.commands: Reading /sys/class/scsi_host/host0/link_power_management_policy'"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'WARNING tuned.plugins.plugin_scsi_host: ALPM control file'"
rlRun "cat /usr/lib/tuned/balanced/tuned.conf | grep alpm="
echo > /var/log/tuned/tuned.log
rlRun "tuned-adm profile balanced"
rlRun "tuned-adm active | grep balanced"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'ERROR tuned.utils.commands: Reading /sys/class/scsi_host/host0/link_power_management_policy'"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'WARNING tuned.plugins.plugin_scsi_host: ALPM control file'"
rlPhaseEnd

rlPhaseStartTest "Test of profile powersave"
rlRun "cat /usr/lib/tuned/powersave/tuned.conf | grep alpm="
echo > /var/log/tuned/tuned.log
rlRun "tuned-adm profile powersave"
rlRun "tuned-adm active | grep powersave"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'ERROR tuned.utils.commands: Reading /sys/class/scsi_host/host0/link_power_management_policy'"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'WARNING tuned.plugins.plugin_scsi_host: ALPM control file'"
rlRun "cat /usr/lib/tuned/powersave/tuned.conf | grep alpm="
echo > /var/log/tuned/tuned.log
rlRun "tuned-adm profile powersave"
rlRun "tuned-adm active | grep powersave"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'ERROR tuned.utils.commands: Reading /sys/class/scsi_host/host0/link_power_management_policy'"
rlRun "cat /var/log/tuned/tuned.log | grep -v 'WARNING tuned.plugins.plugin_scsi_host: ALPM control file'"
rlPhaseEnd

rlPhaseStartCleanup
tunedProfileRestore
tunedDisableSystemdRateLimitingEnd
tunedProfileRestore
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
Expand Up @@ -8,3 +8,5 @@ relevancy: |
distro < rhel-7.3: False
summary: Check functionality of tuned-adm tool.
framework: beakerlib
require:
- library(tuned/basic)
Expand Up @@ -25,6 +25,7 @@ rlJournalStart
rlAssertRpm $PACKAGE
rlImport "tuned/basic"
tunedProfileBackup
tunedDisableSystemdRateLimitingStart
rlPhaseEnd

rlPhaseStartTest "Test tuned-adm LIST"
Expand Down Expand Up @@ -82,6 +83,7 @@ rlJournalStart
rlPhaseEnd

rlPhaseStartCleanup
tunedDisableSystemdRateLimitingEnd
tunedProfileRestore
rlServiceRestore "tuned"
rlPhaseEnd
Expand Down
Expand Up @@ -22,11 +22,8 @@ PACKAGE="tuned"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlFileBackup --clean /etc/systemd/system.conf.d
rlRun "mkdir -p /etc/systemd/system.conf.d"
rlRun "echo -e '[Manager]\nDefaultStartLimitInterval=0' > /etc/systemd/system.conf.d/tuned.conf" 0 "Disable systemd rate limiting"
rlRun "systemctl daemon-reload"
rlImport "tuned/basic"
rlRun "tunedDisableSystemdRateLimitingStart"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart "tuned"
Expand Down Expand Up @@ -56,6 +53,7 @@ vm.swappiness = \${SWAPPINESS2}

rlPhaseStartCleanup
rlRun "sysctl vm.swappiness=$OLD_SWAPPINESS"
tunedDisableSystemdRateLimitingEnd
rlFileRestore
tunedProfileRestore
rlServiceRestore "tuned"
Expand Down
4 changes: 2 additions & 2 deletions assets/tuned/daemon/tests/unit/plugins/test_base.py
Expand Up @@ -211,7 +211,7 @@ def _get_config_options(self):
return {'size':'S','device_setting':'101'}

@decorators.command_set('size')
def _set_size(self, new_size, sim):
def _set_size(self, new_size, sim, remove):
self._size = new_size
return new_size

Expand All @@ -220,7 +220,7 @@ def _get_size(self):
return self._size

@decorators.command_set('device_setting',per_device = True)
def _set_device_setting(self,value,device,sim):
def _set_device_setting(self,value,device,sim,remove):
device.setting = value
return device.setting

Expand Down
13 changes: 13 additions & 0 deletions assets/tuned/daemon/tuned-adm.py
Expand Up @@ -97,6 +97,19 @@ def check_log_level(value):
parser_profile_mode = subparsers.add_parser("profile_mode", help="show current profile selection mode")
parser_profile_mode.set_defaults(action="profile_mode")

parser_instance_acquire_devices = subparsers.add_parser("instance_acquire_devices", help="acquire devices from other instances and assign them to the given instance")
parser_instance_acquire_devices.set_defaults(action="instance_acquire_devices")
parser_instance_acquire_devices.add_argument("devices", metavar="devices", type=str, help="comma-separated list of device names; may use the cpulist syntax if prefixed with 'cpulist:'")
parser_instance_acquire_devices.add_argument("instance", metavar="instance", type=str, help="name of the plugin instance which should acquire the devices")

parser_get_instances = subparsers.add_parser("get_instances", help="list active instances of a given plugin or all active instances if no plugin is specified")
parser_get_instances.set_defaults(action="get_instances")
parser_get_instances.add_argument("plugin_name", metavar="plugin_name", type=str, nargs="?", default="", help="name of the plugin to restrict the list of instances to")

parser_instance_get_devices = subparsers.add_parser("instance_get_devices", help="list devices assigned to a given instance")
parser_instance_get_devices.set_defaults(action="instance_get_devices")
parser_instance_get_devices.add_argument("instance", metavar="instance", type=str, help="name of the plugin instance")

args = parser.parse_args(sys.argv[1:])

options = vars(args)
Expand Down

0 comments on commit 20ffe15

Please sign in to comment.