|
|
76a324 |
diff --git a/profiles/realtime/realtime-variables.conf b/profiles/realtime/realtime-variables.conf
|
|
|
76a324 |
index c2da595..9d929e0 100644
|
|
|
76a324 |
--- a/profiles/realtime/realtime-variables.conf
|
|
|
76a324 |
+++ b/profiles/realtime/realtime-variables.conf
|
|
|
76a324 |
@@ -9,3 +9,11 @@
|
|
|
76a324 |
# kernel supports it.
|
|
|
76a324 |
#
|
|
|
76a324 |
# isolate_managed_irq=Y
|
|
|
76a324 |
+#
|
|
|
76a324 |
+#
|
|
|
76a324 |
+# Set the desired combined queue count value using the parameter provided
|
|
|
76a324 |
+# below. Ideally this should be set to the number of housekeeping CPUs i.e.,
|
|
|
76a324 |
+# in the example given below it is assumed that the system has 4 housekeeping
|
|
|
76a324 |
+# (non-isolated) CPUs.
|
|
|
76a324 |
+#
|
|
|
76a324 |
+# netdev_queue_count=4
|
|
|
76a324 |
diff --git a/profiles/realtime/tuned.conf b/profiles/realtime/tuned.conf
|
|
|
76a324 |
index 8eed36e..2400849 100644
|
|
|
76a324 |
--- a/profiles/realtime/tuned.conf
|
|
|
76a324 |
+++ b/profiles/realtime/tuned.conf
|
|
|
76a324 |
@@ -35,6 +35,9 @@ assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_exp
|
|
|
76a324 |
isolate_managed_irq = ${isolate_managed_irq}
|
|
|
76a324 |
managed_irq=${f:regex_search_ternary:${isolate_managed_irq}:\b[y,Y,1,t,T]\b:managed_irq,domain,:}
|
|
|
76a324 |
|
|
|
76a324 |
+[net]
|
|
|
76a324 |
+channels=combined ${f:check_net_queue_count:${netdev_queue_count}}
|
|
|
76a324 |
+
|
|
|
76a324 |
[sysctl]
|
|
|
76a324 |
kernel.hung_task_timeout_secs = 600
|
|
|
76a324 |
kernel.nmi_watchdog = 0
|
|
|
76a324 |
diff --git a/tuned/profiles/functions/function_check_net_queue_count.py b/tuned/profiles/functions/function_check_net_queue_count.py
|
|
|
76a324 |
new file mode 100644
|
|
|
76a324 |
index 0000000..eb54f98
|
|
|
76a324 |
--- /dev/null
|
|
|
76a324 |
+++ b/tuned/profiles/functions/function_check_net_queue_count.py
|
|
|
76a324 |
@@ -0,0 +1,22 @@
|
|
|
76a324 |
+import tuned.logs
|
|
|
76a324 |
+from . import base
|
|
|
76a324 |
+
|
|
|
76a324 |
+log = tuned.logs.get()
|
|
|
76a324 |
+
|
|
|
76a324 |
+class check_net_queue_count(base.Function):
|
|
|
76a324 |
+ """
|
|
|
76a324 |
+ Checks whether the user has specified a queue count for net devices. If
|
|
|
76a324 |
+ not, return the number of housekeeping CPUs.
|
|
|
76a324 |
+ """
|
|
|
76a324 |
+ def __init__(self):
|
|
|
76a324 |
+ # 1 argument
|
|
|
76a324 |
+ super(check_net_queue_count, self).__init__("check_net_queue_count", 1, 1)
|
|
|
76a324 |
+
|
|
|
76a324 |
+ def execute(self, args):
|
|
|
76a324 |
+ if not super(check_net_queue_count, self).execute(args):
|
|
|
76a324 |
+ return None
|
|
|
76a324 |
+ if args[0].isdigit():
|
|
|
76a324 |
+ return args[0]
|
|
|
76a324 |
+ (ret, out) = self._cmd.execute(["nproc"])
|
|
|
76a324 |
+ log.warn("net-dev queue count is not correctly specified, setting it to HK CPUs %s" % (out))
|
|
|
76a324 |
+ return out
|
|
|
76a324 |
diff --git a/tuned/plugins/plugin_net.py b/tuned/plugins/plugin_net.py
|
|
|
76a324 |
index 4d4c19e..a20d87e 100644
|
|
|
76a324 |
--- a/tuned/plugins/plugin_net.py
|
|
|
76a324 |
+++ b/tuned/plugins/plugin_net.py
|
|
|
76a324 |
@@ -122,6 +122,13 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
"rx-jumbo": None,
|
|
|
76a324 |
"tx": None }
|
|
|
76a324 |
|
|
|
76a324 |
+ @classmethod
|
|
|
76a324 |
+ def _get_config_options_channels(cls):
|
|
|
76a324 |
+ return { "rx": None,
|
|
|
76a324 |
+ "tx": None,
|
|
|
76a324 |
+ "other": None,
|
|
|
76a324 |
+ "combined": None }
|
|
|
76a324 |
+
|
|
|
76a324 |
@classmethod
|
|
|
76a324 |
def _get_config_options(cls):
|
|
|
76a324 |
return {
|
|
|
76a324 |
@@ -132,6 +139,7 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
"coalesce": None,
|
|
|
76a324 |
"pause": None,
|
|
|
76a324 |
"ring": None,
|
|
|
76a324 |
+ "channels": None,
|
|
|
76a324 |
}
|
|
|
76a324 |
|
|
|
76a324 |
def _init_stats_and_idle(self, instance, device):
|
|
|
76a324 |
@@ -282,7 +290,8 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
params = set(d.keys())
|
|
|
76a324 |
supported_getter = { "coalesce": self._get_config_options_coalesce, \
|
|
|
76a324 |
"pause": self._get_config_options_pause, \
|
|
|
76a324 |
- "ring": self._get_config_options_ring }
|
|
|
76a324 |
+ "ring": self._get_config_options_ring, \
|
|
|
76a324 |
+ "channels": self._get_config_options_channels }
|
|
|
76a324 |
supported = set(supported_getter[context]().keys())
|
|
|
76a324 |
if not params.issubset(supported):
|
|
|
76a324 |
log.error("unknown %s parameter(s): %s" % (context, str(params - supported)))
|
|
|
76a324 |
@@ -313,6 +322,29 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
l = [x for x in [re.split(r":\s*", x) for x in l] if len(x) == 2]
|
|
|
76a324 |
return dict(l)
|
|
|
76a324 |
|
|
|
76a324 |
+ # parse output of ethtool -l
|
|
|
76a324 |
+ def _parse_channels_parameters(self, s):
|
|
|
76a324 |
+ a = re.split(r"^Current hardware settings:$", s, flags=re.MULTILINE)
|
|
|
76a324 |
+ s = a[1]
|
|
|
76a324 |
+ s = self._cmd.multiple_re_replace(\
|
|
|
76a324 |
+ {"RX": "rx",
|
|
|
76a324 |
+ "TX": "tx",
|
|
|
76a324 |
+ "Other": "other",
|
|
|
76a324 |
+ "Combined": "combined"}, s)
|
|
|
76a324 |
+ l = s.split("\n")
|
|
|
76a324 |
+ l = [x for x in l if x != '']
|
|
|
76a324 |
+ l = [x for x in [re.split(r":\s*", x) for x in l] if len(x) == 2]
|
|
|
76a324 |
+ return dict(l)
|
|
|
76a324 |
+
|
|
|
76a324 |
+ def _replace_channels_parameters(self, context, params_list, dev_params):
|
|
|
76a324 |
+ mod_params_list = []
|
|
|
76a324 |
+ if "combined" in params_list:
|
|
|
76a324 |
+ mod_params_list.extend(["rx", params_list[1], "tx", params_list[1]])
|
|
|
76a324 |
+ else:
|
|
|
76a324 |
+ cnt = str(max(int(params_list[1]), int(params_list[3])))
|
|
|
76a324 |
+ mod_params_list.extend(["combined", cnt])
|
|
|
76a324 |
+ return dict(list(zip(mod_params_list[::2], mod_params_list[1::2])))
|
|
|
76a324 |
+
|
|
|
76a324 |
def _check_device_support(self, context, parameters, device, dev_params):
|
|
|
76a324 |
"""Filter unsupported parameters and log warnings about it
|
|
|
76a324 |
|
|
|
76a324 |
@@ -337,7 +369,8 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
parameters.pop(param, None)
|
|
|
76a324 |
|
|
|
76a324 |
def _get_device_parameters(self, context, device):
|
|
|
76a324 |
- context2opt = { "coalesce": "-c", "features": "-k", "pause": "-a", "ring": "-g" }
|
|
|
76a324 |
+ context2opt = { "coalesce": "-c", "features": "-k", "pause": "-a", "ring": "-g", \
|
|
|
76a324 |
+ "channels": "-l"}
|
|
|
76a324 |
opt = context2opt[context]
|
|
|
76a324 |
ret, value = self._cmd.execute(["ethtool", opt, device])
|
|
|
76a324 |
if ret != 0 or len(value) == 0:
|
|
|
76a324 |
@@ -345,7 +378,8 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
context2parser = { "coalesce": self._parse_device_parameters, \
|
|
|
76a324 |
"features": self._parse_device_parameters, \
|
|
|
76a324 |
"pause": self._parse_pause_parameters, \
|
|
|
76a324 |
- "ring": self._parse_ring_parameters }
|
|
|
76a324 |
+ "ring": self._parse_ring_parameters, \
|
|
|
76a324 |
+ "channels": self._parse_channels_parameters }
|
|
|
76a324 |
parser = context2parser[context]
|
|
|
76a324 |
d = parser(value)
|
|
|
76a324 |
if context == "coalesce" and not self._check_parameters(context, d):
|
|
|
76a324 |
@@ -362,10 +396,14 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
# check if device supports parameters and filter out unsupported ones
|
|
|
76a324 |
if dev_params:
|
|
|
76a324 |
self._check_device_support(context, d, device, dev_params)
|
|
|
76a324 |
+ # replace the channel parameters based on the device support
|
|
|
76a324 |
+ if context == "channels" and int(dev_params[next(iter(d))]) == 0:
|
|
|
76a324 |
+ d = self._replace_channels_parameters(context, self._cmd.dict2list(d), dev_params)
|
|
|
76a324 |
|
|
|
76a324 |
if not sim and len(d) != 0:
|
|
|
76a324 |
log.debug("setting %s: %s" % (context, str(d)))
|
|
|
76a324 |
- context2opt = { "coalesce": "-C", "features": "-K", "pause": "-A", "ring": "-G" }
|
|
|
76a324 |
+ context2opt = { "coalesce": "-C", "features": "-K", "pause": "-A", "ring": "-G", \
|
|
|
76a324 |
+ "channels": "-L"}
|
|
|
76a324 |
opt = context2opt[context]
|
|
|
76a324 |
# ignore ethtool return code 80, it means parameter is already set
|
|
|
76a324 |
self._cmd.execute(["ethtool", opt, device] + self._cmd.dict2list(d), no_errors = [80])
|
|
|
76a324 |
@@ -422,3 +460,7 @@ class NetTuningPlugin(base.Plugin):
|
|
|
76a324 |
@command_custom("ring", per_device = True)
|
|
|
76a324 |
def _ring(self, start, value, device, verify, ignore_missing):
|
|
|
76a324 |
return self._custom_parameters("ring", start, value, device, verify)
|
|
|
76a324 |
+
|
|
|
76a324 |
+ @command_custom("channels", per_device = True)
|
|
|
76a324 |
+ def _channels(self, start, value, device, verify, ignore_missing):
|
|
|
76a324 |
+ return self._custom_parameters("channels", start, value, device, verify)
|