From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] SMP: Setup multiple tss for real mode emulation Date: Thu, 12 Jul 2007 11:16:14 +0300 Message-ID: <4695E34E.2030506@qumranet.com> References: <37E52D09333DE2469A03574C88DBF40F048E7C@pdsmsx414.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel To: "He, Qing" Return-path: In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048E7C-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org He, Qing wrote: > This patch sets up multiple TSS for real mode emulation on Intel vmx, > one for each vcpu. This is a preparation patch for full SMP real mode > support. > > Why are separate tss's needed? Can't all vcpus use the same tss? > Signed-off-by: Qing He > > > kvm.h | 1 + > kvm_main.c | 1 + > vmx.c | 31 +++++++++++++++++-------------- > 3 files changed, 19 insertions(+), 14 deletions(-) > > > diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h > index 65ab268..0f7a4d9 100644 > --- a/drivers/kvm/kvm.h > +++ b/drivers/kvm/kvm.h > @@ -328,6 +328,7 @@ void kvm_io_bus_register_dev(struct kvm_io_bus *bus, > > struct kvm_vcpu { > struct kvm *kvm; > + int vcpu_id; > Switching to ->vcpu_id instead of computing (vcpu - vcpu->kvm->vcpus) is a good idea (and necessary when separately allocating vcpus). But in its own patch, please. > - vmcs_write16(GUEST_CS_SELECTOR, 0xf000); > - vmcs_writel(GUEST_CS_BASE, 0x000f0000); > - vmcs_write32(GUEST_CS_LIMIT, 0xffff); > - vmcs_write32(GUEST_CS_AR_BYTES, 0x9b); > + if (vcpu->vcpu_id == 0) { > + vmcs_write16(GUEST_CS_SELECTOR, 0xf000); > + vmcs_writel(GUEST_CS_BASE, 0x000f0000); > + vmcs_write32(GUEST_CS_LIMIT, 0xffff); > + vmcs_write32(GUEST_CS_AR_BYTES, 0x9b); > + vmcs_writel(GUEST_RIP, 0xfff0); > + } > > Since you're not initializing these registers for vcpu_id != 0, we might as well not touch this code. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/