Skip to contentSkip to conversation

x86/mm: Drop is_guest_l3_slot() and simply callers

PATCH In review Andrew Cooper 3 participants 3 messages Aug 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Drop is_guest_l3_slot() and simply callers

With a 64bit hypervisor there are no conditional l3 slots, and this is unlikely to change moving forwards.

No functional change (as confirmed by diffing the disassembly. GCC obviously already optimised this code away.)

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/mm.c                 | 31 ++++++++-----------------------
 xen/include/asm-x86/x86_64/page.h |  1 -
 2 files changed, 8 insertions(+), 24 deletions(-)
xen/arch/x86/mm.c +8 -23
index bdba94a..b6d6ae3 100644
@@ -1557,8 +1557,7 @@ static int alloc_l3_table(struct page_info *page)
                     l3e_get_mfn(pl3e[i]),
                     PGT_l2_page_table | PGT_pae_xen_l2, d, partial, 1);
         }
-        else if ( !is_guest_l3_slot(i) ||
-                  (rc = get_page_from_l3e(pl3e[i], pfn, d, partial)) > 0 )
+        else if ( (rc = get_page_from_l3e(pl3e[i], pfn, d, partial)) > 0 )
             continue;
 
         if ( rc == -ERESTART )
@@ -1590,11 +1589,7 @@ static int alloc_l3_table(struct page_info *page)
             current->arch.old_guest_table = page;
         }
         while ( i-- > 0 )
-        {
-            if ( !is_guest_l3_slot(i) )
-                continue;
             unadjust_guest_l3e(pl3e[i], d);
-        }
     }
 
     unmap_domain_page(pl3e);
@@ -1759,16 +1754,13 @@ static int free_l3_table(struct page_info *page)
     pl3e = map_domain_page(_mfn(pfn));
 
     do {
-        if ( is_guest_l3_slot(i) )
-        {
-            rc = put_page_from_l3e(pl3e[i], pfn, partial, 0);
-            if ( rc < 0 )
-                break;
-            partial = 0;
-            if ( rc > 0 )
-                continue;
-            unadjust_guest_l3e(pl3e[i], d);
-        }
+        rc = put_page_from_l3e(pl3e[i], pfn, partial, 0);
+        if ( rc < 0 )
+            break;
+        partial = 0;
+        if ( rc > 0 )
+            continue;
+        unadjust_guest_l3e(pl3e[i], d);
     } while ( i-- );
 
     unmap_domain_page(pl3e);
@@ -2072,13 +2064,6 @@ static int mod_l3_entry(l3_pgentry_t *pl3e,
     struct domain *d = vcpu->domain;
     int rc = 0;
 
-    if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) )
-    {
-        gdprintk(XENLOG_WARNING, "L3 update in Xen-private area, slot %#lx\n",
-                 pgentry_ptr_to_slot(pl3e));
-        return -EINVAL;
-    }
-
     /*
      * Disallow updates to final L3 slot. It contains Xen mappings, and it
      * would be a pain to ensure they remain continuously valid throughout.
xen/include/asm-x86/x86_64/page.h +0 -1
index a9ba6f0..1151ce9 100644
@@ -101,7 +101,6 @@ typedef l4_pgentry_t root_pgentry_t;
     ( !is_pv_32bit_domain(_d) ||                       \
       !((_t) & PGT_pae_xen_l2) ||                      \
       ((_s) < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_d)) )
-#define is_guest_l3_slot(_s) (1)
 #define is_guest_l4_slot(_d, _s)                    \
     ( is_pv_32bit_domain(_d)                        \
       ? ((_s) == 0)                                 \
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 28.08.17 at 16:50, <[email protected]> wrote:

With a 64bit hypervisor there are no conditional l3 slots, and this is unlikely to change moving forwards.

No functional change (as confirmed by diffing the disassembly. GCC obviously already optimised this code away.)

But I think you mean "simplify" in the title.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

With a 64bit hypervisor there are no conditional l3 slots, and this is unlikely to change moving forwards.

No functional change (as confirmed by diffing the disassembly. GCC obviously already optimised this code away.)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel