On guest entry, vcpu->cpu and vcpu->arch.thread_cpu are set after
disabling host irqs. On guest exit there is a window whre tick time
accounting briefly enables irqs before these fields are cleared.
Move them up to ensure they are cleared before host irqs are run.
This is possibly not a problem, but is more symmetric and makes the
fields less surprising.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220908132545.4085849-1-npiggin@gmail.com
 
        set_irq_happened(trap);
 
+       vcpu->cpu = -1;
+       vcpu->arch.thread_cpu = -1;
+
        context_tracking_guest_exit();
        if (!vtime_accounting_enabled_this_cpu()) {
                local_irq_enable();
        }
        vtime_account_guest_exit();
 
-       vcpu->cpu = -1;
-       vcpu->arch.thread_cpu = -1;
-
        powerpc_local_irq_pmu_restore(flags);
 
        preempt_enable();