Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3653556pxb; Mon, 24 Jan 2022 14:31:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0ceGqq92bPESJ/G9KbZb/iO++6goY8v8wD476uxC1e0Cv//tIPwz/4UsfYR1XCdcK5dam X-Received: by 2002:a65:460d:: with SMTP id v13mr13221995pgq.373.1643063486223; Mon, 24 Jan 2022 14:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063486; cv=none; d=google.com; s=arc-20160816; b=uAMRJpjOofGMpg9rGRXkZtPaccyLLRpfmV840Lf6/MrFQQJZtv31PRKRUBfADKLP3q eQ25j4hP1YMsC28A9zd8L2kWmJrbFu7zDSmf+iQx2UfrWx+2DAg0ygZnSWQJtp0jtBbV 4zgjgyVD50jFAm37ugF/2sM8fqgcOGkIGeXPRSdAGW5hfmrKoIfLdcnuXMqZHl4GPWYp TnrBJ33/8xN6SvB5bX22TUN+vVul8UlP7DKsZ7wBFGKED+3sJDn9jzHlu4qNh/rVk7IV 06TG8JOhnJS6KRwF1PNk8h9VBPibc/A++YShQIWAHw0rtbSf1aoRWRnQvNhIwNRLjLwx VAPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xOy4cYe6MBCT9+OAdyUA15iFppqGS0RINCcHIWXqYrI=; b=uomXN2xdUNYlvWYQFF2tAuwafEVIMKcZnPstPnAWycFbXgdZ/kqfodkqXkqMU6G+/s so84UuanOs4vMwFMpHorYka0lBbUQ3Fj5s6vCy0WMLLIbFcnRiAKxdhCuhQwaiPGgjle 7F8B9b/mnLwRjcW8LrrC8Dug0s+at4jncynwNcyu589JQWMkQAnH4wm+9AzgyaBneMj1 j3wyBy9mraBcq+wAGZAOlgN241lfn7lVS96EbZQRYPv9z1BP+tpEc61UFZJ7FUSIvw5H M6g1OKScvvIp0ICvnM1Rr4b01c1AHoENyBxtmQZdYpEf+kUTbZIFbIDOcUlmNNcaMOEH N2ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RrXxvxxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a64si9366148pge.782.2022.01.24.14.31.14; Mon, 24 Jan 2022 14:31:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RrXxvxxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1586983AbiAXW1f (ORCPT + 99 others); Mon, 24 Jan 2022 17:27:35 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:51250 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1454382AbiAXVc2 (ORCPT ); Mon, 24 Jan 2022 16:32:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E11BA6131F; Mon, 24 Jan 2022 21:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5CBC340E4; Mon, 24 Jan 2022 21:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059947; bh=+IC5SxFlPCTwimrhYxrbf0C6EBpcKCzs3MZ8Q9Z5Lf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrXxvxxMikzF1qW3RXVQ15uB1IAMV+NxeXxnAnNUy1HjKqhIIpZ7hCaTu2O6UG6Ou p0ePgVNW59F3mApqOTOqHMBv25fFkx6tcUAXe/KAnnhHimteVjSZdmspBA0SV5jXUr Mf5graGyfCmYJjNSrGfwJMp8jURmj7uQcXbGufvU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 0788/1039] KVM: VMX: Dont unblock vCPU w/ Posted IRQ if IRQs are disabled in guest Date: Mon, 24 Jan 2022 19:42:57 +0100 Message-Id: <20220124184151.781814654@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Bonzini [ Upstream commit 1831fa44df743a7cdffdf1c12c799bf6f3c12b8c ] Don't configure the wakeup handler when a vCPU is blocking with IRQs disabled, in which case any IRQ, posted or otherwise, should not be recognized and thus should not wake the vCPU. Fixes: bf9f6ac8d749 ("KVM: Update Posted-Interrupts Descriptor when vCPU is blocked") Signed-off-by: Sean Christopherson Message-Id: <20211009021236.4122790-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/vmx/posted_intr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c index 21ea58d25771f..696ad48ab5daa 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -147,7 +147,8 @@ int pi_pre_block(struct kvm_vcpu *vcpu) struct pi_desc old, new; struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu); - if (!vmx_can_use_vtd_pi(vcpu->kvm)) + if (!vmx_can_use_vtd_pi(vcpu->kvm) || + vmx_interrupt_blocked(vcpu)) return 0; WARN_ON(irqs_disabled()); -- 2.34.1