Re: linux-next: Tree for Nov 27 (drivers/idle/intel_idle.c)

From: Peter Zijlstra
Date: Mon Nov 30 2020 - 06:54:57 EST


On Sat, Nov 28, 2020 at 08:36:17AM +1100, Stephen Rothwell wrote:
> Hi Randy,
>
> On Fri, 27 Nov 2020 07:57:32 -0800 Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
> >
> > On 11/27/20 1:04 AM, Stephen Rothwell wrote:
> > > Hi all,
> > >
> > > Changes since 20201126:
> > >
> >
> > (This looks strange to me.)
> >
> >
> > on i386 or x86_64:
> >
> > # CONFIG_ACPI is not set
> >
> > ../drivers/idle/intel_idle.c: In function ‘intel_idle_init_cstates_icpu’:
> > ../drivers/idle/intel_idle.c:1510:7: error: implicit declaration of function ‘intel_idle_state_needs_timer_stop’; did you mean ‘intel_idle_init_cstates_icpu’? [-Werror=implicit-function-declaration]
> > if (intel_idle_state_needs_timer_stop(&drv->states[drv->state_count]))
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> intel_idle_state_needs_timer_stop() is only defined when
> CONFIG_ACPI_PROCESSOR_CSTATE is set, but is used once where that is not
> necessarily set. I assume CONFIG_ACPI_PROCESSOR_CSTATE is not set in
> your config?

Bah... :/

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 7ee7ffe22ae3..d79335506ecd 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1140,6 +1140,20 @@ static bool __init intel_idle_max_cstate_reached(int cstate)
return false;
}

+static bool __init intel_idle_state_needs_timer_stop(struct cpuidle_state *state)
+{
+ unsigned long eax = flg2MWAIT(state->flags);
+
+ if (boot_cpu_has(X86_FEATURE_ARAT))
+ return false;
+
+ /*
+ * Switch over to one-shot tick broadcast if the target C-state
+ * is deeper than C1.
+ */
+ return !!((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK);
+}
+
#ifdef CONFIG_ACPI_PROCESSOR_CSTATE
#include <acpi/processor.h>

@@ -1210,20 +1224,6 @@ static bool __init intel_idle_acpi_cst_extract(void)
return false;
}

-static bool __init intel_idle_state_needs_timer_stop(struct cpuidle_state *state)
-{
- unsigned long eax = flg2MWAIT(state->flags);
-
- if (boot_cpu_has(X86_FEATURE_ARAT))
- return false;
-
- /*
- * Switch over to one-shot tick broadcast if the target C-state
- * is deeper than C1.
- */
- return !!((eax >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK);
-}
-
static void __init intel_idle_init_cstates_acpi(struct cpuidle_driver *drv)
{
int cstate, limit = min_t(int, CPUIDLE_STATE_MAX, acpi_state_table.count);