Message ID | 20221129193717.513824-2-mlevitsk@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp537277wrr; Tue, 29 Nov 2022 11:53:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PhdAw0hPRFWPYYq6aePk2tgGrCNR1t8ZcuiTGFF2kM7KCgLRo7HePpBXYtIqfEvJx/sJa X-Received: by 2002:a05:6402:f10:b0:467:9976:2e37 with SMTP id i16-20020a0564020f1000b0046799762e37mr53896069eda.267.1669751605666; Tue, 29 Nov 2022 11:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669751605; cv=none; d=google.com; s=arc-20160816; b=yTEomU81AsfnLC7ZwVZJ3Zj2NYNbkGolFKMB11ruoF8QL+PN2s32V+S4sloTBDIwXI NQfItryV35627B9PuGDoeL+/XbJkgwbhLBOipVjWb8FkhD7EEDjVCx6g7Sr7hBWsRa2T HMcE5baTf6V8QZOAd335+E2W5gxDmtWg8kOmWHjsSR13AnCPrXVotQYwwNPig0HCYnHq UkR+ib39ywyu5NtLBYQHKXjdwbZCevO9arqt/2GJbAv7RCednEO2lE6j9p/WH+6kNovp wU50/FZWNRoVl+ZPgJUfe42ip8Cp1K1JczwIaTmP0/hxsJ13cdcxuzkObHrVGoL6i3YN w7iA== 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=nYEa1XgfnHAIZ7cB2VYzoZKokkGbb+MsQs52pSYGTFU=; b=tXrnaeXiYwSfz28QREZIQLOHxoAzUe6xOS9hV1jFR1N/UXNrNS7nst8HL4AW+USQ89 nxGajEV24cf1thu0orCo3NPYBgvF9QmMAJCdELh2E4/fusclLxtpiDZKJ46/18ABbl6X LCvFjU5IFzLOyec1+9Mb3fzgPSZEEB6MU+V6k21Gc2ZB3GorMT5xxx6zC7cgPd64lwFc C8IlySqhxGl9yBBJIpGGUToEvy7UXOwOGa11WKzrXshF0ROTcQlcirMrJdBwAJjAznOd SkF2ANcOvqZR55rSyjUWk2NRIP+qWBVqrVHwKEr6FOGArSOLT5YFx6nZHd8nPeqLPDPS uSOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PuXo4pnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020aa7c251000000b0046b1c26d81dsi1954448edo.80.2022.11.29.11.53.01; Tue, 29 Nov 2022 11:53:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PuXo4pnE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236935AbiK2ToD (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 14:44:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237147AbiK2Tno (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 14:43:44 -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 ESMTPS id 99FB973435 for <linux-kernel@vger.kernel.org>; Tue, 29 Nov 2022 11:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669750766; 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=nYEa1XgfnHAIZ7cB2VYzoZKokkGbb+MsQs52pSYGTFU=; b=PuXo4pnEP8SmXEMXTV19etOg8unyDUUMZsSVIxOIb4pS4h1GpKHoPOGM/H3+nIGSwS+5Ik HXZEXhq9RXXNCrw9SVmYXe1iO/X68RK3b7tZG8t0NDrzqCtf5hzHFUFddJdZ0eJz+P3D4B fiNWWICQ+wffSOk8g+9IfNNgLYG/a9I= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-i3rAk3gQPo6OLUDKYDUTwg-1; Tue, 29 Nov 2022 14:37:28 -0500 X-MC-Unique: i3rAk3gQPo6OLUDKYDUTwg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E71D8857F90; Tue, 29 Nov 2022 19:37:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.35.206.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAC9C2027064; Tue, 29 Nov 2022 19:37:22 +0000 (UTC) From: Maxim Levitsky <mlevitsk@redhat.com> To: kvm@vger.kernel.org Cc: Sandipan Das <sandipan.das@amd.com>, Paolo Bonzini <pbonzini@redhat.com>, Jim Mattson <jmattson@google.com>, Peter Zijlstra <peterz@infradead.org>, Dave Hansen <dave.hansen@linux.intel.com>, Borislav Petkov <bp@alien8.de>, Pawan Gupta <pawan.kumar.gupta@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Josh Poimboeuf <jpoimboe@kernel.org>, Daniel Sneddon <daniel.sneddon@linux.intel.com>, Jiaxi Chen <jiaxi.chen@linux.intel.com>, Babu Moger <babu.moger@amd.com>, linux-kernel@vger.kernel.org, Jing Liu <jing2.liu@intel.com>, Wyes Karny <wyes.karny@amd.com>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>, Sean Christopherson <seanjc@google.com>, Maxim Levitsky <mlevitsk@redhat.com> Subject: [PATCH v2 01/11] KVM: nSVM: don't sync back tlb_ctl on nested VM exit Date: Tue, 29 Nov 2022 21:37:07 +0200 Message-Id: <20221129193717.513824-2-mlevitsk@redhat.com> In-Reply-To: <20221129193717.513824-1-mlevitsk@redhat.com> References: <20221129193717.513824-1-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 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_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750861459682585438?= X-GMAIL-MSGID: =?utf-8?q?1750861459682585438?= |
Series |
SVM: vNMI (with my fixes)
|
|
Commit Message
Maxim Levitsky
Nov. 29, 2022, 7:37 p.m. UTC
The CPU doesn't change TLB_CTL value as stated in the PRM (15.16.2):
"The VMRUN instruction reads, but does not change, the
value of the TLB_CONTROL field"
Therefore the KVM shouldn't do that either.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
---
arch/x86/kvm/svm/nested.c | 1 -
1 file changed, 1 deletion(-)
Comments
Hi Maxim, On 11/30/2022 1:07 AM, Maxim Levitsky wrote: > The CPU doesn't change TLB_CTL value as stated in the PRM (15.16.2): > nits: s / PRM (15.16.2) / APM (15.16.1 - TLB Flush) > "The VMRUN instruction reads, but does not change, the > value of the TLB_CONTROL field" > > Therefore the KVM shouldn't do that either. > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > --- > arch/x86/kvm/svm/nested.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c > index bc9cd7086fa972..37af0338da7c32 100644 > --- a/arch/x86/kvm/svm/nested.c > +++ b/arch/x86/kvm/svm/nested.c > @@ -1010,7 +1010,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm) > vmcb12->control.next_rip = vmcb02->control.next_rip; > > vmcb12->control.int_ctl = svm->nested.ctl.int_ctl; > - vmcb12->control.tlb_ctl = svm->nested.ctl.tlb_ctl; > vmcb12->control.event_inj = svm->nested.ctl.event_inj; > vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err; >
On Mon, 2022-12-05 at 19:35 +0530, Santosh Shukla wrote: > Hi Maxim, > > On 11/30/2022 1:07 AM, Maxim Levitsky wrote: > > The CPU doesn't change TLB_CTL value as stated in the PRM (15.16.2): > > > nits: > s / PRM (15.16.2) / APM (15.16.1 - TLB Flush) True for both changes, thanks! Best regards, Maxim Levitsky > > > "The VMRUN instruction reads, but does not change, the > > value of the TLB_CONTROL field" > > > > Therefore the KVM shouldn't do that either. > > > > Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> > > --- > > arch/x86/kvm/svm/nested.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c > > index bc9cd7086fa972..37af0338da7c32 100644 > > --- a/arch/x86/kvm/svm/nested.c > > +++ b/arch/x86/kvm/svm/nested.c > > @@ -1010,7 +1010,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm) > > vmcb12->control.next_rip = vmcb02->control.next_rip; > > > > vmcb12->control.int_ctl = svm->nested.ctl.int_ctl; > > - vmcb12->control.tlb_ctl = svm->nested.ctl.tlb_ctl; > > vmcb12->control.event_inj = svm->nested.ctl.event_inj; > > vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err; > >
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index bc9cd7086fa972..37af0338da7c32 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1010,7 +1010,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm) vmcb12->control.next_rip = vmcb02->control.next_rip; vmcb12->control.int_ctl = svm->nested.ctl.int_ctl; - vmcb12->control.tlb_ctl = svm->nested.ctl.tlb_ctl; vmcb12->control.event_inj = svm->nested.ctl.event_inj; vmcb12->control.event_inj_err = svm->nested.ctl.event_inj_err;