Re: [RFC][PATCH 1/4] acpi: Use CPUIDLE_FLAG_TIMER_STOP

From: Rafael J. Wysocki
Date: Tue Sep 22 2020 - 15:10:03 EST


On Tuesday, September 22, 2020 5:26:51 AM CEST Guenter Roeck wrote:
> On Tue, Sep 15, 2020 at 12:31:58PM +0200, Peter Zijlstra wrote:
> > Make acpi_processor_idle use the common broadcast code, there's no
> > reason not to. This also removes some RCU usage after
> > rcu_idle_enter().
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> > Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> > Reported-by: Borislav Petkov <bp@xxxxxxx>
> > Tested-by: Borislav Petkov <bp@xxxxxxx>
> > ---
> > drivers/acpi/processor_idle.c | 49 +++++++++++++-----------------------------
> > 1 file changed, 16 insertions(+), 33 deletions(-)
> >
> > --- a/drivers/acpi/processor_idle.c
> > +++ b/drivers/acpi/processor_idle.c
> > @@ -161,18 +161,10 @@ static void lapic_timer_propagate_broadc
> > }
> >
> > /* Power(C) State timer broadcast control */
> > -static void lapic_timer_state_broadcast(struct acpi_processor *pr,
> > - struct acpi_processor_cx *cx,
> > - int broadcast)
> > -{
> > - int state = cx - pr->power.states;
> > -
> > - if (state >= pr->power.timer_broadcast_on_state) {
> > - if (broadcast)
> > - tick_broadcast_enter();
> > - else
> > - tick_broadcast_exit();
> > - }
> > +static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
> > + struct acpi_processor_cx *cx)
> > +{
> > + return cx - pr->power.states >= pr->power.timer_broadcast_on_state;
> > }
> >
> > #else
> > @@ -180,9 +172,9 @@ static void lapic_timer_state_broadcast(
> > static void lapic_timer_check_state(int state, struct acpi_processor *pr,
> > struct acpi_processor_cx *cstate) { }
> > static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
> > -static void lapic_timer_state_broadcast(struct acpi_processor *pr,
> > - struct acpi_processor_cx *cx,
> > - int broadcast)
> > +
> > +static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
> > + struct acpi_processor_cx *cx)
> > {
> > }
>
> drivers/acpi/processor_idle.c: In function 'lapic_timer_needs_broadcast':
> drivers/acpi/processor_idle.c:179:1: warning: no return statement in function returning non-void [-Wreturn-type]
>
> Should this return true or false ?

false - if the lapic timer doesn't stop, it doesn't need broadcast.

FWIW, patch appended.

Cheers!

---
From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
Subject: [PATCH] ACPI: processor: Fix build for ARCH_APICTIMER_STOPS_ON_C3 unset

Fix the lapic_timer_needs_broadcast() stub for
ARCH_APICTIMER_STOPS_ON_C3 unset to actually return
a value.

Fixes: aa6b43d57f99 ("ACPI: processor: Use CPUIDLE_FLAG_TIMER_STOP")
Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/processor_idle.c | 1 +
1 file changed, 1 insertion(+)

Index: linux-pm/drivers/acpi/processor_idle.c
===================================================================
--- linux-pm.orig/drivers/acpi/processor_idle.c
+++ linux-pm/drivers/acpi/processor_idle.c
@@ -176,6 +176,7 @@ static void lapic_timer_propagate_broadc
static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
struct acpi_processor_cx *cx)
{
+ return false;
}

#endif