From: Jan Beulich Date: Tue, 15 Jun 2021 13:14:20 +0000 (+0200) Subject: x86/vpt: fully init timers before putting onto list X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~433 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6d622f3a96bbd76ce8422c6e3805e6609417ec76;p=xen.git x86/vpt: fully init timers before putting onto list With pt_vcpu_lock() no longer acquiring the pt_migrate lock, parties iterating the list and acting on the timers of the list entries will no longer be kept from entering their loops by create_periodic_time()'s holding of that lock. Therefore at least init_timer() needs calling ahead of list insertion, but keep this and set_timer() together. Fixes: 8113b02f0bf8 ("x86/vpt: do not take pt_migrate rwlock in some cases") Reported-by: Igor Druzhinin Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Reviewed-by: Boris Ostrovsky --- diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c index 4cc0a0848b..6fdc3e19fe 100644 --- a/xen/arch/x86/hvm/vpt.c +++ b/xen/arch/x86/hvm/vpt.c @@ -554,14 +554,14 @@ void create_periodic_time( pt->cb = cb; pt->priv = data; + init_timer(&pt->timer, pt_timer_fn, pt, v->processor); + set_timer(&pt->timer, pt->scheduled); + pt_vcpu_lock(v); pt->on_list = 1; list_add(&pt->list, &v->arch.hvm.tm_list); pt_vcpu_unlock(v); - init_timer(&pt->timer, pt_timer_fn, pt, v->processor); - set_timer(&pt->timer, pt->scheduled); - write_unlock(&v->domain->arch.hvm.pl_time->pt_migrate); }