ia64/xen-unstable

changeset 15453:b370047d0fa0

Small sysctl cleanups.
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Wed Jun 27 21:27:51 2007 +0100 (2007-06-27)
parents f152e44325a7
children 806dc0aca747
files xen/common/schedule.c xen/common/sysctl.c xen/include/public/sysctl.h
line diff
     1.1 --- a/xen/common/schedule.c	Wed Jun 27 21:05:54 2007 +0100
     1.2 +++ b/xen/common/schedule.c	Wed Jun 27 21:27:51 2007 +0100
     1.3 @@ -72,12 +72,8 @@ static inline void vcpu_runstate_change(
     1.4      ASSERT(v->runstate.state != new_state);
     1.5      ASSERT(spin_is_locked(&per_cpu(schedule_data,v->processor).schedule_lock));
     1.6  
     1.7 -    if(unlikely((v->runstate.state_entry_time - new_entry_time) > TIME_SLOP))
     1.8 -        /* Local time on this CPU has been warped */
     1.9 -        v->runstate.time[v->runstate.state] = new_entry_time; 
    1.10 -    else 
    1.11 -        v->runstate.time[v->runstate.state] +=
    1.12 -            new_entry_time - v->runstate.state_entry_time;
    1.13 +    v->runstate.time[v->runstate.state] +=
    1.14 +        new_entry_time - v->runstate.state_entry_time;
    1.15      v->runstate.state_entry_time = new_entry_time;
    1.16      v->runstate.state = new_state;
    1.17  }
     2.1 --- a/xen/common/sysctl.c	Wed Jun 27 21:05:54 2007 +0100
     2.2 +++ b/xen/common/sysctl.c	Wed Jun 27 21:27:51 2007 +0100
     2.3 @@ -140,19 +140,20 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
     2.4      {
     2.5          uint32_t i, nr_cpus;
     2.6          uint64_t idletime;
     2.7 +        struct vcpu *v;
     2.8  
     2.9 -        nr_cpus = (op->u.cpuinfo.max_cpus > NR_CPUS) ? NR_CPUS :
    2.10 -            op->u.cpuinfo.max_cpus;
    2.11 +        nr_cpus = min_t(uint32_t, op->u.cpuinfo.max_cpus, NR_CPUS);
    2.12  
    2.13          for ( i = 0; i < nr_cpus; i++ )
    2.14          {
    2.15 -            if(!idle_vcpu[i])
    2.16 -                /* XXX: assumes no further CPUs after first missing one */
    2.17 +            /* Assume no holes in idle-vcpu map. */
    2.18 +            if ( (v = idle_vcpu[i]) == NULL )
    2.19                  break;
    2.20  
    2.21 -            /* somewhat imprecise but should suffice */
    2.22 -            idletime = idle_vcpu[i]->runstate.time[RUNSTATE_running] +
    2.23 -                (NOW() - idle_vcpu[i]->runstate.state_entry_time);
    2.24 +            idletime = v->runstate.time[RUNSTATE_running];
    2.25 +            if ( v->is_running )
    2.26 +                idletime += NOW() - v->runstate.state_entry_time;
    2.27 +
    2.28              if ( copy_to_guest_offset(op->u.cpuinfo.buffer, i, &idletime, 1) )
    2.29              {
    2.30                  ret = -EFAULT;
    2.31 @@ -163,7 +164,7 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysc
    2.32          op->u.cpuinfo.nr_cpus = i;
    2.33          ret = 0;
    2.34  
    2.35 -        if( copy_to_guest (u_sysctl, op, 1) )
    2.36 +        if ( copy_to_guest(u_sysctl, op, 1) )
    2.37              ret = -EFAULT;
    2.38      }
    2.39      break;
     3.1 --- a/xen/include/public/sysctl.h	Wed Jun 27 21:05:54 2007 +0100
     3.2 +++ b/xen/include/public/sysctl.h	Wed Jun 27 21:27:51 2007 +0100
     3.3 @@ -158,7 +158,7 @@ struct xen_sysctl_cpuinfo {
     3.4      /* IN variables. */
     3.5      uint32_t                      max_cpus;
     3.6      XEN_GUEST_HANDLE_64(uint64_t) buffer;
     3.7 -    /* IN/OUT variables. */
     3.8 +    /* OUT variables. */
     3.9      uint32_t                      nr_cpus;
    3.10  }; 
    3.11  typedef struct xen_sysctl_cpuinfo xen_sysctl_cpuinfo_t;