Bug 1943291

Summary: Tuned plugin_net dumps a traceback while adjusting the netdev queue count
Product: Red Hat Enterprise Linux 8 Reporter: Nitesh Narayan Lal <nilal>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: jeder, jskarvad, jzerdik, rhack
Target Milestone: rcKeywords: Patch, TestCaseProvided, Triaged, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.16.0-0.1.rc1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:58:24 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 Nitesh Narayan Lal 2021-03-25 18:00:06 UTC
Description of problem:
Tuned prints a traceback while adjusting the network device queue count. 

Version-Release number of selected component (if applicable):
tuned-2.15.0-2.el8.noarch

How reproducible:
Every time

Steps to Reproduce:
1. Bring up a rhel8.4 host
2. Apply tuned's realtime-virtual-host profile by isolating CPUs
3. Reboot and check tuned.log or run tuned-adm -l debug profile realtime-virtual-host

Actual results:
WARNING  tuned.profiles.functions.function_check_net_queue_count: net-dev queue count is not correctly specified, setting it to HK CPUs 12

ERROR    tuned.units.manager: BUG: Unhandled exception in start_tuning: invalid literal for int() with base 10: 'n/a'
ERROR    tuned.units.manager: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tuned/units/manager.py", line 119, in _try_call
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/instance/instance.py", line 78, in apply_tuning
    self._plugin.instance_apply_tuning(self)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 261, in instance_apply_tuning
    self._instance_apply_static(instance)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 318, in _instance_apply_static
    self._execute_all_device_commands(instance, instance.assigned_devices)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 441, in _execute_all_device_commands
    self._execute_device_command(instance, command, device, new_value)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/base.py", line 502, in _execute_device_command
    command["custom"](True, new_value, device, False, False)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/plugin_net.py", line 470, in _channels
    return self._custom_parameters("channels", start, value, device, verify)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/plugin_net.py", line 425, in _custom_parameters
    dev_params = params_current)
  File "/usr/lib/python3.6/site-packages/tuned/plugins/plugin_net.py", line 400, in _set_device_parameters
    if context == "channels" and int(dev_params[next(iter(d))]) == 0:
ValueError: invalid literal for int() with base 10: 'n/a'



Expected results:
Tuned should adjust the network device queue count without any stack trace

Additional info:

Comment 1 Nitesh Narayan Lal 2021-03-25 18:10:30 UTC
What happens here is that in rhel8.4 the mode that a network device doesn't
support is represented by 'n/a' instead of 0:

[root@virtlab512 ~]# ethtool -l eno1
Channel parameters for eno1:
Pre-set maximums:
RX:		4
TX:		4
Other:		n/a
Combined:	n/a  -> Not supported mode by eno1
Current hardware settings:
RX:		4
TX:		1
Other:		n/a
Combined:	n/a

In previous kernels this used to be 0:

[root@virtlab719 ~]# ethtool -l p3p1
Channel parameters for p3p1:
Pre-set maximums:
RX:		0 -> Not supported mode by p3p1
TX:		0 -> Not supported mode by p3p1
Other:		1
Combined:	80
Current hardware settings:
RX:		0
TX:		0
Other:		1
Combined:	4


Because of this the plugin_net script fails when it tries to do
"int(dev_params[next(iter(d))])" for checking whether the command adjustment
is required or not:

 # replace the channel parameters based on the device support
 if context == "channels" and int(dev_params[next(iter(d))]) == 0:
 

One possible fix for this is to replace the above with the following:
if context == "channels" and (dev_params[next(iter(d))] == 0 or dev_params[next(iter(d))] == 'n/a'):

Comment 3 Jaroslav Škarvada 2021-04-15 22:31:55 UTC
Upstream PR:
https://github.com/redhat-performance/tuned/pull/336

Comment 13 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