Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751495AbdL0Jy3 (ORCPT ); Wed, 27 Dec 2017 04:54:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47790 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbdL0Jy1 (ORCPT ); Wed, 27 Dec 2017 04:54:27 -0500 Subject: Re: [PATCH 4/4] KVM: nVMX: initialize more non-shadowed fields in prepare_vmcs02_full To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm References: <1513860222-40944-1-git-send-email-pbonzini@redhat.com> <1513860222-40944-5-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: <66175f1a-ba57-f08b-5ba7-e4fe42f14f7a@redhat.com> Date: Wed, 27 Dec 2017 10:54:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 27 Dec 2017 09:54:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 990 Lines: 23 On 25/12/2017 04:09, Wanpeng Li wrote: > 2017-12-21 20:43 GMT+08:00 Paolo Bonzini : >> These fields are also simple copies of the data in the vmcs12 struct. >> For some of them, prepare_vmcs02 was skipping the copy when the field >> was unused. In prepare_vmcs02_full, we copy them always as long as the >> field exists on the host, because the corresponding execution control >> might be one of the shadowed fields. > > Why we don't need to copy them always before the patchset? Before these patches, we only copy them if the corresponding processor control is enabled. For example, we only copy the EOI exit bitmap if APICv is enabled by L1. Here we could have write to EOI exit bitmap vmlaunch (calls prepare_vmcs02_full) enable APICv (but EOI exit bitmap fields are clean) vmresume (doesn't call prepare_vmcs02_full) The vmresume doesn't call prepare_vmcs02_full, so the EOI exit bitmap must be copied every time prepare_vmcs02_full runs. Paolo