diff mbox series

[v2] intel_idle: introduce 'no_native' module parameter

Message ID 20250206164009.816232-1-darcari@redhat.com
State Superseded
Headers show
Series [v2] intel_idle: introduce 'no_native' module parameter | expand

Commit Message

David Arcari Feb. 6, 2025, 4:40 p.m. UTC
Since commit 18734958e9bf ("intel_idle: Use ACPI _CST for processor models
without C-state tables") the intel_idle driver has had the ability to use
the ACPI _CST to populate C-states when the processor model is not
recognized. However, even when the processor model is recognized (native
mode) there are cases where it is useful to make the driver ignore the per
cpu idle states in lieu of ACPI C-states (such as specific application
performance). Add the 'no_native' module parameter to provide this
functionality.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: David Arcari <darcari@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David Arcari <darcari@redhat.com>
---
v2: renamed parameter, cleaned up documentation

 Documentation/admin-guide/pm/intel_idle.rst | 17 ++++++++++++-----
 drivers/idle/intel_idle.c                   | 11 +++++++++++
 2 files changed, 23 insertions(+), 5 deletions(-)

Comments

Artem Bityutskiy Feb. 7, 2025, 3:55 p.m. UTC | #1
Hi David,

On Thu, 2025-02-06 at 11:40 -0500, David Arcari wrote:
> +The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are
> +recognized by ``intel_idle`` if the kernel has been configured with ACPI
> +support).

And if kernel was not configured with ACPI support, are these not recognized? Or
they are just no-op basically?

Looks like there is a stray ")" at the end.

> +
> +``no_acpi`` - Do not use ACPI at all.  Only native mode is available, no
> +ACPI mode.
> +
> +``use_acpi`` - No-op in ACPI mode; however, the driver will consult ACPI
> +tables for C-states on/off status in native mode.

I think "however" part is a bit confusing. Would you consider re-phrasing
without "however" ?

> +
> +``no_native`` - Work only in ACPI mode, no native mode available (ignore
> +all custom tables).

Other than these small nitpicks,

Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

(I tested it on an Intel Broadwell platform).

Thanks!
David Arcari Feb. 7, 2025, 5:13 p.m. UTC | #2
Hi Artem,

On 2/7/25 10:55 AM, Artem Bityutskiy wrote:
> Hi David,
> 
> On Thu, 2025-02-06 at 11:40 -0500, David Arcari wrote:
>> +The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are
>> +recognized by ``intel_idle`` if the kernel has been configured with ACPI
>> +support).
> 
> And if kernel was not configured with ACPI support, are these not recognized? Or
> they are just no-op basically?

They are a no-op - the flags are all set to false so ACPI C-state tables 
are ignored.

> 
> Looks like there is a stray ")" at the end.
> 

Yes I will fix that.

>> +
>> +``no_acpi`` - Do not use ACPI at all.  Only native mode is available, no
>> +ACPI mode.
>> +
>> +``use_acpi`` - No-op in ACPI mode; however, the driver will consult ACPI
>> +tables for C-states on/off status in native mode.
> 
> I think "however" part is a bit confusing. Would you consider re-phrasing
> without "however" ?

Sure - so is this better:

``use_acpi`` - No-op in ACPI mode, the driver will consult ACPI tabees 
for C-states on/off status in native mode.

Thanks,
-DA
> 
>> +
>> +``no_native`` - Work only in ACPI mode, no native mode available (ignore
>> +all custom tables).
> 
> Other than these small nitpicks,
> 
> Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> 
> (I tested it on an Intel Broadwell platform).
> 
> Thanks!
>
Artem Bityutskiy Feb. 8, 2025, 10:37 a.m. UTC | #3
On Fri, 2025-02-07 at 12:13 -0500, David Arcari wrote:
> > And if kernel was not configured with ACPI support, are these not
> > recognized? Or
> > they are just no-op basically?
> 
> They are a no-op - the flags are all set to false so ACPI C-state tables 
> are ignored.

It would be nice to mention this too. Otherwise it sounds a bit incomplete. Like
this:

	If A then B. (nothing about "else").

