From: Juergen Gross Date: Thu, 19 Aug 2021 11:38:31 +0000 (+0200) Subject: xen/sched: fix get_cpu_idle_time() for smt=0 suspend/resume X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~275 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5293470a77ad980dce2af9b7e6c3f11eeebf1b64;p=xen.git xen/sched: fix get_cpu_idle_time() for smt=0 suspend/resume With smt=0 during a suspend/resume cycle of the machine the threads which have been parked before will briefly come up again. This can result in problems e.g. with cpufreq driver being active as this will call into get_cpu_idle_time() for a cpu without initialized scheduler data. Fix that by letting get_cpu_idle_time() deal with this case. Drop a redundant check in exchange. Fixes: 132cbe8f35632fb2 ("sched: fix get_cpu_idle_time() with core scheduling") Reported-by: Marek Marczykowski-Górecki Signed-off-by: Juergen Gross Tested-by: Marek Marczykowski-Górecki Reviewed-by: Jan Beulich Acked-by: Dario Faggioli --- diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 6d34764d38..8d178baf3d 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -337,7 +337,7 @@ uint64_t get_cpu_idle_time(unsigned int cpu) struct vcpu_runstate_info state = { 0 }; const struct vcpu *v = idle_vcpu[cpu]; - if ( cpu_online(cpu) && v ) + if ( cpu_online(cpu) && get_sched_res(cpu) ) vcpu_runstate_get(v, &state); return state.time[RUNSTATE_running];