From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH] When switching to a vm8086 task, load segments as 16-bit (v2) Date: Wed, 12 Aug 2009 08:15:23 -0500 Message-ID: <4A82C06B.10400@us.ibm.com> References: <1250024279-6307-1-git-send-email-aliguori@us.ibm.com> <4A82B177.9030607@redhat.com> <4A82B769.3060608@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Gleb Natapov To: Avi Kivity Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:56196 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752446AbZHLNPh (ORCPT ); Wed, 12 Aug 2009 09:15:37 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e34.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n7CDBisH027277 for ; Wed, 12 Aug 2009 07:11:44 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n7CDFPkL235376 for ; Wed, 12 Aug 2009 07:15:29 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n7CDFO54023019 for ; Wed, 12 Aug 2009 07:15:24 -0600 In-Reply-To: <4A82B769.3060608@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > On 08/12/2009 03:11 PM, Avi Kivity wrote: >> On 08/11/2009 11:57 PM, Anthony Liguori wrote: >>> According to 16.2.5 in the SDM, eflags.vm in the tss is consulted >>> before loading >>> and new segments. If eflags.vm == 1, then the segments are treated >>> as 16-bit >>> segments. The LDTR and TR are not normally available in vm86 mode >>> so if they >>> happen to somehow get loaded, they need to be treated as 32-bit >>> segments. >>> >>> This fixes an invalid vmentry failure in a custom OS that was >>> happening after >>> a task switch into vm8086 mode. Since the segments were being >>> mistakenly >>> treated as 32-bit, we loaded garbage state. >> >> I'm getting a Vista x64 installer failure on reboot with this. One >> possibility is that ->get_rflags() is returning the mangled flags >> state (we add vm86 for real mode), which confuses the new code. >> > > That's indeed the case, I'm testing a patch now. While the code looks nicer with the second patch, the fact that get_rflags() does a vmcs_read() seems 7 times more than before seems unfortunate. -- Regards, Anthony Liguori