KVM: PPC: Book3S HV: Handle H_DOORBELL on the guest exit path
authorGautham R. Shenoy <ego@linux.vnet.ibm.com>
Thu, 15 Oct 2015 05:59:58 +0000 (11:29 +0530)
committerPaul Mackerras <paulus@samba.org>
Wed, 21 Oct 2015 05:31:52 +0000 (16:31 +1100)
commit70aa3961a196ac32baf54032b2051bac9a941118
treec014c098d5c8b98906a4d2a0e80a47a08375a020
parentbfec5c2cc0adad3b343281eb4f9b94222c5f594f
KVM: PPC: Book3S HV: Handle H_DOORBELL on the guest exit path

Currently a CPU running a guest can receive a H_DOORBELL in the
following two cases:
1) When the CPU is napping due to CEDE or there not being a guest
vcpu.
2) The CPU is running the guest vcpu.

Case 1), the doorbell message is not cleared since we were waking up
from nap. Hence when the EE bit gets set on transition from guest to
host, the H_DOORBELL interrupt is delivered to the host and the
corresponding handler is invoked.

However in Case 2), the message gets cleared by the action of taking
the H_DOORBELL interrupt. Since the CPU was running a guest, instead
of invoking the doorbell handler, the code invokes the second-level
interrupt handler to switch the context from the guest to the host. At
this point the setting of the EE bit doesn't result in the CPU getting
the doorbell interrupt since it has already been delivered once. So,
the handler for this doorbell is never invoked!

This causes softlockups if the missed DOORBELL was an IPI sent from a
sibling subcore on the same CPU.

This patch fixes it by explitly invoking the doorbell handler on the
exit path if the exit reason is H_DOORBELL similar to the way an
EXTERNAL interrupt is handled. Since this will also handle Case 1), we
can unconditionally clear the doorbell message in
kvmppc_check_wake_reason.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kvm/book3s_hv_rmhandlers.S