ia64/xen-unstable

changeset 2750:d787d8fcc4d3

bitkeeper revision 1.1159.1.288 (417fa37aiUr7WWjaJDqszVX8RYOFGA)

Tiny bug fixes and cleanups.
author kaf24@freefall.cl.cam.ac.uk
date Wed Oct 27 13:32:42 2004 +0000 (2004-10-27)
parents f985db0a10f6
children 35abe76a49b1
files tools/libxc/xc_linux_build.c xen/common/dom0_ops.c xen/common/domain.c
line diff
     1.1 --- a/tools/libxc/xc_linux_build.c	Wed Oct 27 11:06:15 2004 +0000
     1.2 +++ b/tools/libxc/xc_linux_build.c	Wed Oct 27 13:32:42 2004 +0000
     1.3 @@ -522,7 +522,7 @@ int xc_linux_build(int xc_handle,
     1.4      ctxt->cpu_ctxt.ss = FLAT_GUESTOS_DS;
     1.5      ctxt->cpu_ctxt.cs = FLAT_GUESTOS_CS;
     1.6      ctxt->cpu_ctxt.eip = vkern_entry;
     1.7 -    ctxt->cpu_ctxt.esp = vstartinfo_start;
     1.8 +    ctxt->cpu_ctxt.esp = vstartinfo_start + 2*PAGE_SIZE;
     1.9      ctxt->cpu_ctxt.esi = vstartinfo_start;
    1.10      ctxt->cpu_ctxt.eflags = (1<<9) | (1<<2);
    1.11  
    1.12 @@ -545,7 +545,7 @@ int xc_linux_build(int xc_handle,
    1.13  
    1.14      /* Ring 1 stack is the initial stack. */
    1.15      ctxt->guestos_ss  = FLAT_GUESTOS_DS;
    1.16 -    ctxt->guestos_esp = vstartinfo_start;
    1.17 +    ctxt->guestos_esp = vstartinfo_start + 2*PAGE_SIZE;
    1.18  
    1.19      /* No debugging. */
    1.20      memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
     2.1 --- a/xen/common/dom0_ops.c	Wed Oct 27 11:06:15 2004 +0000
     2.2 +++ b/xen/common/dom0_ops.c	Wed Oct 27 13:32:42 2004 +0000
     2.3 @@ -100,14 +100,10 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     2.4          return -EPERM;
     2.5  
     2.6      if ( copy_from_user(op, u_dom0_op, sizeof(*op)) )
     2.7 -    {
     2.8          return -EFAULT;
     2.9 -    }
    2.10  
    2.11      if ( op->interface_version != DOM0_INTERFACE_VERSION )
    2.12 -    {
    2.13          return -EACCES;
    2.14 -    }
    2.15  
    2.16      TRACE_5D(TRC_DOM0OP_ENTER_BASE + op->cmd, 
    2.17               0, op->u.dummy[0], op->u.dummy[1], 
    2.18 @@ -164,9 +160,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    2.19  
    2.20      case DOM0_CREATEDOMAIN:
    2.21      {
    2.22 -        struct domain    *d;
    2.23 -        unsigned int      pro;
    2.24 -        domid_t           dom;
    2.25 +        struct domain *d;
    2.26 +        unsigned int   pro = 0;
    2.27 +        domid_t        dom;
    2.28  
    2.29          dom = op->u.createdomain.domain;
    2.30          if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
    2.31 @@ -179,29 +175,20 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    2.32              break;
    2.33  
    2.34          if ( op->u.createdomain.cpu == -1 )
    2.35 -	{
    2.36 -	    /* Do an initial placement. Fix me for hyperthreading! */
    2.37 -	    struct domain    *d;
    2.38 -	    int i, j=0, c[smp_num_cpus];
    2.39 -	    
    2.40 -	    pro=0; /* keep compiler happy */
    2.41 -
    2.42 -	    for (i=0;i<smp_num_cpus;i++) 
    2.43 -		c[i]=0;
    2.44 +        {
    2.45 +            /* Do an initial placement. Pick the least-populated CPU. */
    2.46 +            struct domain *d;
    2.47 +            unsigned int i, cnt[NR_CPUS] = { 0 };
    2.48  
    2.49 -	    for_each_domain ( d ) {
    2.50 -		c[d->processor]++;
    2.51 -		j++;
    2.52 -	    }
    2.53 +            read_lock_irq(&tasklist_lock);
    2.54 +            for_each_domain ( d )
    2.55 +                cnt[d->processor]++;
    2.56 +            read_unlock_irq(&tasklist_lock);
    2.57  
    2.58 -	    for (i=0;i<smp_num_cpus;i++) {
    2.59 -		if( c[i]<j )
    2.60 -		{
    2.61 -		    j = c[i];
    2.62 -		    pro = i;
    2.63 -		}
    2.64 -	    }
    2.65 -	}
    2.66 +            for ( i = 0; i < smp_num_cpus; i++ )
    2.67 +                if ( cnt[i] < cnt[pro] )
    2.68 +                    pro = i;
    2.69 +        }
    2.70          else
    2.71              pro = op->u.createdomain.cpu % smp_num_cpus;
    2.72  
    2.73 @@ -624,9 +611,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    2.74                          break;
    2.75                      }
    2.76  
    2.77 -		    if ( page->u.inuse.type_info & PGT_pinned )
    2.78 -			type |= LPINTAB;
    2.79 -		    l_arr[j] |= type;
    2.80 +                    if ( page->u.inuse.type_info & PGT_pinned )
    2.81 +                        type |= LPINTAB;
    2.82 +                    l_arr[j] |= type;
    2.83                      put_page(page);
    2.84                  }
    2.85                  else
    2.86 @@ -657,7 +644,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    2.87          d = find_domain_by_id( op->u.setdomainmaxmem.domain );
    2.88          if ( d != NULL )
    2.89          {
    2.90 -	    vm_assist(d, op->u.setdomainvmassist.cmd,
    2.91 +            vm_assist(d, op->u.setdomainvmassist.cmd,
    2.92                        op->u.setdomainvmassist.type);
    2.93              put_domain(d);
    2.94              ret = 0;
     3.1 --- a/xen/common/domain.c	Wed Oct 27 11:06:15 2004 +0000
     3.2 +++ b/xen/common/domain.c	Wed Oct 27 13:32:42 2004 +0000
     3.3 @@ -168,12 +168,12 @@ void domain_shutdown(u8 reason)
     3.4  
     3.5          if ( reason == 0 ) 
     3.6          {
     3.7 -            printk("Domain 0 halted: Our work here is done.\n");
     3.8 +            printk("Domain 0 halted: halting machine.\n");
     3.9              machine_halt();
    3.10          }
    3.11          else
    3.12          {
    3.13 -            printk("Domain 0 shutdown: rebooting machine!\n");
    3.14 +            printk("Domain 0 shutdown: rebooting machine.\n");
    3.15              machine_restart(0);
    3.16          }
    3.17      }
    3.18 @@ -207,15 +207,6 @@ unsigned int alloc_new_dom_mem(struct do
    3.19  
    3.20          /* initialise to machine_to_phys_mapping table to likely pfn */
    3.21          machine_to_phys_mapping[page-frame_table] = alloc_pfns;
    3.22 -
    3.23 -#ifndef NDEBUG
    3.24 -        {
    3.25 -            /* Initialise with magic marker if in DEBUG mode. */
    3.26 -            void *a = map_domain_mem((page-frame_table)<<PAGE_SHIFT);
    3.27 -            memset(a, 0x80 | (char)d->id, PAGE_SIZE);
    3.28 -            unmap_domain_mem(a);
    3.29 -        }
    3.30 -#endif
    3.31      }
    3.32  
    3.33      return 0;