Bug 1296137

Summary: Exception when /dev/cpu_dma_latency is not available
Product: Red Hat Enterprise Linux 7 Reporter: Frantisek Sumsal <fsumsal>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Tereza Cerna <tcerna>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.2CC: jeder, jscotka, jskarvad, tcerna
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.7.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 07:26:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Frantisek Sumsal 2016-01-06 12:17:54 UTC
Description of problem:
Containers created by systemd-nspawn do not create devices under /dev. This causes unhandled exception being thrown when /dev/cpu_dma_latency is not available:

Jan  6 04:10:40 rhel7 systemd: Started Dynamic System Tuning Daemon.
Jan  6 04:10:40 rhel7 tuned: Exception in thread Thread-2:
Jan  6 04:10:40 rhel7 tuned: Traceback (most recent call last):
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
Jan  6 04:10:40 rhel7 tuned: self.run()
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib64/python2.7/threading.py", line 764, in run
Jan  6 04:10:40 rhel7 tuned: self.__target(*self.__args, **self.__kwargs)
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib/python2.7/site-packages/tuned/daemon/daemon.py", line 96, in _thread_code
Jan  6 04:10:40 rhel7 tuned: self._unit_manager.create(self._profile.units)
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib/python2.7/site-packages/tuned/units/manager.py", line 62, in create
Jan  6 04:10:40 rhel7 tuned: plugin.initialize_instances()
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib/python2.7/site-packages/tuned/plugins/base.py", line 109, in initialize_instances
Jan  6 04:10:40 rhel7 tuned: self._instance_init(instance)
Jan  6 04:10:40 rhel7 tuned: File "/usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.py", line 99, in _instance_init
Jan  6 04:10:40 rhel7 tuned: self._cpu_latency_fd = os.open("/dev/cpu_dma_latency", os.O_WRONLY)
Jan  6 04:10:40 rhel7 tuned: OSError: [Errno 2] No such file or directory: '/dev/cpu_dma_latency'

However, this exception does not prevent machine from successfully starting.

Version-Release number of selected component (if applicable):
tuned-2.5.1-4.el7.noarch

How reproducible:
## Create machine root & install packages from "minimal" group
# mkdir testvm
# yum -y --nogpgcheck --installroot "$(pwd)/testvm" groupinstall minimal
## Start test machine in another terminal/tmux/screen/...
# screen -S nspawn systemd-nspawn -D testvm
## Grep tuned messages from test machine's /var/log/messages
# grep tuned testvm/var/log/messages

Actual results:
Log shows an exception

Expected results:
tuned should report some kind of error message instead of unhandled exception

Comment 2 Jaroslav Škarvada 2016-01-06 13:20:10 UTC
Fixed in following upstream commit:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=a2b0741eacdd65cd17db6eec68ef2dabb96bbba4

But consider adding support for PM_QoS into nspawn. I think that PM_QoS kernel hints from nspawned processes makes sense and that nspawned processes should be able to make such hints to kernel.

Comment 7 Tereza Cerna 2016-08-18 14:00:39 UTC
============================
Verified in:
    tuned-2.7.1-2.el7.noarch
PASS
=============================

# mkdir testvm
# yum -y --nogpgcheck --installroot "$(pwd)/testvm" groupinstall minimal
# > testvm/var/log/messages && timeout 15 systemd-nspawn -bD testvm
# grep tuned testvm/var/log/messages
#

============================
Reproduced in:
    tuned-2.5.1-4.el7.noarch
FAIL
=============================

# mkdir testvm
# yum -y --nogpgcheck --installroot "$(pwd)/testvm" groupinstall minimal
# > testvm/var/log/messages && timeout 15 systemd-nspawn -bD testvm

# grep tuned testvm/var/log/messages
Aug 18 09:49:51 testvm tuned: Exception in thread Thread-2:
Aug 18 09:49:51 testvm tuned: Traceback (most recent call last):
Aug 18 09:49:51 testvm tuned: File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
Aug 18 09:49:51 testvm tuned: self.run()
Aug 18 09:49:51 testvm tuned: File "/usr/lib64/python2.7/threading.py", line 764, in run
Aug 18 09:49:51 testvm tuned: self.__target(*self.__args, **self.__kwargs)
Aug 18 09:49:51 testvm tuned: File "/usr/lib/python2.7/site-packages/tuned/daemon/daemon.py", line 96, in _thread_code
Aug 18 09:49:51 testvm tuned: self._unit_manager.create(self._profile.units)
Aug 18 09:49:51 testvm tuned: File "/usr/lib/python2.7/site-packages/tuned/units/manager.py", line 62, in create
Aug 18 09:49:51 testvm tuned: plugin.initialize_instances()
Aug 18 09:49:51 testvm tuned: File "/usr/lib/python2.7/site-packages/tuned/plugins/base.py", line 109, in initialize_instances
Aug 18 09:49:51 testvm tuned: self._instance_init(instance)
Aug 18 09:49:51 testvm tuned: File "/usr/lib/python2.7/site-packages/tuned/plugins/plugin_cpu.py", line 99, in _instance_init
Aug 18 09:49:51 testvm tuned: self._cpu_latency_fd = os.open("/dev/cpu_dma_latency", os.O_WRONLY)
Aug 18 09:49:51 testvm tuned: OSError: [Errno 2] No such file or directory: '/dev/cpu_dma_latency'
#

Comment 9 errata-xmlrpc 2016-11-04 07:26:58 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, 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://rhn.redhat.com/errata/RHBA-2016-2479.html