Re: [PATCH v1 08/13] perf/x86/core: add idle hooks

From: Peter Zijlstra
Date: Thu Sep 09 2021 - 05:16:41 EST


On Thu, Sep 09, 2021 at 12:56:55AM -0700, Stephane Eranian wrote:

> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> index 14ce130aee1b..c0ddc3c32a33 100644
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -179,7 +179,6 @@ static void cpuidle_idle_call(void)
> */
> if (need_resched()) {
> local_irq_enable();
> - perf_lopwr_cb(false);
> return;
> }
>
> @@ -230,6 +229,9 @@ static void cpuidle_idle_call(void)
> tick_nohz_idle_stop_tick();
>
> next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns);
> + if (!cpu_idle_force_poll)
> + perf_lopwr_cb(true);
> +
> call_cpuidle(drv, dev, next_state);
> } else {
> bool stop_tick = true;
> @@ -244,12 +246,17 @@ static void cpuidle_idle_call(void)
> else
> tick_nohz_idle_retain_tick();
>
> + if (!cpu_idle_force_poll)
> + perf_lopwr_cb(true);
> +
> entered_state = call_cpuidle(drv, dev, next_state);
> /*
> * Give the governor an opportunity to reflect on the outcome
> */
> cpuidle_reflect(dev, entered_state);
> }
> + if (!cpu_idle_force_poll)
> + perf_lopwr_cb(false);
>
> exit_idle:
> __current_set_polling();
> @@ -259,7 +266,6 @@ static void cpuidle_idle_call(void)
> */
> if (WARN_ON_ONCE(irqs_disabled())) {
> local_irq_enable();
> - perf_lopwr_cb(false);
> }
> }
>
> @@ -293,8 +299,6 @@ static void do_idle(void)
> while (!need_resched()) {
> rmb();
>
> - perf_lopwr_cb(true);
> -
> local_irq_disable();
>
> if (cpu_is_offline(cpu)) {

Why are you sendimg me a patch that undoes most of what the previous
patch does? That's just bad form.