RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1825882 - Applying a profile with multiple inheritance where parents include a common ancestor fails
Summary: Applying a profile with multiple inheritance where parents include a common a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: tuned
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: rc
: 8.0
Assignee: Jaroslav Škarvada
QA Contact: Robin Hack
URL:
Whiteboard:
Depends On:
Blocks: 1961869
TreeView+ depends on / blocked
 
Reported: 2020-04-20 12:44 UTC by Yanir Quinn
Modified: 2023-09-15 00:31 UTC (History)
9 users (show)

Fixed In Version: tuned-2.16.0-0.1.rc1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 19:58:24 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
Proposed patch to address this issue. (1.14 KB, patch)
2021-06-03 08:09 UTC, Jiří Mencák
no flags Details | Diff
Proposed fix (2.66 KB, patch)
2021-06-09 00:26 UTC, Jaroslav Škarvada
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4476 0 None None None 2021-11-09 19:58:50 UTC

Description Yanir Quinn 2020-04-20 12:44:47 UTC
Description of problem:
When applying a profile with multiple inheritance where both parent profiles include a common ancestor Tuned daemon will fail to apply it.

Version-Release number of selected component (if applicable):

NAME="Red Hat Enterprise Linux"
VERSION="8.2 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.2"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.2 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.2:GA"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.2"

How reproducible:
Always

Steps to Reproduce:

[root@b82 ~]# yum install tuned-profiles-cpu-partitioning -y
[root@b82 ~]# systemctl stop tuned --now
[root@b82 ~]# echo '[openshift-realtime]' > /etc/tuned/recommend.d/50-openshift.conf
[root@b82 ~]# rm -f /etc/tuned/{active_profile,profile_mode}
[root@b82 ~]# mkdir -p /etc/tuned/{openshift-realtime,realtime}
[root@b82 ~]# cat > /etc/tuned/openshift-realtime/tuned.conf <<EOF
[main]
summary=Custom OpenShift realtime profile
include=cpu-partitioning,realtime
EOF
[root@b82 ~]# cat > /etc/tuned/realtime/tuned.conf <<EOF
[main]
summary=Optimize for realtime workloads
include = network-latency
EOF

Actual results:
Profile with multiple inheritance fails due to:

[root@b82 ~]# tuned --no-dbus
2020-04-20 08:00:14,649 INFO     tuned.daemon.application: dynamic tuning is globally disabled
2020-04-20 08:00:14,651 INFO     tuned.daemon.daemon: using sleep interval of 1 second(s)
2020-04-20 08:00:14,652 INFO     tuned.daemon.daemon: Running in automatic mode, checking what profile is recommended for your configuration.
2020-04-20 08:00:14,652 INFO     tuned.daemon.daemon: Using 'openshift-realtime' profile
2020-04-20 08:00:14,653 INFO     tuned.profiles.loader: loading profile: openshift-realtime
2020-04-20 08:00:14,655 ERROR    tuned.daemon.daemon: Cannot set initial profile. No tunings will be enabled: Cannot load profile(s) 'openshift-realtime': Cannot find profile 'network-latency' in '['/etc/tuned', '/usr/lib/tuned']'.
2020-04-20 08:00:14,655 INFO     tuned.daemon.controller: starting controller
^C2020-04-20 08:00:17,390 INFO     tuned.daemon.controller: terminating controller[root@b82 ~]# ls -l /usr/lib/tuned/network-latency/tuned.conf 
-rw-r--r--. 1 root root 366 Dec 11 12:13 /usr/lib/tuned/network-latency/tuned.conf


Expected results:
Custom profile should be applied successfully. 

Additional info:
Possible reason for failure is mentioned in comments.

Comment 1 Yanir Quinn 2020-04-20 12:55:39 UTC
Looking at loader.py :

	def _load_profile(self, profile_names, profiles, processed_files):
		for name in profile_names:
			filename = self._profile_locator.get_config(name, processed_files)
			if filename is None:
				raise InvalidProfileException("Cannot find profile '%s' in '%s'." % (name, list(reversed(self._profile_locator._load_directories))))
			processed_files.append(filename)

			config = self._load_config_data(filename)
			profile = self._profile_factory.create(name, config)
			if "include" in profile.options:
				include_names = re.split(r"\b\s*[,;]\s*", self._variables.expand(profile.options.pop("include")))
				self._load_profile(include_names, profiles, processed_files)

			profiles.append(profile)


It seems that self._profile_locator.get_config(name, processed_files) is probably invoked twice with an ancestor profile. 
If an ancestor profile was already processed and added processed_files.append(filename) it won't be obtained again and be skipped:
locator.py :
	def get_config(self, profile_name, skip_files=None):
		for dir_name in reversed(self._load_directories):
			# basename is protection not to get out of the path
			config_file = self._get_config_filename(dir_name, os.path.basename(profile_name))

			if skip_files is not None and config_file in skip_files:
				continue

			if os.path.isfile(config_file):
				return config_file

		return None

In the bug description we use realtime and cpu-partitioning profiles that have a common ancestor : network-latency that fails to be obtained according to the log.
There is also a need to consider the case where there is a transitive inheritance , for example:
realtime-> network-latency -> latency-performance
cpu-partitioning -> network-latency -> latency-performance

latency-performance should not be also a reason for a failure in case we overcome the first ancestor.

Comment 2 Ondřej Lysoněk 2020-04-20 13:21:11 UTC
Reproduced. Thanks for the report!

Comment 13 Jiří Mencák 2021-06-03 08:09:16 UTC
Created attachment 1788804 [details]
Proposed patch to address this issue.

Proposing a patch to address this issue.  Might break some unit tests, but seems to address the problem.

Comment 14 Jaroslav Škarvada 2021-06-09 00:26:43 UTC
Created attachment 1789468 [details]
Proposed fix

I address the following:

- unit test fixes
- fix the problem (regression) when customized profile PROFILE (in /etc/tuned) uses include=PROFILE (for customizing the stock profiles from the /usr/share/tuned)

I will give you credit in the upstream git.

I am going to give it a bit more thinking whether this simplified profile loading could introduce some unexpected situations (e.g. with 'replace=true').

Comment 15 Jaroslav Škarvada 2021-06-09 08:53:26 UTC
Upstream PR:
https://github.com/redhat-performance/tuned/pull/357

Comment 24 errata-xmlrpc 2021-11-09 19:58:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (tuned bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4476

Comment 25 Red Hat Bugzilla 2023-09-15 00:31:05 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days


Note You need to log in before you can comment on or make changes to this bug.