Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751115AbdHWVr1 (ORCPT ); Wed, 23 Aug 2017 17:47:27 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36611 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbdHWVr0 (ORCPT ); Wed, 23 Aug 2017 17:47:26 -0400 Subject: Re: [PATCH 1/4] KVM: nVMX: move vmentry tasks from prepare_vmcs12 to enter_vmx_non_root_mode To: Jim Mattson Cc: LKML , kvm list , Wanpeng Li , David Hildenbrand , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= References: <1503521038-21073-1-git-send-email-pbonzini@redhat.com> <1503521038-21073-2-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: <60b2524d-485c-990f-0665-2b15e6ffabf6@redhat.com> Date: Wed, 23 Aug 2017 23:47:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 946 Lines: 22 On 23/08/2017 23:25, Jim Mattson wrote: >> + if (from_vmentry) { >> + vmcs12->launch_state = 1; > Because we defer most guest state validity checks to the hardware > vmlaunch of the vmcs02, it is too early to set the vmcs12 launched > state here. If the exit reason has the high bit set, > vmcs12->launch_state should not be modified. Thanks---I'll do my homework and add a testcase then. :) The launched state cannot be discovered with VMREAD, but I can test that a VMLAUNCH;VMLAUNCH works and a VMLAUNCH;VMRESUME fails. The same applies for the next instruction, which is part of step 6 of the vmentry ("An event may be injected in the guest context"). This one can be tested with VMREAD. Paolo >> + >> + /* vm_entry_intr_info_field is cleared on exit. Emulate this >> + * instead of reading the real value. */ >> + vmcs12->vm_entry_intr_info_field &= ~INTR_INFO_VALID_MASK;