direct-io.hg

changeset 4847:e70ba984a87f

bitkeeper revision 1.1389.15.11 (428212beixWz2Ftz7Wj0NeY03LmBnA)

sched.h, dom0_ops.h, dom0_ops.c, xc_domain.c, xc.h:
Minor cleanups.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk[cl349]
date Wed May 11 14:12:14 2005 +0000 (2005-05-11)
parents 28e8f35313bb
children 3ac0994c8240
files tools/libxc/xc.h tools/libxc/xc_domain.c xen/common/dom0_ops.c xen/include/public/dom0_ops.h xen/include/xen/sched.h
line diff
     1.1 --- a/tools/libxc/xc.h	Wed May 11 13:04:09 2005 +0000
     1.2 +++ b/tools/libxc/xc.h	Wed May 11 14:12:14 2005 +0000
     1.3 @@ -119,7 +119,7 @@ typedef struct {
     1.4      unsigned long shared_info_frame;
     1.5      u64           cpu_time;
     1.6      unsigned long max_memkb;
     1.7 -    u32           vcpu_to_cpu[MAX_VIRT_CPUS];
     1.8 +    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
     1.9      cpumap_t      cpumap[MAX_VIRT_CPUS];
    1.10  } xc_dominfo_t;
    1.11  
     2.1 --- a/tools/libxc/xc_domain.c	Wed May 11 13:04:09 2005 +0000
     2.2 +++ b/tools/libxc/xc_domain.c	Wed May 11 14:12:14 2005 +0000
     2.3 @@ -17,7 +17,7 @@ int xc_domain_create(int xc_handle,
     2.4      int err, errno_saved;
     2.5      dom0_op_t op;
     2.6      u32 vcpu = 0; /* FIXME, hard coded initial pin to vcpu 0 */
     2.7 -    cpumap_t cpumap = 1<<cpu;
     2.8 +    cpumap_t cpumap = 1 << cpu;
     2.9  
    2.10      op.cmd = DOM0_CREATEDOMAIN;
    2.11      op.u.createdomain.domain = (domid_t)*pdomid;
    2.12 @@ -137,10 +137,10 @@ int xc_domain_getinfo(int xc_handle,
    2.13          info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
    2.14          info->cpu_time = op.u.getdomaininfo.cpu_time;
    2.15          info->vcpus = op.u.getdomaininfo.n_vcpu;
    2.16 -        memcpy(info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu, 
    2.17 -               MAX_VIRT_CPUS*sizeof(u32));
    2.18 -        memcpy(info->cpumap, &op.u.getdomaininfo.cpumap, 
    2.19 -               MAX_VIRT_CPUS*sizeof(cpumap_t));
    2.20 +        memcpy(&info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu, 
    2.21 +               sizeof(info->vcpu_to_cpu));
    2.22 +        memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap, 
    2.23 +               sizeof(info->cpumap));
    2.24  
    2.25          next_domid = (u16)op.u.getdomaininfo.domain + 1;
    2.26          info++;
     3.1 --- a/xen/common/dom0_ops.c	Wed May 11 13:04:09 2005 +0000
     3.2 +++ b/xen/common/dom0_ops.c	Wed May 11 14:12:14 2005 +0000
     3.3 @@ -221,7 +221,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
     3.4          domid_t dom = op->u.pincpudomain.domain;
     3.5          struct domain *d = find_domain_by_id(dom);
     3.6          struct exec_domain *ed;
     3.7 -        cpumap_t curmap, *cpumap = &curmap;
     3.8 +        cpumap_t cpumap;
     3.9  
    3.10  
    3.11          if ( d == NULL )
    3.12 @@ -253,8 +253,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    3.13              break;
    3.14          }
    3.15  
    3.16 -        if ( copy_from_user(cpumap, 
    3.17 -                            op->u.pincpudomain.cpumap, sizeof(*cpumap)) )
    3.18 +        if ( copy_from_user(&cpumap, op->u.pincpudomain.cpumap,
    3.19 +                            sizeof(cpumap)) )
    3.20          {
    3.21              ret = -EFAULT;
    3.22              put_domain(d);
    3.23 @@ -262,14 +262,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    3.24          }
    3.25  
    3.26          /* update cpumap for this ed */
    3.27 -        ed->cpumap = *(cpumap);
    3.28 +        ed->cpumap = cpumap;
    3.29  
    3.30 -        if ( *(cpumap) == CPUMAP_RUNANYWHERE )
    3.31 +        if ( cpumap == CPUMAP_RUNANYWHERE )
    3.32              clear_bit(EDF_CPUPINNED, &ed->flags);
    3.33          else
    3.34          {
    3.35              /* pick a new cpu from the usable map */
    3.36 -            int new_cpu = (int)find_first_set_bit(*(cpumap)) % smp_num_cpus;
    3.37 +            int new_cpu = (int)find_first_set_bit(cpumap) % smp_num_cpus;
    3.38  
    3.39              exec_domain_pause(ed);
    3.40              if ( ed->processor != new_cpu )
    3.41 @@ -329,7 +329,10 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    3.42              break;
    3.43          }
    3.44          
    3.45 -        memset(&op->u.getdomaininfo.vcpu_to_cpu,-1,MAX_VIRT_CPUS*sizeof(u8));
    3.46 +        memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
    3.47 +               sizeof(op->u.getdomaininfo.vcpu_to_cpu));
    3.48 +        memset(&op->u.getdomaininfo.cpumap, 0,
    3.49 +               sizeof(op->u.getdomaininfo.cpumap));
    3.50          for_each_exec_domain ( d, ed ) {
    3.51              op->u.getdomaininfo.vcpu_to_cpu[ed->id] = ed->processor;
    3.52              op->u.getdomaininfo.cpumap[ed->id]      = ed->cpumap;
     4.1 --- a/xen/include/public/dom0_ops.h	Wed May 11 13:04:09 2005 +0000
     4.2 +++ b/xen/include/public/dom0_ops.h	Wed May 11 14:12:14 2005 +0000
     4.3 @@ -89,7 +89,7 @@ typedef struct {
     4.4      memory_t shared_info_frame;       /* MFN of shared_info struct */
     4.5      u64      cpu_time;
     4.6      u32      n_vcpu;
     4.7 -    u32      vcpu_to_cpu[MAX_VIRT_CPUS];  /* current mapping   */
     4.8 +    s32      vcpu_to_cpu[MAX_VIRT_CPUS];  /* current mapping   */
     4.9      cpumap_t cpumap[MAX_VIRT_CPUS];       /* allowable mapping */
    4.10  } dom0_getdomaininfo_t;
    4.11  
     5.1 --- a/xen/include/xen/sched.h	Wed May 11 13:04:09 2005 +0000
     5.2 +++ b/xen/include/xen/sched.h	Wed May 11 14:12:14 2005 +0000
     5.3 @@ -58,8 +58,8 @@ int  init_event_channels(struct domain *
     5.4  void destroy_event_channels(struct domain *d);
     5.5  int  init_exec_domain_event_channels(struct exec_domain *ed);
     5.6  
     5.7 +#define CPUMAP_RUNANYWHERE 0xFFFFFFFF
     5.8  
     5.9 -#define CPUMAP_RUNANYWHERE 0xFFFFFFFF
    5.10  struct exec_domain 
    5.11  {
    5.12      int              id;
    5.13 @@ -86,7 +86,7 @@ struct exec_domain
    5.14  
    5.15      atomic_t         pausecnt;
    5.16  
    5.17 -    cpumap_t  cpumap;               /* which cpus this domain can run on */
    5.18 +    cpumap_t         cpumap;        /* which cpus this domain can run on */
    5.19  
    5.20      struct arch_exec_domain arch;
    5.21  };