[PATCH RFC v2 5/5] x86/mwait-idle: squash stats update when not actually entering C-state

Jan Beulich posted 5 patches 4 years ago
There is a newer version of this series
[PATCH RFC v2 5/5] x86/mwait-idle: squash stats update when not actually entering C-state
Posted by Jan Beulich 4 years ago
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.

--- 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);