Message ID | 20220207155447.840194-9-mlevitsk@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FFE4C35275 for <kvm@archiver.kernel.org>; Mon, 7 Feb 2022 16:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442211AbiBGQEc (ORCPT <rfc822;kvm@archiver.kernel.org>); Mon, 7 Feb 2022 11:04:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385593AbiBGP4T (ORCPT <rfc822;kvm@vger.kernel.org>); Mon, 7 Feb 2022 10:56:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 85F5FC0401CE for <kvm@vger.kernel.org>; Mon, 7 Feb 2022 07:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644249377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hIkOyOBrYC66as9Hh5WBjO5DbzrEJzCI4Y98UxmVlRg=; b=Eil31yxaf80Lu+0BSGUgbnuKsQ0iEMZmts58qlRwAMtDk2zJfcfyYfwZablXSDcEXwOVzN IrMt9NENTiKc6LmsUmrdGxI5kQkPzRMOTsH6Qu3658vCafhfphqjkrMVdSGeOBmG90uO3d aYlqP/vuT+MLS22QwCRXNWcnPlIMCWo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-oRBj8DFEPRSHtMKGb7doUw-1; Mon, 07 Feb 2022 10:56:14 -0500 X-MC-Unique: oRBj8DFEPRSHtMKGb7doUw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 22080100C662; Mon, 7 Feb 2022 15:56:11 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C77482765; Mon, 7 Feb 2022 15:56:00 +0000 (UTC) From: Maxim Levitsky <mlevitsk@redhat.com> To: kvm@vger.kernel.org Cc: Tony Luck <tony.luck@intel.com>, "Chang S. Bae" <chang.seok.bae@intel.com>, Thomas Gleixner <tglx@linutronix.de>, Wanpeng Li <wanpengli@tencent.com>, Ingo Molnar <mingo@redhat.com>, Vitaly Kuznetsov <vkuznets@redhat.com>, Pawan Gupta <pawan.kumar.gupta@linux.intel.com>, Dave Hansen <dave.hansen@linux.intel.com>, Paolo Bonzini <pbonzini@redhat.com>, linux-kernel@vger.kernel.org, Rodrigo Vivi <rodrigo.vivi@intel.com>, "H. Peter Anvin" <hpa@zytor.com>, intel-gvt-dev@lists.freedesktop.org, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Joerg Roedel <joro@8bytes.org>, Sean Christopherson <seanjc@google.com>, David Airlie <airlied@linux.ie>, Zhi Wang <zhi.a.wang@intel.com>, Brijesh Singh <brijesh.singh@amd.com>, Jim Mattson <jmattson@google.com>, x86@kernel.org, Daniel Vetter <daniel@ffwll.ch>, Borislav Petkov <bp@alien8.de>, Zhenyu Wang <zhenyuw@linux.intel.com>, Kan Liang <kan.liang@linux.intel.com>, Jani Nikula <jani.nikula@linux.intel.com>, Maxim Levitsky <mlevitsk@redhat.com> Subject: [PATCH RESEND 08/30] KVM: x86: lapic: don't touch irr_pending in kvm_apic_update_apicv when inhibiting it Date: Mon, 7 Feb 2022 17:54:25 +0200 Message-Id: <20220207155447.840194-9-mlevitsk@redhat.com> In-Reply-To: <20220207155447.840194-1-mlevitsk@redhat.com> References: <20220207155447.840194-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org |
Series |
My patch queue
|
expand
|
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0da7d0960fcb5..dd4e2888c244b 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2307,7 +2307,12 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) apic->irr_pending = true; apic->isr_count = 1; } else { - apic->irr_pending = (apic_search_irr(apic) != -1); + /* + * Don't clear irr_pending, searching the IRR can race with + * updates from the CPU as APICv is still active from hardware's + * perspective. The flag will be cleared as appropriate when + * KVM injects the interrupt. + */ apic->isr_count = count_vectors(apic->regs + APIC_ISR); } }
kvm_apic_update_apicv is called when AVIC is still active, thus IRR bits can be set by the CPU after it is called, and don't cause the irr_pending to be set to true. Also logic in avic_kick_target_vcpu doesn't expect a race with this function so to make it simple, just keep irr_pending set to true and let the next interrupt injection to the guest clear it. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> --- arch/x86/kvm/lapic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)