Message ID | b9270896-efea-3e81-99fb-685fc5b708be@suse.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86/mwait-idle: updates from Linux (and more) | expand |
On Thu, Jan 20, 2022 at 03:05:12PM +0100, Jan Beulich wrote: > While we don't want to skip calling update_idle_stats(), arrange for it > to not increment the overall time spent in the state we didn't really > enter. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > --- > RFC: Arguably more of what follows could be moved into the if() - > thoughts? I would move at least the restoring of the TSC, but I would be fine with moving everything up to local_irq_enable unless I'm missing something. I think you could likely also avoid the call to update_idle_stats so there's no need to fetch the new tick count. Thanks, Roger.
On 20.01.2022 17:00, Roger Pau Monné wrote: > On Thu, Jan 20, 2022 at 03:05:12PM +0100, Jan Beulich wrote: >> While we don't want to skip calling update_idle_stats(), arrange for it >> to not increment the overall time spent in the state we didn't really >> enter. >> >> Signed-off-by: Jan Beulich <jbeulich@suse.com> >> --- >> RFC: Arguably more of what follows could be moved into the if() - >> thoughts? > > I would move at least the restoring of the TSC, but I would be fine > with moving everything up to local_irq_enable unless I'm missing > something. Yes, that's what I was considering. > I think you could likely also avoid the call to update_idle_stats so > there's no need to fetch the new tick count. No, this call cannot be bypassed. At least not without further rearrangements elsewhere. Jan
On Thu, Jan 20, 2022 at 05:21:31PM +0100, Jan Beulich wrote: > On 20.01.2022 17:00, Roger Pau Monné wrote: > > On Thu, Jan 20, 2022 at 03:05:12PM +0100, Jan Beulich wrote: > >> While we don't want to skip calling update_idle_stats(), arrange for it > >> to not increment the overall time spent in the state we didn't really > >> enter. > >> > >> Signed-off-by: Jan Beulich <jbeulich@suse.com> > >> --- > >> RFC: Arguably more of what follows could be moved into the if() - > >> thoughts? > > > > I would move at least the restoring of the TSC, but I would be fine > > with moving everything up to local_irq_enable unless I'm missing > > something. > > Yes, that's what I was considering. > > > I think you could likely also avoid the call to update_idle_stats so > > there's no need to fetch the new tick count. > > No, this call cannot be bypassed. At least not without further > rearrangements elsewhere. Ack, I would move everything you can then. Thanks, Roger.
--- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -861,9 +861,11 @@ static void mwait_idle(void) mwait_idle_with_hints(cx->address, MWAIT_ECX_INTERRUPT_BREAK); local_irq_disable(); - } - after = alternative_call(cpuidle_get_tick); + after = alternative_call(cpuidle_get_tick); + } + else + before = after = alternative_call(cpuidle_get_tick); cstate_restore_tsc(); trace_exit_reason(irq_traced);
While we don't want to skip calling update_idle_stats(), arrange for it to not increment the overall time spent in the state we didn't really enter. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- RFC: Arguably more of what follows could be moved into the if() - thoughts? --- v2: New.