From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH kvm-unittests v2] x86/taskswitch2: Task switches into/out of VM86 Date: Mon, 15 Apr 2013 18:49:18 +0300 Message-ID: <20130415154918.GC5807@redhat.com> References: <1365765287-5759-1-git-send-email-kwolf@redhat.com> <20130414124224.GO17919@redhat.com> <20130415085642.GE3914@dhcp-200-207.str.redhat.com> <20130415153826.GA5807@redhat.com> <20130415154227.GK3914@dhcp-200-207.str.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Kevin Wolf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:15829 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307Ab3DOPtU (ORCPT ); Mon, 15 Apr 2013 11:49:20 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3FFnKiK025222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 15 Apr 2013 11:49:20 -0400 Content-Disposition: inline In-Reply-To: <20130415154227.GK3914@dhcp-200-207.str.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Apr 15, 2013 at 05:42:27PM +0200, Kevin Wolf wrote: > Am 15.04.2013 um 17:38 hat Gleb Natapov geschrieben: > > On Mon, Apr 15, 2013 at 10:56:42AM +0200, Kevin Wolf wrote: > > > Am 14.04.2013 um 14:42 hat Gleb Natapov geschrieben: > > > > On Fri, Apr 12, 2013 at 01:14:47PM +0200, Kevin Wolf wrote: > > > > > This adds a test case that jumps into VM86 by iret-ing to a TSS and back > > > > > to Protected Mode using a task gate in the IDT. > > > > > > > > > > Signed-off-by: Kevin Wolf > > > > Applied, thanks. Found a bug with it and emulate_invalid_guest_state=1 > > > > which is default. Are you running with emulate_invalid_guest_state=0? > > > > > > Not knowingly at least, I didn't specify any module options. I > > > guess I just have enable_unrestricted_guest == true, which makes > > > guest_state_valid() return true immediately. > > > > > Can you check in > > /sys/module/kvm_intel/parameters/emulate_invalid_guest_state and > > /sys/module/kvm_intel/parameters/unrestricted_guest? You shouldn't have > > failed entry problem with enable_unrestricted_guest == true either. > > $ cat /sys/module/kvm_intel/parameters/emulate_invalid_guest_state > Y > $ cat /sys/module/kvm_intel/parameters/unrestricted_guest > Y > > Why do you think that I wouldn't have the failed entry check with > unrestricted_guest == true? The task switch is always done in software > and if it leads to an invalid segment descriptor in the VMCS, then a > failed VM entry looks quite expected to me. > unrestricted_guest eliminates a lot of check on vcpu state during guest entry since now real mode, along with big real mode, are virtualized directly by the CPU. But you are right that with VM86 we hit the check that is still there: if vcpu is in the VM86 mode segment registers should be in a specific state. -- Gleb.