All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: "He, Qing" <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [PATCH] SMP: Setup multiple tss for real mode emulation
Date: Thu, 12 Jul 2007 11:16:14 +0300	[thread overview]
Message-ID: <4695E34E.2030506@qumranet.com> (raw)
In-Reply-To: <37E52D09333DE2469A03574C88DBF40F048E7C-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.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 <qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
>
> 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/

  parent reply	other threads:[~2007-07-12  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-12  7:53 [PATCH] SMP: Setup multiple tss for real mode emulation He, Qing
     [not found] ` <37E52D09333DE2469A03574C88DBF40F048E7C-wq7ZOvIWXbM/UvCtAeCM4rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-07-12  8:16   ` Avi Kivity [this message]
     [not found]     ` <4695E34E.2030506-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-12  8:53       ` He, Qing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4695E34E.2030506@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=qing.he-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.