Message ID | 20230928150428.199929-4-mlevitsk@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3389577vqu; Thu, 28 Sep 2023 08:18:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdnvXS9+sa1ee8svQzBEmYAOdFqon4EONzn82OvJADxqAGm8Nw05ZswCXllmSGrgnQTi6p X-Received: by 2002:a17:90a:b396:b0:277:422d:3a0f with SMTP id e22-20020a17090ab39600b00277422d3a0fmr2603712pjr.17.1695914320252; Thu, 28 Sep 2023 08:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695914320; cv=none; d=google.com; s=arc-20160816; b=B04mTW0WAn6ISBQuT4Bvpn42rnWMLKsPP9Lk5xrrSU7aC0M0RsOnZQ9xAB2vyPasl2 fAF4QBclFZMD4UEnB5S6WBN5meoxcvKPn27YMMUjIqH2YDfoB9mLK3gVpXkpCZXso/nz WGWY1aK86TWzWcQ2/+FHLdx1VfZa5RwB+S+1W2bGbTROD76RPCEYQOymVxa2V1ERh3FP ViXKT65L2MQdvO5z8VIdLAv76nY+N1wTID72/kcA/3mrDUcaYJDX/LsABAV1oo+zTmUU 3wLcjElnkuejLepXn36X4dekqVrN30qWLKmMeNenggZc/rs4K7LLFA8xTDYX3cb0zow1 kwmw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+K85/eS/kylNQpLV/CXk6IqQwJPNNCcpLU6igIUXkXY=; fh=k8YxIaPvIPXsZjGxhmoFEFw2FthFvsrwXSIogQNrxiI=; b=x1UpEAq5VEsqO1FdhiYTQAUvl4n7djSLb+YDVL3+gDC9EsF9KLT12HzbsBuo89E6/o RFeruxutnm/Hg7Gbm5BhGle3Vj7lKiypu2g29zq4DJe1qEIvY7VKC618PedGg9slTZP5 iVnt8rknXBl9cBY3w9qIOZkhXa7SKwUxHyxsIwSyB/0jedYMr7yWgIw3L2Z17nzSqe38 0fHyYdGj6xE7/UU6C2gIhZYYs7BSj9mLkeynBh0MhWOvEZPq/FifcYEU3Kcuuzje2Bn0 VBn2PsppV8k/8miS/g2eorMM2btunz/VwVIk+6ofS2AJxjifrFR15m/EmbYGdsYjal5v rcwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXGNyiGk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id gl21-20020a17090b121500b00273ec8dfff8si1176012pjb.80.2023.09.28.08.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 08:18:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXGNyiGk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E4BCF831DBE5; Thu, 28 Sep 2023 08:05:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbjI1PFo (ORCPT <rfc822;pwkd43@gmail.com> + 21 others); Thu, 28 Sep 2023 11:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbjI1PFj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 11:05:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32D8195 for <linux-kernel@vger.kernel.org>; Thu, 28 Sep 2023 08:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695913489; 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=+K85/eS/kylNQpLV/CXk6IqQwJPNNCcpLU6igIUXkXY=; b=YXGNyiGkb0F/lL+tGSYsZHXrvXxE56muEtGNcWIv5r7pCi2qkZj4gHB/b+QSAhpMdzYDBS NuOke5n6Oz1r/qHQ38wFfuOIMAyU+ucG0de/B+qvA5C1yunqE65jEHfTKXBvpZHGT2kCi1 Ay4R9aW8Xe4GDHrctugCq2oTbQuEh9M= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-DDx6aR3LPmeCIbUCa9SEdA-1; Thu, 28 Sep 2023 11:04:45 -0400 X-MC-Unique: DDx6aR3LPmeCIbUCa9SEdA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8DBD3C1ACEE; Thu, 28 Sep 2023 15:04:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.45.226.141]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E86A40C6E76; Thu, 28 Sep 2023 15:04:41 +0000 (UTC) From: Maxim Levitsky <mlevitsk@redhat.com> To: kvm@vger.kernel.org Cc: Will Deacon <will@kernel.org>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>, Thomas Gleixner <tglx@linutronix.de>, Paolo Bonzini <pbonzini@redhat.com>, x86@kernel.org, Robin Murphy <robin.murphy@arm.com>, iommu@lists.linux.dev, Ingo Molnar <mingo@redhat.com>, Joerg Roedel <joro@8bytes.org>, Sean Christopherson <seanjc@google.com>, "H. Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org, Maxim Levitsky <mlevitsk@redhat.com>, stable@vger.kernel.org Subject: [PATCH 3/5] x86: KVM: SVM: refresh AVIC inhibition in svm_leave_nested() Date: Thu, 28 Sep 2023 18:04:26 +0300 Message-Id: <20230928150428.199929-4-mlevitsk@redhat.com> In-Reply-To: <20230928150428.199929-1-mlevitsk@redhat.com> References: <20230928150428.199929-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 28 Sep 2023 08:05:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778295054402896919 X-GMAIL-MSGID: 1778295054402896919 |
Series |
AVIC bugfixes and workarounds
|
|
Commit Message
Maxim Levitsky
Sept. 28, 2023, 3:04 p.m. UTC
svm_leave_nested() similar to a nested VM exit, get the vCPU out of nested
mode and thus should end the local inhibition of AVIC on this vCPU.
Failure to do so, can lead to hangs on guest reboot.
Raise the KVM_REQ_APICV_UPDATE request to refresh the AVIC state of the
current vCPU in this case.
Cc: stable@vger.kernel.org
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
arch/x86/kvm/svm/nested.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Thu, Sep 28, 2023, Maxim Levitsky wrote: > svm_leave_nested() similar to a nested VM exit, get the vCPU out of nested > mode and thus should end the local inhibition of AVIC on this vCPU. > > Failure to do so, can lead to hangs on guest reboot. > > Raise the KVM_REQ_APICV_UPDATE request to refresh the AVIC state of the > current vCPU in this case. > > Cc: stable@vger.kernel.org Unnecessary newline. Fixes: f44509f849fe ("KVM: x86: SVM: allow AVIC to co-exist with a nested guest running") > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > --- > arch/x86/kvm/svm/nested.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c > index dd496c9e5f91f28..3fea8c47679e689 100644 > --- a/arch/x86/kvm/svm/nested.c > +++ b/arch/x86/kvm/svm/nested.c > @@ -1253,6 +1253,9 @@ void svm_leave_nested(struct kvm_vcpu *vcpu) > > nested_svm_uninit_mmu_context(vcpu); > vmcb_mark_all_dirty(svm->vmcb); > + > + if (kvm_apicv_activated(vcpu->kvm)) > + kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu); > } > > kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); > -- > 2.26.3 >
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index dd496c9e5f91f28..3fea8c47679e689 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1253,6 +1253,9 @@ void svm_leave_nested(struct kvm_vcpu *vcpu) nested_svm_uninit_mmu_context(vcpu); vmcb_mark_all_dirty(svm->vmcb); + + if (kvm_apicv_activated(vcpu->kvm)) + kvm_make_request(KVM_REQ_APICV_UPDATE, vcpu); } kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);