From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387440; b=b0Ch4yW8c+jE3c/XLWjh9hMH1FzHI7hw79sldCCzlEXfOwrDx0sOYqcKrJ3ikuHXuDdw iwuA0/yWVL7BwdQZ5Q4C08M4hC0hSbcplBGTENK9fczWPzQe9rbaBBxOYCo8h4RQYJqVg GHiNYLDZn+BGv2Ynf28I3wTvDcHjEZqv4d8qEY7bzLkMgJgk1h97qFOEK8+TUbUxYzQjp 3fU1hI8eUs0vgb+lPpB1yvFsmUultw8PZuRKCluXj+I5FbTu+MIA9FiXZZRLvKakyXs4l GIPbVKcoAghuChO4gs8Pbwy3nEWoxorI8Kla3SJJL4ekfzmxbhZP7kBpJRrtKh1HsEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387440; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=AKJluxirufmmeUd/TLOZQEsCiIJE3QTWLzHG8RFkMpE=; b=A1crgqlOidzax3j/XPqek+t9hommaRzth+cvKqc+VmxyGb0YXiKJRajrwQrOUoultGne hxJuFyjytc2VPOb1rWT3+eqpoLTrMGwDTFBJw9/fp8UxlWHZcEU1zL1F5CMaqIpiexV0Y XnIh04E3IJ5faj6Kswag3HToDZxcXA++NLvcDeuLuomddrXzEPq4CzvNIpbT8SRHLKiUV yAYnhbeqUe97/jlYdRrEFKgfO8C+Yxibk8h0fM2FVKZXANEGAJlBMlHyssYN6FhFfnDKg lrNvcr43uUgppZxz5oqSFSU6sb3844pRowGtE/rvL2+q3IRKm/EN2IBcvvu8VkO/E7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=r8Z3MWDy; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2391606A322; Fri, 4 Dec 2026 12:30:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=r8Z3MWDy Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AAE31F000C2; Fri, 4 Dec 2026 12:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387440; bh=AKJluxirufmmeUd/TLOZQEsCiIJE3QTWLzHG8RFkMpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=r8Z3MWDy7F2oH0yr0hoaXevIf07JRCLZb3SGUaRs5gYFe8GG2rGh/erGZfb646nrj 5HVyWrlyHEIV7ir9OZi1YEp+r863bvfjfzlQuDH2gTqzjYsoNoJdYwsT3vaJuphyi8 k/neC03ZmUq26jOlUJihNsx5r0npb68wdPI+Zc8o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oliver Upton , Fuad Tabba , Marc Zyngier , Sasha Levin Subject: [PATCH 6.1 0245/1059] KVM: arm64: vgic: Stop the target vcpu when disabling LPIs Date: Fri, 4 Dec 2026 18:56:16 +0900 Message-ID: <20261204100650.619864348@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier [ Upstream commit a1b4bd2c2c262b8094c86afb99364d16ac08cb66 ] Disabling LPIs is pretty nasty, as it directly messes with the AP list of the affected CPU, which could be running... This has the potential to lead to really bad behaviours, and we should not be doing that. Take example on the way the Active state is handled and simply pause the the vcpu so that we are sure it is in a quiescent state, and the state be safely manipulated. Nobody has any expectation of performance for this anyway. Fixes: 96085b949672d ("KVM: arm/arm64: vgic-v3: Retire pending interrupts on disabling LPIs") Co-developed-by: Oliver Upton Signed-off-by: Oliver Upton Cc: stable@vger.kernel.org Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Link: https://patch.msgid.link/20261015100539.1011760-7-maz@kernel.org Signed-off-by: Marc Zyngier [ sashal: Replaced per-vCPU pause/resume helpers with kvm_arm_halt_guest() and kvm_arm_resume_guest(), which pause all vCPUs. ] Signed-off-by: Sasha Levin --- arch/arm64/kvm/vgic/vgic-mmio-v3.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c index 33ff9fcfcfb08..1dab5298ae9e7 100644 --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c @@ -276,9 +276,19 @@ static void vgic_mmio_write_v3r_ctlr(struct kvm_vcpu *vcpu, if (ctlr != GICR_CTLR_ENABLE_LPIS) return; + /* + * Yes, disabling LPIs is painful, since it can be done from + * a *remote* vcpu! So let's not take any chance, and make + * sure that the target vCPU has written their LRs back to the + * irq structures, and release any reference they would have. + * + * If it hurts, don't do it. + */ + kvm_arm_halt_guest(vcpu->kvm); vgic_flush_pending_lpis(vcpu); vgic_its_invalidate_cache(vcpu->kvm); atomic_set_release(&vgic_cpu->ctlr, 0); + kvm_arm_resume_guest(vcpu->kvm); } else { ctlr = atomic_cmpxchg_acquire(&vgic_cpu->ctlr, 0, GICR_CTLR_ENABLE_LPIS); -- 2.53.0