1
0
Fork 0

latency: support None value

This allows writing e.g.:
[cpu]
force_latency=cstate.name:XYZ|None

In this case if C-state with name XYZ doesn't exist force_latency
will be evaluated to 'None' and nothing will be set and no
error will be reported. If '|None' is omitted, error will be
reported.

Another example:
[cpu]
force_latency=None

Here, it will also set nothing and no error will be reported.

When 'None' is encountered it stops parsing the latency, so writing
'None|1' will also result in no latency set. Both 'none' and 'None' can
be used interchangeably with the same effect.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2019-11-29 01:03:45 +01:00
parent 0fadc85722
commit 120bb69d3f
No known key found for this signature in database
GPG key ID: D8E1C00E076E840B

View file

@ -259,6 +259,7 @@ class CPULatencyPlugin(base.Plugin):
log.debug("cstate ID mapped to latency: %s" % str(latency))
return latency
# returns (latency, skip), skip means we want to skip latency settings
def _parse_latency(self, latency):
self.cstates_latency = None
latencies = str(latency).split("|")
@ -272,16 +273,19 @@ class CPULatencyPlugin(base.Plugin):
latency = self._get_latency_by_cstate_id(latency[10:])
elif latency[0:12] == "cstate.name:":
latency = self._get_latency_by_cstate_name(latency[12:])
elif latency in ["none", "None"]:
log.debug("latency 'none' specified")
return None, True
else:
latency = None
log.debug("invalid latency specified: '%s'" % str(latency))
if latency is not None:
break
return latency
return latency, False
def _set_latency(self, latency):
latency = self._parse_latency(latency)
if self._has_pm_qos:
latency, skip = self._parse_latency(latency)
if not skip and self._has_pm_qos:
if latency is None:
log.error("unable to evaluate latency value (probably wrong settings in the 'cpu' section of current profile), disabling PM QoS")
self._has_pm_qos = False