From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v2 3/3] KVM: x86 emulator: Allow PM/VM86 switch during task switch Date: Tue, 31 Jan 2012 11:37:46 +0200 Message-ID: <20120131093746.GJ23536@redhat.com> References: <1327692216-20450-1-git-send-email-kwolf@redhat.com> <1327692216-20450-4-git-send-email-kwolf@redhat.com> <4F266FCB.3000102@redhat.com> <4F267981.20100@redhat.com> <4F2699CE.4000506@redhat.com> <4F26A2AF.8080108@redhat.com> <4F26A9EB.3000804@redhat.com> <4F26B68E.3030100@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org, joerg.roedel@amd.com, yoshikawa.takuya@oss.ntt.co.jp, mtosatti@redhat.com To: Kevin Wolf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34163 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196Ab2AaJhu (ORCPT ); Tue, 31 Jan 2012 04:37:50 -0500 Content-Disposition: inline In-Reply-To: <4F26B68E.3030100@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jan 30, 2012 at 04:26:06PM +0100, Kevin Wolf wrote: > >> Would that be enough or would we have to avoid clearing it in all other > >> places as well? Where would it be initialised if it's not enough? > > > > Maybe vmx_vcpu_reset(). > > Do all CPL changes go through set_cr0/segment/rflags/cpl? I guess yes, > so initialising on reset and keeping it valid all the time should be > possible indeed. > CPL can be changed while guest is running. SVM saves it for us in cpl field. VMX does not, so we either will have to update cpl on each exit (cpl = cs & 3) or somehow mark it not up-to-date and recalculate on access. Can VMX exit while cpl != cs & 3 or can this happen only during emulation? If it can we cannot know real cpl after exit. -- Gleb.