ia64/xen-unstable

changeset 8100:5ea875b72e0a

In alloc_vcpu_struct, after doing a memset on the new allocated vcpu, we
do a memcpy from idle0_vcpu.arch to arch of the new vcpu, which causes
monitor_pagetable is set to a none 0 value. For VMX guest which is
using external shadow mode, this is not what we really need. the
previous patch is OK for UP VMX guest, but failed on SMP VMX guest.

Signed-off-by: Xin Li <xin.b.li@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Nov 28 16:24:14 2005 +0100 (2005-11-28)
parents 66e16c4685f5
children a90691f5207c
files xen/arch/x86/domain.c xen/arch/x86/vmx.c
line diff
     1.1 --- a/xen/arch/x86/domain.c	Mon Nov 28 16:17:03 2005 +0100
     1.2 +++ b/xen/arch/x86/domain.c	Mon Nov 28 16:24:14 2005 +0100
     1.3 @@ -414,9 +414,6 @@ int arch_set_info_guest(
     1.4              d->arch.phys_table = v->arch.guest_table;
     1.5          v->arch.guest_table = mk_pagetable(0);
     1.6  
     1.7 -        /* Initialize monitor page table */
     1.8 -        v->arch.monitor_table = mk_pagetable(0);
     1.9 -
    1.10          vmx_final_setup_guest(v);
    1.11      }
    1.12  
     2.1 --- a/xen/arch/x86/vmx.c	Mon Nov 28 16:17:03 2005 +0100
     2.2 +++ b/xen/arch/x86/vmx.c	Mon Nov 28 16:24:14 2005 +0100
     2.3 @@ -61,23 +61,30 @@ void vmx_final_setup_guest(struct vcpu *
     2.4  {
     2.5      v->arch.schedule_tail = arch_vmx_do_launch;
     2.6  
     2.7 -    if ( v == v->domain->vcpu[0] )
     2.8 +    if ( v->vcpu_id == 0 )
     2.9      {
    2.10 -        v->domain->arch.vmx_platform.lapic_enable =
    2.11 -            v->arch.guest_context.user_regs.ecx;
    2.12 +        struct domain *d = v->domain;
    2.13 +        struct vcpu *vc;
    2.14 +
    2.15 +        d->arch.vmx_platform.lapic_enable = v->arch.guest_context.user_regs.ecx;
    2.16          v->arch.guest_context.user_regs.ecx = 0;
    2.17          VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "lapic enable is %d.\n",
    2.18 -                    v->domain->arch.vmx_platform.lapic_enable);
    2.19 +                    d->arch.vmx_platform.lapic_enable);
    2.20 +
    2.21 +        /* Initialize monitor page table */
    2.22 +        for_each_vcpu(d, vc)
    2.23 +            vc->arch.monitor_table = mk_pagetable(0);
    2.24 +
    2.25          /*
    2.26           * Required to do this once per domain
    2.27           * XXX todo: add a seperate function to do these.
    2.28           */
    2.29 -        memset(&v->domain->shared_info->evtchn_mask[0], 0xff,
    2.30 -               sizeof(v->domain->shared_info->evtchn_mask));
    2.31 +        memset(&d->shared_info->evtchn_mask[0], 0xff,
    2.32 +               sizeof(d->shared_info->evtchn_mask));
    2.33  
    2.34          /* Put the domain in shadow mode even though we're going to be using
    2.35           * the shared 1:1 page table initially. It shouldn't hurt */
    2.36 -        shadow_mode_enable(v->domain,
    2.37 +        shadow_mode_enable(d,
    2.38                             SHM_enable|SHM_refcounts|
    2.39                             SHM_translate|SHM_external|SHM_wr_pt_pte);
    2.40      }