x86/mwait-idle: re-order state entry/exit code a little
authorJan Beulich <jbeulich@suse.com>
Thu, 24 Feb 2022 10:20:34 +0000 (11:20 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 24 Feb 2022 10:20:34 +0000 (11:20 +0100)
commite67ab91fc4324418d11c941d883361a243aaa2d7
treef60819ed34855b8fe96b531e0724ef7db0e581f0
parent81c416dca231d2292f52690adc64921e233bacd9
x86/mwait-idle: re-order state entry/exit code a little

The initial observation is that unlike the original ACPI idle driver we
have a 2nd cpu_is_haltable() in here. By making the actual state entry
conditional, the emitted trace records as well as the subsequent stats
update are at least misleading in case the state wasn't actually entered.
Hence they would want moving inside the conditional. At which point the
cpuidle_get_tick() invocations could (and hence should) move as well.
cstate_restore_tsc() also isn't needed if we didn't actually enter the
state.

This leaves only the errata_c6_workaround() and lapic_timer_off()
invocations outside the conditional. As a result it looks easier to
drop the conditional (and come back in sync with the other driver again)
than to move almost everything into the conditional.

While there also move the TRACE_6D() out of the IRQ-disabled region.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/cpu/mwait-idle.c