Message ID | 20230419143947.1342730-1-dedekind1@gmail.com |
---|---|
Headers | show |
Series | misc intel_idle cleanups | expand |
On Thu, 2023-04-20 at 01:28 +0000, Zhang, Rui wrote: > > Make the code be more consistent and easier to read by using only the > > 2nd way after > > > the been done. > > is this a typo? Yes, some sort of editing leftover, will adjust, thanks. Artem.
On Wed, 2023-04-19 at 17:39 +0300, Artem Bityutskiy wrote: > From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> > > Introduce a temporary 'state' variable for referencing the currently > processed C-state in the 'intel_idle_init_cstates_icpu()' function. > > This makes code lines shorter and easier to read. > > 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 | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c > index 190410fc9ce5..73ddb1d8cfcf 100644 > --- a/drivers/idle/intel_idle.c > +++ b/drivers/idle/intel_idle.c > @@ -1871,6 +1871,7 @@ static void __init > intel_idle_init_cstates_icpu(struct cpuidle_driver *drv) > } > > for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) { > + struct cpuidle_state *state; > unsigned int mwait_hint; > > if (intel_idle_max_cstate_reached(cstate)) > @@ -1893,29 +1894,30 @@ static void __init > intel_idle_init_cstates_icpu(struct cpuidle_driver *drv) > > /* Structure copy. */ > drv->states[drv->state_count] = > cpuidle_state_table[cstate]; > + state = &drv->states[drv->state_count]; > > - if ((drv->states[drv->state_count].flags & > CPUIDLE_FLAG_IRQ_ENABLE) || force_irq_on) { > + if ((state->flags & CPUIDLE_FLAG_IRQ_ENABLE) || > force_irq_on) { > pr_info("forced intel_idle_irq for state %d\n", > cstate); > - drv->states[drv->state_count].enter = > intel_idle_irq; > + state->enter = intel_idle_irq; > } > > if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) && > - drv->states[drv->state_count].flags & > CPUIDLE_FLAG_IBRS) { > - WARN_ON_ONCE(drv->states[drv- > >state_count].flags & CPUIDLE_FLAG_IRQ_ENABLE); > - drv->states[drv->state_count].enter = > intel_idle_ibrs; > + state->flags & CPUIDLE_FLAG_IBRS) { > + WARN_ON_ONCE(state->flags & > CPUIDLE_FLAG_IRQ_ENABLE); > + state->enter = intel_idle_ibrs; > } > > - if (drv->states[drv->state_count].flags & > CPUIDLE_FLAG_INIT_XSTATE) > - drv->states[drv->state_count].enter = > intel_idle_xstate; > + if (state->flags & CPUIDLE_FLAG_INIT_XSTATE) > + state->enter = intel_idle_xstate; > > if ((disabled_states_mask & BIT(drv->state_count)) || > ((icpu->use_acpi || force_use_acpi) && > intel_idle_off_by_default(mwait_hint) && > - !(drv->states[drv->state_count].flags & > CPUIDLE_FLAG_ALWAYS_ENABLE))) > - drv->states[drv->state_count].flags |= > CPUIDLE_FLAG_OFF; > + !(state->flags & CPUIDLE_FLAG_ALWAYS_ENABLE))) > + state->flags |= CPUIDLE_FLAG_OFF; > > - if (intel_idle_state_needs_timer_stop(&drv->states[drv- > >state_count])) > - drv->states[drv->state_count].flags |= > CPUIDLE_FLAG_TIMER_STOP; > + if (intel_idle_state_needs_timer_stop(state)) > + state->flags |= CPUIDLE_FLAG_TIMER_STOP; > > drv->state_count++; > }
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> These are misc. clean-up and minor improvement patches for 'intel_idle'. The common theme in them is improving the 'intel_idle_init_cstates_icpu()' function and things around it. The patches are against the 'linux-pm' tree, the 'linux-next' branch. Artem Bityutskiy (7): intel_idle: use pr_info instead of printk intel_idle: cleanup 'intel_idle_init_cstates_icpu()' intel_idle: further 'intel_idle_init_cstates_icpu()' cleanup intel_idle: improve C-state flags handling robustness intel_idle: fix confusing message intel_idle: do not sprinkle module parameters definitions around intel_idle: mark few variables as '__read_mostly' drivers/idle/intel_idle.c | 58 ++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 22 deletions(-) base-commit: bc538c8be4bd17479f88f2e1a78d5b76b5523319