From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C2DC5B57E for ; Sun, 30 Jun 2019 08:59:10 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AE6820449 for ; Sun, 30 Jun 2019 08:59:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AE6820449 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45c4Dq1w6DzDr5X for ; Sun, 30 Jun 2019 18:59:07 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45c3lz3GMLzDqh2 for ; Sun, 30 Jun 2019 18:37:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Received: by ozlabs.org (Postfix, from userid 1034) id 45c3ly4fpfz9sCJ; Sun, 30 Jun 2019 18:37:34 +1000 (AEST) X-powerpc-patch-notification: thanks X-powerpc-patch-commit: 3c25ab35fbc8526ac0c9b298e8a78e7ad7a55479 X-Patchwork-Hint: ignore In-Reply-To: <20190620014651.7645-3-sjitindarsingh@gmail.com> To: Suraj Jitindar Singh , linuxppc-dev@lists.ozlabs.org From: Michael Ellerman Subject: Re: [PATCH 3/3] KVM: PPC: Book3S HV: Clear pending decr exceptions on nested guest entry Message-Id: <45c3ly4fpfz9sCJ@ozlabs.org> Date: Sun, 30 Jun 2019 18:37:34 +1000 (AEST) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: clg@kaod.org, kvm-ppc@vger.kernel.org, sjitindarsingh@gmail.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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