Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756404AbcK2IBZ (ORCPT ); Tue, 29 Nov 2016 03:01:25 -0500 Received: from mx5-phx2.redhat.com ([209.132.183.37]:48055 "EHLO mx5-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755335AbcK2IBS (ORCPT ); Tue, 29 Nov 2016 03:01:18 -0500 Date: Tue, 29 Nov 2016 03:01:15 -0500 (EST) From: Paolo Bonzini To: David Matlack Cc: kvm list , linux-kernel@vger.kernel.org, Jim Mattson , Radim =?utf-8?B?S3LEjW3DocWZ?= Message-ID: <1141665457.516897.1480406475749.JavaMail.zimbra@redhat.com> In-Reply-To: References: <1479863680-117511-1-git-send-email-dmatlack@google.com> <1479863680-117511-2-git-send-email-dmatlack@google.com> Subject: Re: [PATCH 1/4] KVM: nVMX: support restore of VMX capability MSRs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.4.164.1, 10.5.101.130] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF50 (Linux)/8.0.6_GA_5922) Thread-Topic: nVMX: support restore of VMX capability MSRs Thread-Index: WF683/0FznECal59q/Sk5EUJfoyTfg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1584 Lines: 37 > On Mon, Nov 28, 2016 at 2:48 PM, Paolo Bonzini wrote: > > On 28/11/2016 22:11, David Matlack wrote: > >> > PINBASED_CTLS, PROCBASED_CTLS, EXIT_CTLS and ENTRY_CTLS can be derived > >> > from their "true" counterparts, so I think it's better to remove the > >> > "non-true" ones from struct nested_vmx (and/or add the "true" ones when > >> > missing) and make them entirely computed. But it can be done on top. > >> > >> Good point. And that would mean userspace does not need to restore the > >> non-true MSRs, right? > > > > Yes, sorry for being a bit too concise. :) > > I'll include this cleanup in the next version of the patchset since it > affects which MSRs userspace will restore. It looks like a pretty > simple patch. Don't bother removing the "non-true" registers from nested_vmx; you only need to adjust the userspace API. > > > >> KVM does not emulate MSR_IA32_VMX_BASIC[55]=0, > >> and will probably never want to. > > > > That's a separate question, MSR_IA32_VMX_BASIC[55]=0 basically means > > that the "true" capabilities are the same as the "default" capabilities. > > If userspace wanted to set it that way, KVM right now would not hide > > the "true" capability MSR, but on the other hand the nested hypervisor > > should not even notice the difference. > > KVM would also need to use the non-true MSR in place of the true MSRs > when checking VMCS12 during VM-entry. It's not necessary, userspace would set the relevant bits to 1 in the true MSRs, for both the low and high parts. If it doesn't, it's garbage in garbage out. Paolo