From: Jan Beulich Date: Wed, 27 Jan 2021 07:46:27 +0000 (+0100) Subject: evtchn: don't pointlessly use get_domain() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=65f98b8c31d77d73a86c33daa33980a01daad88c;p=people%2Fdariof%2Fxen.git 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 Acked-by: Andrew Cooper --- 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);