From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC][PATCH] Add support for the GUEST_SMBASE VMCS field for Intel VT-x. Date: Tue, 05 Jun 2012 16:09:30 +0300 Message-ID: <4FCE050A.8070709@redhat.com> References: <4FB61795.9080601@sec.t-labs.tu-berlin.de> <4FB8E602.5030409@redhat.com> <20120605115904.GC17624@rhea> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54357 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754630Ab2FENJc (ORCPT ); Tue, 5 Jun 2012 09:09:32 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q55D9Vem014840 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 5 Jun 2012 09:09:31 -0400 In-Reply-To: <20120605115904.GC17624@rhea> Sender: kvm-owner@vger.kernel.org List-ID: On 06/05/2012 02:59 PM, Matthias Lange wrote: > On Sun, May 20, 2012 at 03:39:30PM +0300, Avi Kivity wrote: >> On 05/18/2012 12:34 PM, Matthias Lange wrote: >> > The following patch adds support for the GUEST_SMBASE field. This allows >> > hypervisors running inside kvm read/write access to this field. I have >> > tested this to work on a Core i5 machine. >> > >> > diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h >> > index 31f180c..6a14720 100644 >> > --- a/arch/x86/include/asm/vmx.h >> > +++ b/arch/x86/include/asm/vmx.h >> > @@ -194,6 +194,7 @@ enum vmcs_field { >> > GUEST_TR_AR_BYTES = 0x00004822, >> > GUEST_INTERRUPTIBILITY_INFO = 0x00004824, >> > GUEST_ACTIVITY_STATE = 0X00004826, >> > + GUEST_SMBASE = 0x00004828, >> > GUEST_SYSENTER_CS = 0x0000482A, >> > HOST_IA32_SYSENTER_CS = 0x00004c00, >> > CR0_GUEST_HOST_MASK = 0x00006000, >> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> > index 4ff0ab9..0063743 100644 >> > --- a/arch/x86/kvm/vmx.c >> > +++ b/arch/x86/kvm/vmx.c >> > @@ -285,6 +285,7 @@ struct __packed vmcs12 { >> > u32 guest_tr_ar_bytes; >> > u32 guest_interruptibility_info; >> > u32 guest_activity_state; >> > + u32 guest_smbase; >> > u32 guest_sysenter_cs; >> > u32 host_ia32_sysenter_cs; >> > u32 padding32[8]; /* room for future expansion */ >> > @@ -546,6 +547,7 @@ static unsigned short vmcs_field_to_offset_table[] = { >> > >> >> vmcs12 is an ABI, so you can't insert fields at random. Grab one from >> padding32. > > Do you mean the ABI defined in the Intel Software Developer's manual 3B? Or is > vmcs12 only an ABI internal to the kvm module? The latter. We want to be able to live migrate a guest with nested guests, and if the format of vmcs12 changes, the migration will break. > > I understand that my patch is wrong because I need to decrease the size of > padding32. I tested the patch by running Ubuntu 12.04 as the L1 guest and > Tinycore Linux as the L2 guest. > > Let me know what you think. > -- error compiling committee.c: too many arguments to function