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

[xen master] x86/PV: fold exit paths of ptwr_do_page_fault()



commit 0fcfe9d95f8bb1d53cf68038f13bc3563020e8cd
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Sep 11 14:16:14 2020 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Sep 11 14:16:14 2020 +0200

    x86/PV: fold exit paths of ptwr_do_page_fault()
    
    One less aspect to keep an eye on for things to stay in sync.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/pv/ro-page-fault.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index 0eedb70002..556ee7ca11 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -262,29 +262,23 @@ static int ptwr_do_page_fault(struct x86_emulate_ctxt 
*ctxt,
         .pte = pte,
     };
     struct page_info *page;
-    int rc;
+    int rc = X86EMUL_UNHANDLEABLE;
 
     page = get_page_from_mfn(l1e_get_mfn(pte), current->domain);
     if ( !page )
         return X86EMUL_UNHANDLEABLE;
 
-    if ( !page_lock(page) )
+    if ( page_lock(page) )
     {
-        put_page(page);
-        return X86EMUL_UNHANDLEABLE;
-    }
+        if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_l1_page_table )
+        {
+            ctxt->data = &ptwr_ctxt;
+            rc = x86_emulate(ctxt, &ptwr_emulate_ops);
+        }
 
-    if ( (page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table )
-    {
         page_unlock(page);
-        put_page(page);
-        return X86EMUL_UNHANDLEABLE;
     }
 
-    ctxt->data = &ptwr_ctxt;
-    rc = x86_emulate(ctxt, &ptwr_emulate_ops);
-
-    page_unlock(page);
     put_page(page);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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