Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755445AbdCJPAM (ORCPT ); Fri, 10 Mar 2017 10:00:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45898 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893AbdCJPAK (ORCPT ); Fri, 10 Mar 2017 10:00:10 -0500 Subject: Re: [RFC PATCH 0/4] KVM: Emulate UMIP (or almost do so) To: Yu Zhang References: <1468351223-3250-1-git-send-email-pbonzini@redhat.com> <0543af50-8961-38a7-1acc-aaefd4915dda@redhat.com> <58B68E91.4010400@linux.intel.com> <58C25D7A.7070605@linux.intel.com> <46eca436-0d57-a514-39e4-7c45e25e493e@redhat.com> <58C2728B.3060903@linux.intel.com> Cc: qian.ouyang@intel.com, "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" From: Paolo Bonzini Message-ID: Date: Fri, 10 Mar 2017 16:00:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <58C2728B.3060903@linux.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 10 Mar 2017 15:00:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 966 Lines: 25 On 10/03/2017 10:31, Yu Zhang wrote: >> We can also add a module parameter to force emulation, so that it will >> be possible to test UMIP emulation on newer processors too. > > Thanks for your reply, Paolo. :-) > > Well, my previous understanding is that there might be a situation on a > machine with UMIP > feature: > 1> when an APP in VM runs instructions such as sgdt addrA, > 2> and the addrA may cause anVM exit(e.g. ept violation), > 3> next, the emulator in hypervisor need to inject a GP fault to the VM. > Is this situation possible? No, the guest will execute the instruction again after the vmexit. > But as to the scenario you described, I do not quit understand. > I mean, on a host which do not support UMIP, although hypervisor may > intercept cpuid and > provide an emulated cr4 to guest, how does it guarantee those > instructions in VM will cause a VM exit? All instructions except SMSW can be trapped using descriptor table vmexits. Paolo