Skip to content

Commit 5e7e39a

Browse files
darcarirafaeljw
authored andcommitted
intel_idle: introduce 'no_native' module parameter
Since commit 1873495 ("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 a new 'no_native' module parameter to provide this functionality. Signed-off-by: David Arcari <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Artem Bityutskiy <[email protected]> [ rjw: Spell CPU in capitals ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c93d13b commit 5e7e39a

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

Documentation/admin-guide/pm/intel_idle.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,19 @@ even if they have been enumerated (see :ref:`cpu-pm-qos` in
192192
Documentation/admin-guide/pm/cpuidle.rst).
193193
Setting ``max_cstate`` to 0 causes the ``intel_idle`` initialization to fail.
194194

195-
The ``no_acpi`` and ``use_acpi`` module parameters (recognized by ``intel_idle``
196-
if the kernel has been configured with ACPI support) can be set to make the
197-
driver ignore the system's ACPI tables entirely or use them for all of the
198-
recognized processor models, respectively (they both are unset by default and
199-
``use_acpi`` has no effect if ``no_acpi`` is set).
195+
The ``no_acpi``, ``use_acpi`` and ``no_native`` module parameters are
196+
recognized by ``intel_idle`` if the kernel has been configured with ACPI
197+
support. In the case that ACPI is not configured these flags have no impact
198+
on functionality.
199+
200+
``no_acpi`` - Do not use ACPI at all. Only native mode is available, no
201+
ACPI mode.
202+
203+
``use_acpi`` - No-op in ACPI mode, the driver will consult ACPI tables for
204+
C-states on/off status in native mode.
205+
206+
``no_native`` - Work only in ACPI mode, no native mode available (ignore
207+
all custom tables).
200208

201209
The value of the ``states_off`` module parameter (0 by default) represents a
202210
list of idle states to be disabled by default in the form of a bitmask.

drivers/idle/intel_idle.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,10 @@ static bool force_use_acpi __read_mostly; /* No effect if no_acpi is set. */
16921692
module_param_named(use_acpi, force_use_acpi, bool, 0444);
16931693
MODULE_PARM_DESC(use_acpi, "Use ACPI _CST for building the idle states list");
16941694

1695+
static bool no_native __read_mostly; /* No effect if no_acpi is set. */
1696+
module_param_named(no_native, no_native, bool, 0444);
1697+
MODULE_PARM_DESC(no_native, "Ignore cpu specific (native) idle states in lieu of ACPI idle states");
1698+
16951699
static struct acpi_processor_power acpi_state_table __initdata;
16961700

16971701
/**
@@ -1831,6 +1835,11 @@ static bool __init intel_idle_off_by_default(unsigned int flags, u32 mwait_hint)
18311835
}
18321836
return true;
18331837
}
1838+
1839+
static inline bool ignore_native(void)
1840+
{
1841+
return no_native && !no_acpi;
1842+
}
18341843
#else /* !CONFIG_ACPI_PROCESSOR_CSTATE */
18351844
#define force_use_acpi (false)
18361845

@@ -1840,6 +1849,7 @@ static inline bool intel_idle_off_by_default(unsigned int flags, u32 mwait_hint)
18401849
{
18411850
return false;
18421851
}
1852+
static inline bool ignore_native(void) { return false; }
18431853
#endif /* !CONFIG_ACPI_PROCESSOR_CSTATE */
18441854

18451855
/**
@@ -2333,6 +2343,10 @@ static int __init intel_idle_init(void)
23332343
pr_debug("MWAIT substates: 0x%x\n", mwait_substates);
23342344

23352345
icpu = (const struct idle_cpu *)id->driver_data;
2346+
if (icpu && ignore_native()) {
2347+
pr_debug("ignoring native CPU idle states\n");
2348+
icpu = NULL;
2349+
}
23362350
if (icpu) {
23372351
if (icpu->state_table)
23382352
cpuidle_state_table = icpu->state_table;

0 commit comments

Comments
 (0)