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

[PATCH 3/6] xen/gnttab: Remove explicit rcu_lock_current_domain()



rcu_lock_current_domain() is always a nop, while rcu_unlock_domain() is not.

GNTTAB ops swap_grant_ref and cache_flush are the only two paths in Xen which
explicitly RCU lock themselves.  Drop this behaviour.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
CC: Michal Orzel <michal.orzel@xxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
CC: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
CC: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>
---
 xen/common/grant_table.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index d42bd5fb83fd..f4ec7524140a 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -3498,7 +3498,7 @@ 
gnttab_get_version(XEN_GUEST_HANDLE_PARAM(gnttab_get_version_t) uop)
 static int16_t
 swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
 {
-    struct domain *d = rcu_lock_current_domain();
+    struct domain *d = current->domain;
     struct grant_table *gt = d->grant_table;
     struct active_grant_entry *act_a = NULL;
     struct active_grant_entry *act_b = NULL;
@@ -3573,8 +3573,6 @@ swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
         active_entry_release(act_a);
     grant_write_unlock(gt);
 
-    rcu_unlock_domain(d);
-
     return rc;
 }
 
@@ -3622,22 +3620,16 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
     if ( cflush->op & GNTTAB_CACHE_SOURCE_GREF )
         return -EOPNOTSUPP;
 
-    d = rcu_lock_current_domain();
+    d = current->domain;
     mfn = maddr_to_mfn(cflush->a.dev_bus_addr);
 
     if ( !mfn_valid(mfn) )
-    {
-        rcu_unlock_domain(d);
         return -EINVAL;
-    }
 
     page = mfn_to_page(mfn);
     owner = page_get_owner_and_reference(page);
     if ( !owner )
-    {
-        rcu_unlock_domain(d);
         return -EPERM;
-    }
 
     if ( d != owner )
     {
@@ -3647,7 +3639,6 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
         if ( IS_ERR_OR_NULL(act) )
         {
             grant_read_unlock(owner->grant_table);
-            rcu_unlock_domain(d);
             put_page(page);
             return act ? PTR_ERR(act) : 1;
         }
@@ -3691,7 +3682,6 @@ static int _cache_flush(gnttab_cache_flush_t *cflush, 
grant_ref_t *cur_ref)
 
     unmap_domain_page(v);
     put_page(page);
-    rcu_unlock_domain(d);
 
     return ret;
 }
-- 
2.39.5




 


Rackspace

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