diff mbox series

[5/7] intel_idle: fix confusing message

Message ID 20230419143947.1342730-6-dedekind1@gmail.com
State New
Headers show
Series misc intel_idle cleanups | expand

Commit Message

Artem Bityutskiy April 19, 2023, 2:39 p.m. UTC
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

By default, all non-POLL C-states are entered with interrupts disable.
There are 2 ways to make 'intel_idle' enter C-states with interrupts
enabled:
  1. Mark the C-state with the 'CPUIDLE_FLAG_IRQ_ENABLE' flag.
  2. Use the 'force_irq_on' module parameter.

The former is the "proper" way of doing it, it is per-C-state and
per-platform. The latter is for debugging purposes only.

The problem is that 'intel_idle' prints the "forced intel_idle_irq"
message in both cases, even though the former case does not needed
this message, because nothing is forced there. This patch addresses the
problem.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 drivers/idle/intel_idle.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Zhang Rui April 20, 2023, 8:22 a.m. UTC | #1
On Wed, 2023-04-19 at 17:39 +0300, Artem Bityutskiy wrote:
> From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> 
> By default, all non-POLL C-states are entered with interrupts
> disable.
> There are 2 ways to make 'intel_idle' enter C-states with interrupts
> enabled:
>   1. Mark the C-state with the 'CPUIDLE_FLAG_IRQ_ENABLE' flag.
>   2. Use the 'force_irq_on' module parameter.
> 
> The former is the "proper" way of doing it, it is per-C-state and
> per-platform. The latter is for debugging purposes only.
> 
> The problem is that 'intel_idle' prints the "forced intel_idle_irq"
> message in both cases, even though the former case does not needed
> this message, because nothing is forced there. This patch addresses
> the
> problem.
> 
> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

Reviewed-by: Zhang Rui <rui.zhang@intel.com>

thanks,
rui
> ---
>  drivers/idle/intel_idle.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index 1de36df15d5a..bff0d17aeda4 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -1912,8 +1912,9 @@ static void __init
> intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
>  			 */
>  			WARN_ON_ONCE(state->flags &
> CPUIDLE_FLAG_IRQ_ENABLE);
>  			state->enter = intel_idle_ibrs;
> -		} else if ((state->flags & CPUIDLE_FLAG_IRQ_ENABLE) ||
> -			   force_irq_on) {
> +		} else if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) {
> +			state->enter = intel_idle_irq;
> +		} else if (force_irq_on) {
>  			pr_info("forced intel_idle_irq for state %d\n",
> cstate);
>  			state->enter = intel_idle_irq;
>  		}
diff mbox series

Patch

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 1de36df15d5a..bff0d17aeda4 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1912,8 +1912,9 @@  static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)
 			 */
 			WARN_ON_ONCE(state->flags & CPUIDLE_FLAG_IRQ_ENABLE);
 			state->enter = intel_idle_ibrs;
-		} else if ((state->flags & CPUIDLE_FLAG_IRQ_ENABLE) ||
-			   force_irq_on) {
+		} else if (state->flags & CPUIDLE_FLAG_IRQ_ENABLE) {
+			state->enter = intel_idle_irq;
+		} else if (force_irq_on) {
 			pr_info("forced intel_idle_irq for state %d\n", cstate);
 			state->enter = intel_idle_irq;
 		}