From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] gfxboot VMX workaround v2 Date: Fri, 18 Apr 2008 10:25:15 -0500 Message-ID: <4808BD5B.3040103@codemonkey.ws> References: <47FA1DD5.3050500@suse.de> <47FA4632.9040403@codemonkey.ws> <20080415110755.183ba530@frecb000711.frec.bull.fr> <4804A863.4040300@qumranet.com> <20080418141816.29e745f0@frecb000711.frec.bull.fr> <4808A0BB.20500@codemonkey.ws> <20080418160528.457c274f@frecb000711.frec.bull.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Avi Kivity To: Guillaume Thouvenin Return-path: In-Reply-To: <20080418160528.457c274f@frecb000711.frec.bull.fr> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Guillaume Thouvenin wrote: > On Fri, 18 Apr 2008 08:23:07 -0500 > Anthony Liguori wrote: > > > >> This doesn't seem right. You should have been able to break out of the >> emulator long before encountering an out instruction. The next >> instruction you encounter should be a mov instruction. Are you sure >> you're updating eip correctly? >> > > I think that eip is updated correctly but you're right, I think that > the condition to stop emulation is not well implemented. I emulate a > lot of mov instructions and I remain blocked in the emulation loop > until I reach the "out" instruction. The loop is the following: > > [...] > cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; > ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; > > while (cs_rpl != ss_rpl) { > if (emulate_instruction(vcpu, NULL, 0,0, 0) == EMULATE_FAIL) { > printk(KERN_INFO "%s: emulation of 0x%x failed\n", > __FUNCTION__, > vcpu->arch.emulate_ctxt.decode.b); > return -1; > } > cs_rpl = vmcs_read16(GUEST_CS_SELECTOR) & SELECTOR_RPL_MASK; > ss_rpl = vmcs_read16(GUEST_SS_SELECTOR) & SELECTOR_RPL_MASK; > } > printk(KERN_INFO "%s: VMX friendly state recovered\n", __FUNCTION__); > // I never reach this point > > Maybe CS and SS selector are not well updated. I will add trace to see > their values before and after the emulation. > I'd prefer you not do an emulate_instruction loop at all. Just emulate one instruction on vmentry failure and let VT tell you what instructions you need to emulate. It's only four instructions so I don't think the performance is going to matter. Take a look at the patch I posted previously. Regards, Anthony Liguori > Regards, > Guillaume > ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone