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

[xen staging] evtchn: don't pointlessly use get_domain()



commit 65f98b8c31d77d73a86c33daa33980a01daad88c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 27 08:46:27 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 27 08:46:27 2021 +0100

    evtchn: don't pointlessly use get_domain()
    
    For short-lived references rcu_lock_domain() is the better (slightly
    cheaper) alternative.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/common/event_channel.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index d590ddad99..c94ea74b12 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -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);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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