From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Date: Sun, 30 Jun 2019 08:37:34 +0000 Subject: Re: [PATCH 3/3] KVM: PPC: Book3S HV: Clear pending decr exceptions on nested guest entry Message-Id: <45c3ly4fpfz9sCJ@ozlabs.org> List-Id: In-Reply-To: <20190620014651.7645-3-sjitindarsingh@gmail.com> References: <20190620014651.7645-3-sjitindarsingh@gmail.com> In-Reply-To: <20190620014651.7645-3-sjitindarsingh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Suraj Jitindar Singh , linuxppc-dev@lists.ozlabs.org Cc: clg@kaod.org, kvm-ppc@vger.kernel.org, sjitindarsingh@gmail.com On Thu, 2019-06-20 at 01:46:51 UTC, Suraj Jitindar Singh wrote: > If we enter an L1 guest with a pending decrementer exception then this > is cleared on guest exit if the guest has writtien a positive value into > the decrementer (indicating that it handled the decrementer exception) > since there is no other way to detect that the guest has handled the > pending exception and that it should be dequeued. In the event that the > L1 guest tries to run a nested (L2) guest immediately after this and the > L2 guest decrementer is negative (which is loaded by L1 before making > the H_ENTER_NESTED hcall), then the pending decrementer exception > isn't cleared and the L2 entry is blocked since L1 has a pending > exception, even though L1 may have already handled the exception and > written a positive value for it's decrementer. This results in a loop of > L1 trying to enter the L2 guest and L0 blocking the entry since L1 has > an interrupt pending with the outcome being that L2 never gets to run > and hangs. > > Fix this by clearing any pending decrementer exceptions when L1 makes > the H_ENTER_NESTED hcall since it won't do this if it's decrementer has > gone negative, and anyway it's decrementer has been communicated to L0 > in the hdec_expires field and L0 will return control to L1 when this > goes negative by delivering an H_DECREMENTER exception. > > Fixes: 95a6432ce903 "KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests" > > Signed-off-by: Suraj Jitindar Singh > Tested-by: Laurent Vivier Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/3c25ab35fbc8526ac0c9b298e8a78e7ad7a55479 cheers