Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp730707pxb; Mon, 25 Oct 2021 17:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWbGmbHJWoJ2poKEr+rygDypAyvHmVohaJiAByq6/sf+uukja3E3/Yd1Znaeoq011CG8l6 X-Received: by 2002:a05:6402:40d2:: with SMTP id z18mr31080931edb.362.1635208792067; Mon, 25 Oct 2021 17:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635208792; cv=none; d=google.com; s=arc-20160816; b=s9m7nclrBiztKvrWf1pkUr4m6nwSJ6AuyhbWfaARRjYq6yM9zLlcppJm4nDCxDigjl XB8ca1jjnHyUSjLkUrSHHM0YB6OvtNxoSOoV2a53Bpg7VnAqF/S5Uz4zbFaoNJMKee5N 9hvvO/uvL0FyMkdxSgh5pcNgUKRTde6o6SPAth5AW85vhCqVXc95EsjVVyn/NcfH2B88 aa4XFJOqHqNHmfbQskcrm/5aVUFFmmkcvrh5xrRVsFPw85GGQUvk/oWDQVfdTTFxaKrq fXI5FP5nw5DThPhrGqo5LSKhtbPCbfl1j9QgH8VaUOJ6m9US+DCFTa9yV6PAE/ehrUc/ gucg== 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=K+kw6WKaaEth1LX7s1laX2QtGorVO0UQtgrY5tvh9tk=; b=RVxoQhGoBPeQe9oFDvD7xQg9wrB/DX7FWaKguiZ3b+kmwiLaep6Qu+RK3QnbggHINM OG/0Prq7IEFsL8vqNofFG00joFYt9rAJl6stKifpbqIC/9E6pErc2uA7YHkfx4ZzRBAe KJx9pFc3yzjhd/iBZY/h2pAhI6nQNuAJzxt1xQ9PqLV3CX2aKyZCi68hcojag0LEVo8K 38M8Ww161J/w4TJFrxnUe3LVdjQ79ZGfYaKPWVRnecYwQ4sujtmAxJwWkWAQtsalIlM7 ilG441MpHBxhIUupWXEYY4uGTjipPTvSgStQaZlIb81y1FeRHpgFxxvmDZb4Cr6jKzFg cS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kHwEjkor; 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 qk38si5117159ejc.373.2021.10.25.17.39.28; Mon, 25 Oct 2021 17:39:52 -0700 (PDT) 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=kHwEjkor; 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 S238255AbhJYT4g (ORCPT + 99 others); Mon, 25 Oct 2021 15:56:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:42028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237482AbhJYTvu (ORCPT ); Mon, 25 Oct 2021 15:51:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 38E32610EA; Mon, 25 Oct 2021 19:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635191009; bh=AAldmsiWCqqFUv2h8uCBzl82QKDdXhkS8goM7I32Zp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kHwEjkorJPeDzPw0OUmbkMiKxy5zjZ/zBxbvTuPjJip+NH1HOkzRCTr9O9Lc2IuCW +XP5nkZeJ0OJfaS1MMAU+S3ntUQ3TUw89sTMsVPzwsOz/OA2gvl3laKdZk3NSJIwBY ff+Wqd45KxD+rV3nZyXzAf2nOtSWyxHQ/IruLXHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.14 104/169] KVM: nVMX: promptly process interrupts delivered while in guest mode Date: Mon, 25 Oct 2021 21:14:45 +0200 Message-Id: <20211025191031.225878686@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025191017.756020307@linuxfoundation.org> References: <20211025191017.756020307@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 commit 3a25dfa67fe40f3a2690af2c562e0947a78bd6a0 upstream. Since commit c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with more precise fix") there is no longer the certainty that check_nested_events() tries to inject an external interrupt vmexit to L1 on every call to vcpu_enter_guest. Therefore, even in that case we need to set KVM_REQ_EVENT. This ensures that inject_pending_event() is called, and from there kvm_check_nested_events(). Fixes: c300ab9f08df ("KVM: x86: Replace late check_nested_events() hack with more precise fix") Cc: stable@vger.kernel.org Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx/vmx.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -6288,18 +6288,13 @@ static int vmx_sync_pir_to_irr(struct kv /* * If we are running L2 and L1 has a new pending interrupt - * which can be injected, we should re-evaluate - * what should be done with this new L1 interrupt. - * If L1 intercepts external-interrupts, we should - * exit from L2 to L1. Otherwise, interrupt should be - * delivered directly to L2. + * which can be injected, this may cause a vmexit or it may + * be injected into L2. Either way, this interrupt will be + * processed via KVM_REQ_EVENT, not RVI, because we do not use + * virtual interrupt delivery to inject L1 interrupts into L2. */ - if (is_guest_mode(vcpu) && max_irr_updated) { - if (nested_exit_on_intr(vcpu)) - kvm_vcpu_exiting_guest_mode(vcpu); - else - kvm_make_request(KVM_REQ_EVENT, vcpu); - } + if (is_guest_mode(vcpu) && max_irr_updated) + kvm_make_request(KVM_REQ_EVENT, vcpu); } else { max_irr = kvm_lapic_find_highest_irr(vcpu); }