]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
evtchn: don't pointlessly use get_domain()
authorJan Beulich <jbeulich@suse.com>
Wed, 27 Jan 2021 07:46:27 +0000 (08:46 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 27 Jan 2021 07:46:27 +0000 (08:46 +0100)
For short-lived references rcu_lock_domain() is the better (slightly
cheaper) alternative.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/event_channel.c

index d590ddad995ed859de358fcf9511ad5e9b44ca17..c94ea74b121ecf483a4e63ceb9b71a3cf59a688a 100644 (file)
@@ -678,9 +678,8 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
         {
             d2 = chn1->u.interdomain.remote_dom;
 
-            /* If we unlock d1 then we could lose d2. Must get a reference. */
-            if ( unlikely(!get_domain(d2)) )
-                BUG();
+            /* If we unlock d1 then we could lose d2. */
+            rcu_lock_domain(d2);
 
             if ( d1 < d2 )
             {
@@ -737,7 +736,7 @@ int evtchn_close(struct domain *d1, int port1, bool guest)
     {
         if ( d1 != d2 )
             spin_unlock(&d2->event_lock);
-        put_domain(d2);
+        rcu_unlock_domain(d2);
     }
 
     spin_unlock(&d1->event_lock);