intel_idle: Fixups and new module parameter prefer_cst
Subsystems (3)
Rafael J. Wysocki
maintainercover intel_idle: Fixups and new module parameter prefer_cst
Hi All,
This series makes the following changes in the intel_idle driver:
* Update outdated module parameter descriptions (first patch)
* Avoid using empty C-state tables coming from _CST (second patch)
* Add new module parameter "prefer_cst" to force preferring _CST to _LPI (last patch)
Thanks!
Rafael J. Wysocki
maintainerPATCH 1/3 intel_idle: Update no_acpi and use_acpi module parameter descriptions
From: "Rafael J. Wysocki" <[email protected]>
The descriptions of the no_acpi and use_acpi module parameters of intel_idle only mention ACPI _CST which is inaccurate after adding ACPI _LPI support to the driver.
Update them to mention ACPI in general to avoid confusion.
--- drivers/idle/intel_idle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/idle/intel_idle.c +2 -2
@@ -1769,11 +1769,11 @@ static bool __init intel_idle_state_needs_timer_stop(struct cpuidle_state *statestatic bool no_acpi__read_mostly ;module_param (no_acpi, bool,0444 ); -MODULE_PARM_DESC (no_acpi,"Do not use ACPI _CST for building the idle states list" ); +MODULE_PARM_DESC (no_acpi,"Do not use ACPI for building the idle state list" );static bool force_use_acpi__read_mostly ;/* No effect if no_acpi is set. */ module_param_named (use_acpi, force_use_acpi, bool,0444 ); -MODULE_PARM_DESC (use_acpi,"Use ACPI _CST for building the idle states list" ); +MODULE_PARM_DESC (use_acpi,"Force using ACPI for building the idle state list" );static bool no_native__read_mostly ;/* No effect if no_acpi is set. */ module_param_named (no_native, no_native, bool,0444 );
Signature · 1 line
2.51.0
Rafael J. Wysocki
maintainerPATCH 2/3 intel_idle: Disregard ACPI _CST evaluation returning no states
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
Success is returned by acpi_processor_evaluate_cst() after producing an empty idle state table which is useless.
Avoid attempting to use an empty idle state table coming from _CST by checking the number of states in the idle state table produced by acpi_processor_evaluate_cst().
--- drivers/idle/intel_idle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/idle/intel_idle.c +2 -1
@@ -1837,7 +1837,8 @@ static bool __init intel_idle_acpi_extract_cst_cstates(void)if (!pr)continue ; -if (acpi_processor_evaluate_cst (pr->handle, cpu, &acpi_state_table)) +if (acpi_processor_evaluate_cst (pr->handle, cpu, &acpi_state_table) || + !acpi_state_table.count)continue ; acpi_state_table.count++;
Signature · 1 line
2.51.0
Rafael J. Wysocki
maintainerPATCH 3/3 intel_idle: Allow ACPI _CST to be preferred to ACPI _LPI
In reply to Rafael J. WysockiFrom: "Rafael J. Wysocki" <[email protected]>
Add a new module parameter called "prefer_cst" to intel_idle for making it prefer _CST for building the idle state list when using ACPI, even if _LPI (preferred by default) is available.
This may be useful for diagnostics during platform bringup and as a fallback mechanism on platforms with broken ACPI _LPI and functional ACPI _CST.
Update the documentation accordingly.
--- Documentation/admin-guide/pm/intel_idle.rst | 15 ++++++++++----- drivers/idle/intel_idle.c | 15 +++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-)
Documentation/admin-guide/pm/intel_idle.rst +10 -5
@@ -94,7 +94,9 @@ objects representing the CPUs in the system and ``_LPI`` processing produces a non-empty list of valid idle states, it will be used. Otherwise, ``_CST`` will be used so long as it is present under at least one of the ACPI objects representing the CPUs in the system and it returns a non-empty list of valid -idle states. In either case, since the ``CPUIdle`` subsystem expects that the +idle states. [There is a module parameter that can be used to tell the driver +to prefer ``_CST`` to ``_LPI`` and reverse the order in which they are tried.] +In either case, since the ``CPUIdle`` subsystem expects that the list of idle states supplied by the driver will be suitable for all of the CPUs handled by it and ``intel_idle`` is registered as the ``CPUIdle`` driver for all of the CPUs in the system, ``intel_idle`` looks for the first CPU where the
@@ -223,10 +225,10 @@ even if they have been enumerated (see :ref:`cpu-pm-qos` in Documentation/admin-guide/pm/cpuidle.rst). Setting ``max_cstate`` to 0 causes the ``intel_idle`` initialization to fail. -The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are -recognized by ``intel_idle`` if the kernel has been configured with ACPI -support. In the case that ACPI is not configured these flags have no impact -on functionality. +The ``no_acpi``, ``use_acpi``, ``no_native``, and ``prefer_cst`` module +parameters are recognized by ``intel_idle`` if the kernel has been configured +with ACPI support. If ACPI is not configured, these flags have no impact on +functionality. ``no_acpi`` - Do not use ACPI at all. Only native mode is available, no ACPI mode.
@@ -237,6 +239,9 @@ C-states on/off status in native mode. ``no_native`` - Work only in ACPI mode, no native mode available (ignore all custom tables). +``prefer_cst`` - When using ACPI, prefer idle states coming from ``_CST`` to +idle states coming from ``_LPI`` (which is preferred by default). + The value of the ``states_off`` module parameter (0 by default) represents a list of idle states to be disabled by default in the form of a bitmask.
drivers/idle/intel_idle.c +9 -6
@@ -1779,6 +1779,10 @@ static bool no_native __read_mostly; /* No effect if no_acpi is set. */module_param_named (no_native, no_native, bool,0444 );MODULE_PARM_DESC (no_native,"Ignore cpu specific (native) idle states in lieu of ACPI idle states" ); +static bool prefer_cst__read_mostly ;/* No effect if no_acpi is set. */ +module_param (prefer_cst, bool,0444 ); +MODULE_PARM_DESC (prefer_cst,"Prefer ACPI _CST idle states to ACPI _LPI idle states" ); +static struct acpi_processor_power acpi_state_table__initdata ;static bool acpi_lpi_available__initdata ;
@@ -1855,13 +1859,12 @@ static bool __init intel_idle_acpi_extract_cst_cstates(void)static bool __init intel_idle_acpi_extract_cstates (void ) { -if (intel_idle_acpi_extract_lpi_cstates ()) -return true; +if (prefer_cst) +return intel_idle_acpi_extract_cst_cstates () || +intel_idle_acpi_extract_lpi_cstates (); -if (intel_idle_acpi_extract_cst_cstates ()) -return true; - -return false; +return intel_idle_acpi_extract_lpi_cstates () || +intel_idle_acpi_extract_cst_cstates (); }static bool __init intel_idle_acpi_probe (void )
Signature · 1 line
2.51.0
Re: [PATCH v1 3/3] intel_idle: Allow ACPI _CST to be preferred to ACPI _LPI
All patches look good to me, there is only doc nitpicks below.
So my nitpick is to make it crystal clear this option is not about never trying _LPI, it is about trying _CST first (reversing the default).
Quoted 2 lines · Rafael J. Wysocki
+``prefer_cst`` - When using ACPI, prefer idle states coming from ``_CST`` to +idle states coming from ``_LPI`` (which is preferred by default).
``prefer_cst`` - When using ACPI, try ``_CST`` first and fall back to ``_LPI`` only if ``_CST`` does not provide usable idle states (by default, ``_LPI`` is tried first and ``_CST`` is the fallback).
Quoted 9 lines
Documentation/admin-guide/pm/intel_idle.rst +1
-0+ The value of the ``states_off`` module parameter (0 by default) represents a list of idle states to be disabled by default in the form of a bitmask.drivers/idle/intel_idle.c +0
-0
drivers/idle/intel_idle.c static bool no_native __read_mostly; /* No effect if no_acpi is set. */ · line 1784
Quoted 6 lines
drivers/idle/intel_idle.c +3
-0@@ -1779,6 +1779,10 @@ static bool no_native __read_mostly; /* No effect if no_acpi is set. */module_param_named (no_native, no_native, bool,0444 );MODULE_PARM_DESC (no_native,"Ignore cpu specific (native) idle states in lieu of ACPI idle states" ); +static bool prefer_cst__read_mostly ;/* No effect if no_acpi is set. */ +module_param (prefer_cst, bool,0444 ); +MODULE_PARM_DESC (prefer_cst,"Prefer ACPI _CST idle states to ACPI _LPI idle states" );
May be even something like this
MODULE_PARM_DESC(prefer_cst, "Try ACPI _CST before ACPI _LPI (default: "
"_LPI first)");
But this is very minor, your call.
Artem.
Rafael J. Wysocki (Intel)
maintainerRe: [PATCH v1 3/3] intel_idle: Allow ACPI _CST to be preferred to ACPI _LPI
Quoted 4 lines · Artem Bityutskiy
All patches look good to me, there is only doc nitpicks below.
Reviewed-by Artem Bityutskiy <[email protected]>
Thanks!
Quoted 3 lines
So my nitpick is to make it crystal clear this option is not about never trying
_LPI, it is about trying_CSTfirst (reversing the default).
That's what "prefer" means.
Quoted 7 lines · Rafael J. Wysocki
Quoted 2 lines
+``prefer_cst`` - When using ACPI, prefer idle states coming from ``_CST`` to +idle states coming from ``_LPI`` (which is preferred by default).
``prefer_cst`` - When using ACPI, try ``_CST`` first and fall back to ``_LPI`` only if ``_CST`` does not provide usable idle states (by default, ``_LPI`` is tried first and ``_CST`` is the fallback).
This is more precise, so I'll use it, but honestly it doesn't make a lot of a difference to me.
Quoted 18 lines
Quoted 9 lines
Documentation/admin-guide/pm/intel_idle.rst +1
-0+ The value of the ``states_off`` module parameter (0 by default) represents a list of idle states to be disabled by default in the form of a bitmask.drivers/idle/intel_idle.c +0
-0drivers/idle/intel_idle.c static bool no_native __read_mostly; /* No effect if no_acpi is set. */ · line 1784
Quoted 6 lines
drivers/idle/intel_idle.c +3
-0@@ -1779,6 +1779,10 @@ static bool no_native __read_mostly; /* No effect if no_acpi is set. */module_param_named (no_native, no_native, bool,0444 );MODULE_PARM_DESC (no_native,"Ignore cpu specific (native) idle states in lieu of ACPI idle states" ); +static bool prefer_cst__read_mostly ;/* No effect if no_acpi is set. */ +module_param (prefer_cst, bool,0444 ); +MODULE_PARM_DESC (prefer_cst,"Prefer ACPI _CST idle states to ACPI _LPI idle states" );May be even something like this
Quoted 4 lines
MODULE_PARM_DESC(prefer_cst, "Try ACPI
_CSTbefore ACPI_LPI(default: ""_LPI first)");But this is very minor, your call.
I'm going to use mine.
Re: [PATCH v1 3/3] intel_idle: Allow ACPI _CST to be preferred to ACPI _LPI
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
Add a new module parameter called "
prefer_cst" tointel_idlefor making
it prefer_CSTfor building the idle state list when using ACPI, even if_LPI(preferred by default) is available.
Quoted 7 lines
This may be useful for diagnostics during platform bringup and as a fallback mechanism on platforms with broken ACPI
_LPIand functional ACPI_CST.Update the documentation accordingly.
Signed-off-by Rafael J. Wysocki <[email protected]>
Tested the full series on top of v7.4-rc2 on a _LPI capable platform, and it works as expected both with and without the prefer_cst parameter.
thanks,
rui
Quoted 108 lines
---
Documentation/admin-guide/pm/intel_idle.rst | 15 ++++++++++----- drivers/idle/intel_idle.c | 15 +++++++++------2 files changed, 19 insertions(+), 11 deletions(-)Documentation/admin-guide/pm/intel_idle.rst +0
-0@@ -94,7 +94,9 @@ objects representing the CPUs in the system and``_LPI`` processing produces a
non-empty list of valid idle states, it will be used. Otherwise, ``_CST`` will
be used so long as it is present under at least one of the ACPI objects
representing the CPUs in the system and it returns a non-empty list of valid
-idle states. In either case, since the ``CPUIdle`` subsystem expects that the
+idle states. [There is a module parameter that can be used to tell the driver
+to prefer ``_CST`` to ``_LPI`` and reverse the order in which they are tried.]
+In either case, since the ``CPUIdle`` subsystem expects that the list of idle states supplied by the driver will be suitable for all of the CPUs
handled by it and ``intel_idle`` is registered as the ``CPUIdle`` driver for all
of the CPUs in the system, ``intel_idle`` looks for the first CPU where theDocumentation/admin-guide/pm/intel_idle.rst +0
-0@@ -223,10 +225,10 @@ even if they have been enumerated (see:ref:
cpu-pm-qosinDocumentation/admin-guide/pm/cpuidle.rst).
Setting ``max_cstate`` to 0 causes the ``intel_idle`` initialization to fail.
-The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are
-recognized by ``intel_idle`` if the kernel has been configured with ACPI
-support. In the case that ACPI is not configured these flags have no impactDocumentation/admin-guide/pm/intel_idle.rst +1
-1-on functionality. +The ``no_acpi``, ``use_acpi``, ``no_native``, and ``prefer_cst``module
+parameters are recognized by ``intel_idle`` if the kernel has been configured
+with ACPI support. If ACPI is not configured, these flags have no impact on
+functionality.
``no_acpi`` - Do not use ACPI at all. Only native mode is available, no
ACPI mode.Documentation/admin-guide/pm/intel_idle.rst +0
-0@@ -237,6 +239,9 @@ C-states on/off status in native mode.``no_native`` - Work only in ACPI mode, no native mode available (ignore
all custom tables).
+``prefer_cst`` - When using ACPI, prefer idle states coming from ``_CST`` toDocumentation/admin-guide/pm/intel_idle.rst +2
-0+idle states coming from ``_LPI`` (which is preferred by default). +The value of the ``states_off`` module parameter (0 by default) represents a
list of idle states to be disabled by default in the form of a bitmask.drivers/idle/intel_idle.c +0
-0@@ -1779,6 +1779,10 @@ static bool no_native __read_mostly; /* Noeffect if
no_acpiis set. */module_param_named(no_native, no_native, bool, 0444);MODULE_PARM_DESC(no_native, "Ignore cpu specific (native) idle states in lieu of ACPI idle states");
+static boolprefer_cst__read_mostly; /* No effect ifno_acpiis set. */drivers/idle/intel_idle.c +2
-0+module_param (prefer_cst, bool,0444 ); +MODULE_PARM_DESC(prefer_cst, "Prefer ACPI _CST idle states to ACPI
_LPIidle states");
+
static structacpi_processor_poweracpi_state_table__initdata; static boolacpi_lpi_available__initdata;drivers/idle/intel_idle.c +0
-0@@ -1855,13 +1859,12 @@ static bool __initintel_idle_acpi_extract_cst_cstates (void)
static bool__initintel_idle_acpi_extract_cstates(void){drivers/idle/intel_idle.c +3
-2-if (intel_idle_acpi_extract_lpi_cstates ()) -return true; +if (prefer_cst) +return intel_idle_acpi_extract_cst_cstates () || +intel_idle_acpi_extract_lpi_cstates ();drivers/idle/intel_idle.c +2
-4-if (intel_idle_acpi_extract_cst_cstates ()) -return true; - -return false; +return intel_idle_acpi_extract_lpi_cstates () || +intel_idle_acpi_extract_cst_cstates ();}
static bool__initintel_idle_acpi_probe(void)