From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752740AbeEOLLS (ORCPT ); Tue, 15 May 2018 07:11:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49144 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752059AbeEOLLQ (ORCPT ); Tue, 15 May 2018 07:11:16 -0400 From: Vitaly Kuznetsov To: Paolo Bonzini Cc: kvm@vger.kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "Michael Kelley \(EOSG\)" , Mohammed Gamal , Cathy Avery , linux-kernel@vger.kernel.org, Jim Mattson Subject: Re: [PATCH RFC v2 3/5] KVM: nVMX: add enlightened VMCS state References: <20180511133751.13414-1-vkuznets@redhat.com> <20180511133751.13414-4-vkuznets@redhat.com> Date: Tue, 15 May 2018 13:11:13 +0200 In-Reply-To: (Paolo Bonzini's message of "Mon, 14 May 2018 18:22:29 +0200") Message-ID: <87zi11jhri.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Paolo Bonzini writes: > On 11/05/2018 15:37, Vitaly Kuznetsov wrote: >> - if (enable_shadow_vmcs) >> - to_vmx(vcpu)->nested.sync_shadow_vmcs = true; >> + >> + if (vmx->nested.hv_evmcs) >> + vmx->nested.sync_enlightened_vmcs = true; >> + else if (enable_shadow_vmcs) >> + vmx->nested.sync_shadow_vmcs = true; >> } > > These four lines are a bit repeated. Perhaps change them to > > if (enable_shadow_vmcs || vmx->nested.hv_evmcs) > vmx->nested.need_vmcs12_sync = true; > > and elsewhere > > if (vmx->nested.need_vmcs12_sync) { > if (vmx->nested.hv_evmcs) { > copy_vmcs12_to_enlightened(vmx); > /* All fields are clean */ > vmx->nested.hv_evmcs->hv_clean_fields |= > HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL; > vmx->nested.sync_enlightened_vmcs = false; > } else { > copy_vmcs12_to_shadow(vmx); > } > vmx->nested.need_vmcs12_sync = false; > } > > ? True, we always know which VMCS we currently use so we can use a single flag. Will do, thanks! -- Vitaly