diff options
-rw-r--r-- | xen/arch/x86/platform_hypercall.c | 8 | ||||
-rw-r--r-- | xen/common/schedule.c | 9 |
2 files changed, 10 insertions, 7 deletions
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 7175a82658..2162811300 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -355,10 +355,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op) for_each_cpu ( cpu, cpumap ) { - if ( idle_vcpu[cpu] == NULL ) - cpumask_clear_cpu(cpu, cpumap); idletime = get_cpu_idle_time(cpu); + if ( !idletime ) + { + cpumask_clear_cpu(cpu, cpumap); + continue; + } + if ( copy_to_guest_offset(idletimes, cpu, &idletime, 1) ) { ret = -EFAULT; diff --git a/xen/common/schedule.c b/xen/common/schedule.c index a8398bd9ed..1ddfb22df6 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -176,13 +176,12 @@ void vcpu_runstate_get(struct vcpu *v, struct vcpu_runstate_info *runstate) uint64_t get_cpu_idle_time(unsigned int cpu) { - struct vcpu_runstate_info state; - struct vcpu *v; + struct vcpu_runstate_info state = { 0 }; + struct vcpu *v = idle_vcpu[cpu]; - if ( (v = idle_vcpu[cpu]) == NULL ) - return 0; + if ( cpu_online(cpu) && v ) + vcpu_runstate_get(v, &state); - vcpu_runstate_get(v, &state); return state.time[RUNSTATE_running]; } |