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

[Xen-changelog] [xen master] x86/shadow: sh_pagetable_dying() cleanup



commit 3b34170522fa711e955d71b0110cacda96a316b0
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jun 9 15:49:16 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jun 9 15:49:16 2016 +0200

    x86/shadow: sh_pagetable_dying() cleanup
    
    Don't call shadow_hash_lookup() at all when get_gfn_query_unlocked()
    didn't return a valid MFN.
    
    Also no need for local variables used only once, the more with scopes
    much wider than their actual use.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/arch/x86/mm/shadow/multi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 428be37..dfe59a2 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -4501,7 +4501,6 @@ static void sh_pagetable_dying(struct vcpu *v, paddr_t 
gpa)
     p2m_type_t p2mt;
     char *gl3pa = NULL;
     guest_l3e_t *gl3e = NULL;
-    paddr_t gl2a = 0;
     unsigned long l3gfn;
     mfn_t l3mfn;
 
@@ -4528,7 +4527,6 @@ static void sh_pagetable_dying(struct vcpu *v, paddr_t 
gpa)
     }
     for ( i = 0; i < 4; i++ )
     {
-        unsigned long gfn;
         mfn_t smfn, gmfn;
 
         if ( fast_path ) {
@@ -4540,10 +4538,11 @@ static void sh_pagetable_dying(struct vcpu *v, paddr_t 
gpa)
         else
         {
             /* retrieving the l2s */
-            gl2a = guest_l3e_get_paddr(gl3e[i]);
-            gfn = gl2a >> PAGE_SHIFT;
-            gmfn = get_gfn_query_unlocked(d, gfn, &p2mt);
-            smfn = shadow_hash_lookup(d, mfn_x(gmfn), SH_type_l2_pae_shadow);
+            gmfn = get_gfn_query_unlocked(d, gfn_x(guest_l3e_get_gfn(gl3e[i])),
+                                          &p2mt);
+            smfn = unlikely(mfn_x(gmfn) == INVALID_MFN)
+                   ? _mfn(INVALID_MFN)
+                   : shadow_hash_lookup(d, mfn_x(gmfn), SH_type_l2_pae_shadow);
         }
 
         if ( mfn_valid(smfn) )
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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