[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.13] x86/vpt: fully init timers before putting onto list



commit 84bc28f8fa4b9c18107f8704257bab34190998b3
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jul 15 09:40:29 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 15 09:40:29 2021 +0200

    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 <igor.druzhinin@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    master commit: 6d622f3a96bbd76ce8422c6e3805e6609417ec76
    master date: 2021-06-15 15:14:20 +0200
---
 xen/arch/x86/hvm/vpt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index a644e3ce53..af92dfbae2 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -553,14 +553,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);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.