Better way:

	If A then B, else C.

:-)

> > 
> Sure - so is this better:
> 
> ``use_acpi`` - No-op in ACPI mode, the driver will consult ACPI tabees 
> for C-states on/off status in native mode.

Yes, thanks!
David Arcari Feb. 8, 2025, 7:56 p.m. UTC | #4
On 2/8/25 5:37 AM, Artem Bityutskiy wrote:
> On Fri, 2025-02-07 at 12:13 -0500, David Arcari wrote:
>>> And if kernel was not configured with ACPI support, are these not
>>> recognized? Or
>>> they are just no-op basically?
>>
>> They are a no-op - the flags are all set to false so ACPI C-state tables
>> are ignored.
> 
> It would be nice to mention this too. Otherwise it sounds a bit incomplete. Like
> this:
> 
> 	If A then B. (nothing about "else").
> 
> Better way:
> 
> 	If A then B, else C.
> 
> :-)

I actually took that from what was already there.

So I can add "In the case that ACPI is not configured these flags have 
no impact on functionality."

Does that work?

-DA

> 
>>>
>> Sure - so is this better:
>>
>> ``use_acpi`` - No-op in ACPI mode, the driver will consult ACPI tabees
>> for C-states on/off status in native mode.
> 
> Yes, thanks!
>
Artem Bityutskiy Feb. 9, 2025, 9:08 a.m. UTC | #5
On Sat, 2025-02-08 at 14:56 -0500, David Arcari wrote:
> I actually took that from what was already there.
> 
> So I can add "In the case that ACPI is not configured these flags have 
> no impact on functionality."
> 
> Does that work?

Works for me!

Thanks,
Artem.
diff mbox series

Patch

diff --git a/Documentation/admin-guide/pm/intel_idle.rst b/Documentation/admin-guide/pm/intel_idle.rst
index 39bd6ecce7de..1f02a880836c 100644
--- a/Documentation/admin-guide/pm/intel_idle.rst
+++ b/Documentation/admin-guide/pm/intel_idle.rst
@@ -192,11 +192,18 @@  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`` and ``use_acpi`` module parameters (recognized by ``intel_idle``
-if the kernel has been configured with ACPI support) can be set to make the
-driver ignore the system's ACPI tables entirely or use them for all of the
-recognized processor models, respectively (they both are unset by default and
-``use_acpi`` has no effect if ``no_acpi`` is set).
+The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are
+recognized by ``intel_idle`` if the kernel has been configured with ACPI
+support).
+
+``no_acpi`` - Do not use ACPI at all.  Only native mode is available, no
+ACPI mode.
+
+``use_acpi`` - No-op in ACPI mode; however, the driver will consult ACPI
+tables for C-states on/off status in native mode.
+
+``no_native`` - Work only in ACPI mode, no native mode available (ignore
+all custom tables).
 
 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.
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 118fe1d37c22..5e5bd3fd3064 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1695,6 +1695,10 @@  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");
 
+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 struct acpi_processor_power acpi_state_table __initdata;
 
 /**
@@ -1836,6 +1840,7 @@  static bool __init intel_idle_off_by_default(unsigned int flags, u32 mwait_hint)
 }
 #else /* !CONFIG_ACPI_PROCESSOR_CSTATE */
 #define force_use_acpi	(false)
+#define no_native	(false)
 
 static inline bool intel_idle_acpi_cst_extract(void) { return false; }
 static inline void intel_idle_init_cstates_acpi(struct cpuidle_driver *drv) { }
@@ -2328,6 +2333,12 @@  static int __init intel_idle_init(void)
 	pr_debug("MWAIT substates: 0x%x\n", mwait_substates);
 
 	icpu = (const struct idle_cpu *)id->driver_data;
+	if (no_native && !no_acpi) {
+		if (icpu) {
+			pr_debug("ignoring native cpu idle states\n");
+			icpu = NULL;
+		}
+	}
 	if (icpu) {
 		if (icpu->state_table)
 			cpuidle_state_table = icpu->state_table;