From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 3/3] KVM: x86 emulator: Allow PM/VM86 switch during task switch Date: Tue, 31 Jan 2012 12:26:35 +0200 Message-ID: <4F27C1DB.1030906@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> <20120131093746.GJ23536@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Kevin Wolf , kvm@vger.kernel.org, joerg.roedel@amd.com, yoshikawa.takuya@oss.ntt.co.jp, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:26382 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932Ab2AaK0k (ORCPT ); Tue, 31 Jan 2012 05:26:40 -0500 In-Reply-To: <20120131093746.GJ23536@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/31/2012 11:37 AM, Gleb Natapov wrote: > 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. > Perhaps it can, with unrestricted guests, but I think we don't allow those conditions (we trap cr0 writes). -- error compiling committee.c: too many arguments to function