ia64/xen-unstable

changeset 2921:e809b69fa26a

bitkeeper revision 1.1159.1.395 (4190ab80qQIIPeM49q40ES01DxL7Ng)

Move shared_info pointer from exec_domain to domain and add vcpu_info pointer
in exec_domain.
author cl349@freefall.cl.cam.ac.uk
date Tue Nov 09 11:35:28 2004 +0000 (2004-11-09)
parents 90b094417ff3
children ac42e731eebc
files xen/arch/x86/domain.c xen/arch/x86/irq.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/seg_fixup.c xen/common/dom0_ops.c xen/common/domain.c xen/common/keyhandler.c xen/common/schedule.c xen/include/asm-x86/x86_32/asm_defns.h xen/include/public/xen.h xen/include/xen/event.h xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/x86/domain.c	Tue Nov 09 10:52:02 2004 +0000
     1.2 +++ b/xen/arch/x86/domain.c	Tue Nov 09 11:35:28 2004 +0000
     1.3 @@ -215,19 +215,21 @@ void free_perdomain_pt(struct exec_domai
     1.4      free_xenheap_page((unsigned long)d->mm.perdomain_pt);
     1.5  }
     1.6  
     1.7 -void arch_do_createdomain(struct exec_domain *d)
     1.8 +void arch_do_createdomain(struct exec_domain *ed)
     1.9  {
    1.10 +    struct domain *d = ed->domain;
    1.11      d->shared_info = (void *)alloc_xenheap_page();
    1.12      memset(d->shared_info, 0, PAGE_SIZE);
    1.13 +    ed->vcpu_info = &d->shared_info->vcpu_data[ed->eid];
    1.14      d->shared_info->arch.mfn_to_pfn_start = 
    1.15  	virt_to_phys(&machine_to_phys_mapping[0])>>PAGE_SHIFT;
    1.16 -    SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d->domain);
    1.17 +    SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
    1.18      machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
    1.19                             PAGE_SHIFT] = INVALID_P2M_ENTRY;
    1.20  
    1.21 -    d->mm.perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page();
    1.22 -    memset(d->mm.perdomain_pt, 0, PAGE_SIZE);
    1.23 -    machine_to_phys_mapping[virt_to_phys(d->mm.perdomain_pt) >> 
    1.24 +    ed->mm.perdomain_pt = (l1_pgentry_t *)alloc_xenheap_page();
    1.25 +    memset(ed->mm.perdomain_pt, 0, PAGE_SIZE);
    1.26 +    machine_to_phys_mapping[virt_to_phys(ed->mm.perdomain_pt) >> 
    1.27                             PAGE_SHIFT] = INVALID_P2M_ENTRY;
    1.28  }
    1.29  
    1.30 @@ -826,12 +828,12 @@ int construct_dom0(struct domain *p,
    1.31      }
    1.32  
    1.33      /* Set up shared-info area. */
    1.34 -    update_dom_time(ed->shared_info);
    1.35 -    ed->shared_info->domain_time = 0;
    1.36 +    update_dom_time(p->shared_info);
    1.37 +    p->shared_info->domain_time = 0;
    1.38      /* Mask all upcalls... */
    1.39      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    1.40 -        ed->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    1.41 -    ed->shared_info->n_vcpu = 1;
    1.42 +        p->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    1.43 +    p->shared_info->n_vcpu = 1;
    1.44  
    1.45      /* Install the new page tables. */
    1.46      __cli();
    1.47 @@ -848,7 +850,7 @@ int construct_dom0(struct domain *p,
    1.48      si = (start_info_t *)vstartinfo_start;
    1.49      memset(si, 0, PAGE_SIZE);
    1.50      si->nr_pages     = p->tot_pages;
    1.51 -    si->shared_info  = virt_to_phys(ed->shared_info);
    1.52 +    si->shared_info  = virt_to_phys(p->shared_info);
    1.53      si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
    1.54      si->pt_base      = vpt_start;
    1.55      si->nr_pt_frames = nr_pt_pages;
     2.1 --- a/xen/arch/x86/irq.c	Tue Nov 09 10:52:02 2004 +0000
     2.2 +++ b/xen/arch/x86/irq.c	Tue Nov 09 11:35:28 2004 +0000
     2.3 @@ -212,7 +212,7 @@ int pirq_guest_unmask(struct domain *d)
     2.4      irq_desc_t    *desc;
     2.5      unsigned int   i, j, pirq;
     2.6      u32            m;
     2.7 -    shared_info_t *s = d->exec_domain[0]->shared_info;
     2.8 +    shared_info_t *s = d->shared_info;
     2.9  
    2.10      for ( i = 0; i < ARRAY_SIZE(d->pirq_mask); i++ )
    2.11      {
     3.1 --- a/xen/arch/x86/time.c	Tue Nov 09 10:52:02 2004 +0000
     3.2 +++ b/xen/arch/x86/time.c	Tue Nov 09 11:35:28 2004 +0000
     3.3 @@ -318,7 +318,7 @@ void do_settime(unsigned long secs, unsi
     3.4  
     3.5      write_unlock_irq(&time_lock);
     3.6  
     3.7 -    update_dom_time(current->shared_info);
     3.8 +    update_dom_time(current->domain->shared_info);
     3.9  }
    3.10  
    3.11  
     4.1 --- a/xen/arch/x86/traps.c	Tue Nov 09 10:52:02 2004 +0000
     4.2 +++ b/xen/arch/x86/traps.c	Tue Nov 09 11:35:28 2004 +0000
     4.3 @@ -231,7 +231,7 @@ static inline void do_trap(int trapnr, c
     4.4      gtb->cs         = ti->cs;
     4.5      gtb->eip        = ti->address;
     4.6      if ( TI_GET_IF(ti) )
     4.7 -        ed->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
     4.8 +        ed->vcpu_info->evtchn_upcall_mask = 1;
     4.9      return; 
    4.10  
    4.11   xen_fault:
    4.12 @@ -302,7 +302,7 @@ asmlinkage void do_int3(struct xen_regs 
    4.13      gtb->cs         = ti->cs;
    4.14      gtb->eip        = ti->address;
    4.15      if ( TI_GET_IF(ti) )
    4.16 -        ed->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.17 +        ed->vcpu_info->evtchn_upcall_mask = 1;
    4.18  }
    4.19  
    4.20  asmlinkage void do_double_fault(void)
    4.21 @@ -393,7 +393,7 @@ asmlinkage void do_page_fault(struct xen
    4.22      gtb->cs         = ti->cs;
    4.23      gtb->eip        = ti->address;
    4.24      if ( TI_GET_IF(ti) )
    4.25 -        ed->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.26 +        ed->vcpu_info->evtchn_upcall_mask = 1;
    4.27      return; 
    4.28  
    4.29   xen_fault:
    4.30 @@ -510,7 +510,7 @@ asmlinkage void do_general_protection(st
    4.31      gtb->cs         = ti->cs;
    4.32      gtb->eip        = ti->address;
    4.33      if ( TI_GET_IF(ti) )
    4.34 -        ed->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
    4.35 +        ed->vcpu_info->evtchn_upcall_mask = 1;
    4.36      return;
    4.37  
    4.38   gp_in_kernel:
     5.1 --- a/xen/arch/x86/x86_32/entry.S	Tue Nov 09 10:52:02 2004 +0000
     5.2 +++ b/xen/arch/x86/x86_32/entry.S	Tue Nov 09 11:35:28 2004 +0000
     5.3 @@ -196,12 +196,12 @@ 7:      SET_XEN_SEGMENTS(a)
     5.4  /* No special register assumptions */
     5.5  failsafe_callback:
     5.6          GET_CURRENT(%ebx)
     5.7 -        movl DOMAIN_processor(%ebx),%eax
     5.8 +        movl EDOMAIN_processor(%ebx),%eax
     5.9          shl  $4,%eax
    5.10          lea  guest_trap_bounce(%eax),%edx
    5.11 -        movl DOMAIN_failsafe_addr(%ebx),%eax
    5.12 +        movl EDOMAIN_failsafe_addr(%ebx),%eax
    5.13          movl %eax,GTB_eip(%edx)
    5.14 -        movl DOMAIN_failsafe_sel(%ebx),%eax
    5.15 +        movl EDOMAIN_failsafe_sel(%ebx),%eax
    5.16          movw %ax,GTB_cs(%edx)
    5.17          call create_bounce_frame
    5.18          subl $16,%esi                # add DS/ES/FS/GS to failsafe stack frame
    5.19 @@ -253,24 +253,24 @@ test_all_events:
    5.20          notl %ecx
    5.21          cli                             # tests must not race interrupts
    5.22  /*test_softirqs:*/  
    5.23 -        movl DOMAIN_processor(%ebx),%eax
    5.24 +        movl EDOMAIN_processor(%ebx),%eax
    5.25          shl  $6,%eax                    # sizeof(irq_cpustat) == 64
    5.26          test %ecx,SYMBOL_NAME(irq_stat)(%eax,1)
    5.27          jnz  process_softirqs
    5.28  /*test_guest_events:*/
    5.29 -        movl DOMAIN_shared_info(%ebx),%eax
    5.30 -        testb $0xFF,SHINFO_upcall_mask(%eax)
    5.31 +        movl EDOMAIN_vcpu_info(%ebx),%eax
    5.32 +        testb $0xFF,VCPUINFO_upcall_mask(%eax)
    5.33          jnz  restore_all_guest
    5.34 -        testb $0xFF,SHINFO_upcall_pending(%eax)
    5.35 +        testb $0xFF,VCPUINFO_upcall_pending(%eax)
    5.36          jz   restore_all_guest
    5.37 -        movb $1,SHINFO_upcall_mask(%eax) # Upcalls are masked during delivery
    5.38 +        movb $1,VCPUINFO_upcall_mask(%eax) # Upcalls are masked during delivery
    5.39  /*process_guest_events:*/
    5.40 -        movl DOMAIN_processor(%ebx),%edx
    5.41 +        movl EDOMAIN_processor(%ebx),%edx
    5.42          shl  $4,%edx                     # sizeof(guest_trap_bounce) == 16
    5.43          lea  guest_trap_bounce(%edx),%edx
    5.44 -        movl DOMAIN_event_addr(%ebx),%eax
    5.45 +        movl EDOMAIN_event_addr(%ebx),%eax
    5.46          movl %eax,GTB_eip(%edx)
    5.47 -        movl DOMAIN_event_sel(%ebx),%eax
    5.48 +        movl EDOMAIN_event_sel(%ebx),%eax
    5.49          movw %ax,GTB_cs(%edx)
    5.50          call create_bounce_frame
    5.51          jmp  restore_all_guest
    5.52 @@ -290,7 +290,7 @@ create_bounce_frame:
    5.53          test $2,%cl
    5.54          jz   1f /* jump if returning to an existing ring-1 activation */
    5.55          /* obtain ss/esp from TSS -- no current ring-1 activations */
    5.56 -        movl DOMAIN_processor(%ebx),%eax
    5.57 +        movl EDOMAIN_processor(%ebx),%eax
    5.58          /* next 4 lines multiply %eax by 8320, which is sizeof(tss_struct) */
    5.59          movl %eax, %ecx
    5.60          shll $7, %ecx
    5.61 @@ -362,7 +362,7 @@ crash_domain_fixup3:
    5.62  
    5.63          ALIGN
    5.64  process_guest_exception_and_events:        
    5.65 -        movl DOMAIN_processor(%ebx),%eax
    5.66 +        movl EDOMAIN_processor(%ebx),%eax
    5.67          shl  $4,%eax
    5.68          lea  guest_trap_bounce(%eax),%edx
    5.69          testb $~0,GTB_flags(%edx)
     6.1 --- a/xen/arch/x86/x86_32/seg_fixup.c	Tue Nov 09 10:52:02 2004 +0000
     6.2 +++ b/xen/arch/x86/x86_32/seg_fixup.c	Tue Nov 09 11:35:28 2004 +0000
     6.3 @@ -472,7 +472,7 @@ int gpf_emulate_4gb(struct xen_regs *reg
     6.4          gtb->cs         = ti->cs;
     6.5          gtb->eip        = ti->address;
     6.6          if ( TI_GET_IF(ti) )
     6.7 -            d->shared_info->vcpu_data[0].evtchn_upcall_mask = 1;
     6.8 +            d->vcpu_info->evtchn_upcall_mask = 1;
     6.9      }
    6.10  
    6.11      return 1;
     7.1 --- a/xen/common/dom0_ops.c	Tue Nov 09 10:52:02 2004 +0000
     7.2 +++ b/xen/common/dom0_ops.c	Tue Nov 09 11:35:28 2004 +0000
     7.3 @@ -372,7 +372,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     7.4          op->u.getdomaininfo.max_pages   = d->max_pages;
     7.5          op->u.getdomaininfo.cpu_time    = ed->cpu_time;
     7.6          op->u.getdomaininfo.shared_info_frame = 
     7.7 -            __pa(ed->shared_info) >> PAGE_SHIFT;
     7.8 +            __pa(d->shared_info) >> PAGE_SHIFT;
     7.9  
    7.10          if ( op->u.getdomaininfo.ctxt != NULL )
    7.11          {
     8.1 --- a/xen/common/domain.c	Tue Nov 09 10:52:02 2004 +0000
     8.2 +++ b/xen/common/domain.c	Tue Nov 09 11:35:28 2004 +0000
     8.3 @@ -243,7 +243,7 @@ void domain_destruct(struct domain *d)
     8.4  
     8.5      for_each_exec_domain(d, ed)
     8.6          free_perdomain_pt(ed);
     8.7 -    free_xenheap_page((unsigned long)d->exec_domain[0]->shared_info);
     8.8 +    free_xenheap_page((unsigned long)d->shared_info);
     8.9  
    8.10      free_domain_struct(d);
    8.11  }
    8.12 @@ -278,7 +278,7 @@ int final_setup_guestos(struct domain *p
    8.13          goto out;
    8.14  
    8.15      /* Set up the shared info structure. */
    8.16 -    update_dom_time(p->exec_domain[0]->shared_info);
    8.17 +    update_dom_time(p->shared_info);
    8.18  
    8.19      set_bit(DF_CONSTRUCTED, &p->d_flags);
    8.20  
     9.1 --- a/xen/common/keyhandler.c	Tue Nov 09 10:52:02 2004 +0000
     9.2 +++ b/xen/common/keyhandler.c	Tue Nov 09 11:35:28 2004 +0000
     9.3 @@ -94,7 +94,7 @@ void do_task_queues(unsigned char key)
     9.4              }
     9.5          }
     9.6  
     9.7 -        page = virt_to_page(d->exec_domain[0]->shared_info);
     9.8 +        page = virt_to_page(d->shared_info);
     9.9          printk("Shared_info@%08x: caf=%08x, taf=%08x\n",
    9.10                 page_to_phys(page), page->count_info,
    9.11                 page->u.inuse.type_info);
    9.12 @@ -105,8 +105,8 @@ void do_task_queues(unsigned char key)
    9.13                     ed->processor,
    9.14                     test_bit(EDF_RUNNING, &ed->ed_flags) ? 'T':'F',
    9.15                     ed->ed_flags,
    9.16 -                   ed->shared_info->vcpu_data[0].evtchn_upcall_pending, 
    9.17 -                   ed->shared_info->vcpu_data[0].evtchn_upcall_mask);
    9.18 +                   ed->vcpu_info->evtchn_upcall_pending, 
    9.19 +                   ed->vcpu_info->evtchn_upcall_mask);
    9.20          }
    9.21          printk("Notifying guest...\n"); 
    9.22          send_guest_virq(d->exec_domain[0], VIRQ_DEBUG);
    10.1 --- a/xen/common/schedule.c	Tue Nov 09 10:52:02 2004 +0000
    10.2 +++ b/xen/common/schedule.c	Tue Nov 09 11:35:28 2004 +0000
    10.3 @@ -222,7 +222,7 @@ void domain_wake(struct exec_domain *d)
    10.4  long do_block(void)
    10.5  {
    10.6      ASSERT(current->id != IDLE_DOMAIN_ID);
    10.7 -    current->shared_info->vcpu_data[0].evtchn_upcall_mask = 0;
    10.8 +    current->vcpu_info->evtchn_upcall_mask = 0;
    10.9      set_bit(EDF_BLOCKED, &current->ed_flags);
   10.10      TRACE_2D(TRC_SCHED_BLOCK, current->id, current);
   10.11      __enter_scheduler();
   10.12 @@ -390,7 +390,7 @@ void __enter_scheduler(void)
   10.13  
   10.14      /* Ensure that the domain has an up-to-date time base. */
   10.15      if ( !is_idle_task(next->domain) )
   10.16 -        update_dom_time(next->shared_info);
   10.17 +        update_dom_time(next->domain->shared_info);
   10.18  
   10.19      if ( unlikely(prev == next) )
   10.20          return;
   10.21 @@ -468,7 +468,7 @@ static void t_timer_fn(unsigned long unu
   10.22      TRACE_0D(TRC_SCHED_T_TIMER_FN);
   10.23  
   10.24      if ( !is_idle_task(p->domain) ) {
   10.25 -        update_dom_time(p->shared_info);
   10.26 +        update_dom_time(p->domain->shared_info);
   10.27          send_guest_virq(p, VIRQ_TIMER);
   10.28      }
   10.29  
   10.30 @@ -482,7 +482,7 @@ static void dom_timer_fn(unsigned long d
   10.31      struct domain *p = (struct domain *)data;
   10.32      struct exec_domain *ed = p->exec_domain[0];
   10.33      TRACE_0D(TRC_SCHED_DOM_TIMER_FN);
   10.34 -    update_dom_time(ed->shared_info);
   10.35 +    update_dom_time(p->shared_info);
   10.36      send_guest_virq(ed, VIRQ_TIMER);
   10.37  }
   10.38  
   10.39 @@ -496,7 +496,7 @@ static void fallback_timer_fn(unsigned l
   10.40      TRACE_0D(TRC_SCHED_FALLBACK_TIMER_FN);
   10.41  
   10.42      if ( !is_idle_task(p) )
   10.43 -        update_dom_time(ed->shared_info);
   10.44 +        update_dom_time(p->shared_info);
   10.45  
   10.46      fallback_timer[ed->processor].expires = NOW() + MILLISECS(500);
   10.47      add_ac_timer(&fallback_timer[ed->processor]);
    11.1 --- a/xen/include/asm-x86/x86_32/asm_defns.h	Tue Nov 09 10:52:02 2004 +0000
    11.2 +++ b/xen/include/asm-x86/x86_32/asm_defns.h	Tue Nov 09 11:35:28 2004 +0000
    11.3 @@ -20,17 +20,17 @@
    11.4  #define XREGS_fs       0x3C
    11.5  #define XREGS_gs       0x40
    11.6  
    11.7 -/* Offsets in 'struct domain' --- AUTO-GENERATE ME! */
    11.8 -#define DOMAIN_processor       0
    11.9 -#define DOMAIN_shared_info     4
   11.10 -#define DOMAIN_event_sel       8
   11.11 -#define DOMAIN_event_addr     12
   11.12 -#define DOMAIN_failsafe_sel   16
   11.13 -#define DOMAIN_failsafe_addr  20
   11.14 +/* Offsets in 'struct exec_domain' --- AUTO-GENERATE ME! */
   11.15 +#define EDOMAIN_processor       0
   11.16 +#define EDOMAIN_vcpu_info       4
   11.17 +#define EDOMAIN_event_sel       8
   11.18 +#define EDOMAIN_event_addr     12
   11.19 +#define EDOMAIN_failsafe_sel   16
   11.20 +#define EDOMAIN_failsafe_addr  20
   11.21  
   11.22 -/* Offsets in shared_info_t --- AUTO-GENERATE ME! */
   11.23 -#define SHINFO_upcall_pending /* 0 */
   11.24 -#define SHINFO_upcall_mask       1
   11.25 +/* Offsets in vcpu_info_t --- AUTO-GENERATE ME! */
   11.26 +#define VCPUINFO_upcall_pending /* 0 */
   11.27 +#define VCPUINFO_upcall_mask       1
   11.28  
   11.29  /* Offsets in 'struct guest_trap_bounce' --- AUTO-GENERATE ME! */
   11.30  #define GTB_error_code    0
    12.1 --- a/xen/include/public/xen.h	Tue Nov 09 10:52:02 2004 +0000
    12.2 +++ b/xen/include/public/xen.h	Tue Nov 09 11:35:28 2004 +0000
    12.3 @@ -254,45 +254,48 @@ typedef struct
    12.4  #define MAX_VIRT_CPUS 4
    12.5  
    12.6  /*
    12.7 + * Per-VCPU information goes here. This will be cleaned up more when Xen 
    12.8 + * actually supports multi-VCPU guests.
    12.9 + */
   12.10 +typedef struct vcpu_info_st
   12.11 +{
   12.12 +    /*
   12.13 +     * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
   12.14 +     * a pending notification for a particular VCPU. It is then cleared 
   12.15 +     * by the guest OS /before/ checking for pending work, thus avoiding
   12.16 +     * a set-and-check race. Note that the mask is only accessed by Xen
   12.17 +     * on the CPU that is currently hosting the VCPU. This means that the
   12.18 +     * pending and mask flags can be updated by the guest without special
   12.19 +     * synchronisation (i.e., no need for the x86 LOCK prefix).
   12.20 +     * This may seem suboptimal because if the pending flag is set by
   12.21 +     * a different CPU then an IPI may be scheduled even when the mask
   12.22 +     * is set. However, note:
   12.23 +     *  1. The task of 'interrupt holdoff' is covered by the per-event-
   12.24 +     *     channel mask bits. A 'noisy' event that is continually being
   12.25 +     *     triggered can be masked at source at this very precise
   12.26 +     *     granularity.
   12.27 +     *  2. The main purpose of the per-VCPU mask is therefore to restrict
   12.28 +     *     reentrant execution: whether for concurrency control, or to
   12.29 +     *     prevent unbounded stack usage. Whatever the purpose, we expect
   12.30 +     *     that the mask will be asserted only for short periods at a time,
   12.31 +     *     and so the likelihood of a 'spurious' IPI is suitably small.
   12.32 +     * The mask is read before making an event upcall to the guest: a
   12.33 +     * non-zero mask therefore guarantees that the VCPU will not receive
   12.34 +     * an upcall activation. The mask is cleared when the VCPU requests
   12.35 +     * to block: this avoids wakeup-waiting races.
   12.36 +     */
   12.37 +    u8 evtchn_upcall_pending;
   12.38 +    u8 evtchn_upcall_mask;
   12.39 +    u8 pad0, pad1;
   12.40 +} PACKED vcpu_info_t;
   12.41 +
   12.42 +/*
   12.43   * Xen/guestos shared data -- pointer provided in start_info.
   12.44   * NB. We expect that this struct is smaller than a page.
   12.45   */
   12.46  typedef struct shared_info_st
   12.47  {
   12.48 -    /*
   12.49 -     * Per-VCPU information goes here. This will be cleaned up more when Xen 
   12.50 -     * actually supports multi-VCPU guests.
   12.51 -     */
   12.52 -    struct {
   12.53 -        /*
   12.54 -         * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
   12.55 -         * a pending notification for a particular VCPU. It is then cleared 
   12.56 -         * by the guest OS /before/ checking for pending work, thus avoiding
   12.57 -         * a set-and-check race. Note that the mask is only accessed by Xen
   12.58 -         * on the CPU that is currently hosting the VCPU. This means that the
   12.59 -         * pending and mask flags can be updated by the guest without special
   12.60 -         * synchronisation (i.e., no need for the x86 LOCK prefix).
   12.61 -         * This may seem suboptimal because if the pending flag is set by
   12.62 -         * a different CPU then an IPI may be scheduled even when the mask
   12.63 -         * is set. However, note:
   12.64 -         *  1. The task of 'interrupt holdoff' is covered by the per-event-
   12.65 -         *     channel mask bits. A 'noisy' event that is continually being
   12.66 -         *     triggered can be masked at source at this very precise
   12.67 -         *     granularity.
   12.68 -         *  2. The main purpose of the per-VCPU mask is therefore to restrict
   12.69 -         *     reentrant execution: whether for concurrency control, or to
   12.70 -         *     prevent unbounded stack usage. Whatever the purpose, we expect
   12.71 -         *     that the mask will be asserted only for short periods at a time,
   12.72 -         *     and so the likelihood of a 'spurious' IPI is suitably small.
   12.73 -         * The mask is read before making an event upcall to the guest: a
   12.74 -         * non-zero mask therefore guarantees that the VCPU will not receive
   12.75 -         * an upcall activation. The mask is cleared when the VCPU requests
   12.76 -         * to block: this avoids wakeup-waiting races.
   12.77 -         */
   12.78 -        u8 evtchn_upcall_pending;
   12.79 -        u8 evtchn_upcall_mask;
   12.80 -        u8 pad0, pad1;
   12.81 -    } PACKED vcpu_data[MAX_VIRT_CPUS];  /*   0 */
   12.82 +    vcpu_info_t vcpu_data[MAX_VIRT_CPUS];  /*   0 */
   12.83  
   12.84      u32 n_vcpu;
   12.85  
    13.1 --- a/xen/include/xen/event.h	Tue Nov 09 10:52:02 2004 +0000
    13.2 +++ b/xen/include/xen/event.h	Tue Nov 09 11:35:28 2004 +0000
    13.3 @@ -23,7 +23,7 @@
    13.4  static inline void evtchn_set_pending(struct domain *d, int port)
    13.5  {
    13.6      struct exec_domain *ed = d->exec_domain[0];
    13.7 -    shared_info_t *s = ed->shared_info;
    13.8 +    shared_info_t *s = d->shared_info;
    13.9      int            running;
   13.10  
   13.11      /* These three operations must happen in strict order. */
   13.12 @@ -32,7 +32,7 @@ static inline void evtchn_set_pending(st
   13.13           !test_and_set_bit(port>>5, &s->evtchn_pending_sel) )
   13.14      {
   13.15          /* The VCPU pending flag must be set /after/ update to evtchn-pend. */
   13.16 -        set_bit(0, &s->vcpu_data[0].evtchn_upcall_pending);
   13.17 +        set_bit(0, &ed->vcpu_info->evtchn_upcall_pending);
   13.18  
   13.19          /*
   13.20           * NB1. 'flags' and 'processor' must be checked /after/ update of
   13.21 @@ -72,7 +72,7 @@ static inline void send_guest_pirq(struc
   13.22  }
   13.23  
   13.24  #define event_pending(_d)                                     \
   13.25 -    ((_d)->shared_info->vcpu_data[0].evtchn_upcall_pending && \
   13.26 -     !(_d)->shared_info->vcpu_data[0].evtchn_upcall_mask)
   13.27 +    ((_d)->vcpu_info->evtchn_upcall_pending && \
   13.28 +     !(_d)->vcpu_info->evtchn_upcall_mask)
   13.29  
   13.30  #endif /* __XEN_EVENT_H__ */
    14.1 --- a/xen/include/xen/sched.h	Tue Nov 09 10:52:02 2004 +0000
    14.2 +++ b/xen/include/xen/sched.h	Tue Nov 09 11:35:28 2004 +0000
    14.3 @@ -63,7 +63,7 @@ struct exec_domain
    14.4      u32 processor;               /* 00: current processor */
    14.5  
    14.6      /* An unsafe pointer into a shared data area. */
    14.7 -    shared_info_t *shared_info;  /* 04: shared data area */
    14.8 +    vcpu_info_t *vcpu_info;      /* 04: vcpu info pointer */
    14.9  
   14.10      /*
   14.11       * Return vectors pushed to us by guest OS.
   14.12 @@ -106,6 +106,8 @@ struct domain {
   14.13      domid_t  id;
   14.14      s_time_t create_time;
   14.15  
   14.16 +    shared_info_t *shared_info;       /* shared data area */
   14.17 +
   14.18      spinlock_t       page_alloc_lock; /* protects all the following fields  */
   14.19      struct list_head page_list;       /* linked list, of size tot_pages     */
   14.20      struct list_head xenpage_list;    /* linked list, of size xenheap_pages */