KVM: PPC: Book3S HV: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN
authorLaurent Vivier <lvivier@redhat.com>
Fri, 2 Mar 2018 10:51:56 +0000 (11:51 +0100)
committerPaul Mackerras <paulus@ozlabs.org>
Sat, 3 Mar 2018 08:28:34 +0000 (19:28 +1100)
commit61bd0f66ff92d5ce765ff9850fd3cbfec773c560
treee537610f5576aba85a1980fd085f15ca12e6b00b
parentdebd574f4195e205ba505b25e19b2b797f4bcd94
KVM: PPC: Book3S HV: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN

Since commit 8b24e69fc47e ("KVM: PPC: Book3S HV: Close race with testing
for signals on guest entry"), if CONFIG_VIRT_CPU_ACCOUNTING_GEN is set, the
guest time is not accounted to guest time and user time, but instead to
system time.

This is because guest_enter()/guest_exit() are called while interrupts
are disabled and the tick counter cannot be updated between them.

To fix that, move guest_exit() after local_irq_enable(), and as
guest_enter() is called with IRQ disabled, call guest_enter_irqoff()
instead.

Fixes: 8b24e69fc47e ("KVM: PPC: Book3S HV: Close race with testing for signals on guest entry")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv.c