From: Jan Beulich Date: Thu, 7 Jan 2021 14:06:15 +0000 (+0100) Subject: common: don't (kind of) open-code rcu_lock_domain_by_any_id() X-Git-Tag: 4.15.0-rc1~336 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a625c335593ed8475367f91fa9746c82d927794f;p=people%2Fjgross%2Fxen.git common: don't (kind of) open-code rcu_lock_domain_by_any_id() Even more so when using rcu_lock_domain_by_id() in place of the more efficient rcu_lock_current_domain(). Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 4a48094356..3aa4189d7a 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -349,10 +349,7 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind) domid_t rdom = bind->remote_dom; long rc; - if ( rdom == DOMID_SELF ) - rdom = current->domain->domain_id; - - if ( (rd = rcu_lock_domain_by_id(rdom)) == NULL ) + if ( (rd = rcu_lock_domain_by_any_id(rdom)) == NULL ) return -ESRCH; /* Avoid deadlock by first acquiring lock of domain with smaller id. */ diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 4e86d79935..fcb308d92f 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -2568,12 +2568,6 @@ struct domain *get_pg_owner(domid_t domid) { struct domain *pg_owner = NULL, *curr = current->domain; - if ( likely(domid == DOMID_SELF) ) - { - pg_owner = rcu_lock_current_domain(); - goto out; - } - if ( unlikely(domid == curr->domain_id) ) { gdprintk(XENLOG_WARNING, "Cannot specify itself as foreign domain\n"); @@ -2591,7 +2585,7 @@ struct domain *get_pg_owner(domid_t domid) break; default: - if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL ) + if ( (pg_owner = rcu_lock_domain_by_any_id(domid)) == NULL ) gdprintk(XENLOG_WARNING, "Unknown domain d%d\n", domid); break; }