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

[Xen-changelog] [xen master] x86/mm: Reduce debug overhead of __virt_to_maddr()



commit f859e4a3b9088a76fe733fd0312b0922f90b85e1
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Aug 16 13:01:03 2017 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Aug 17 12:22:48 2017 +0100

    x86/mm: Reduce debug overhead of __virt_to_maddr()
    
    __virt_to_maddr() is used very frequently, but has a large footprint due to
    its assertions and comparasons.
    
    Rearange its logic to drop one assertion entirely, encoding its check in a
    second assertion (with no additional branch, and the comparason performed 
with
    a 32bit immediate rather than requiring a movabs).
    
    Bloat-o-meter net report is:
      add/remove: 0/0 grow/shrink: 1/72 up/down: 3/-2169 (-2166)
    
    along with a reduction of 32 assertion frames (895 down to 861)
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/include/asm-x86/x86_64/page.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-x86/x86_64/page.h 
b/xen/include/asm-x86/x86_64/page.h
index 947e52b..a9ba6f0 100644
--- a/xen/include/asm-x86/x86_64/page.h
+++ b/xen/include/asm-x86/x86_64/page.h
@@ -51,13 +51,16 @@ extern unsigned long xen_virt_end;
 
 static inline unsigned long __virt_to_maddr(unsigned long va)
 {
-    ASSERT(va >= XEN_VIRT_START);
     ASSERT(va < DIRECTMAP_VIRT_END);
     if ( va >= DIRECTMAP_VIRT_START )
         va -= DIRECTMAP_VIRT_START;
     else
     {
-        ASSERT(va < XEN_VIRT_END);
+        BUILD_BUG_ON(XEN_VIRT_END - XEN_VIRT_START != GB(1));
+        /* Signed, so ((long)XEN_VIRT_START >> 30) fits in an imm32. */
+        ASSERT(((long)va >> (PAGE_ORDER_1G + PAGE_SHIFT)) ==
+               ((long)XEN_VIRT_START >> (PAGE_ORDER_1G + PAGE_SHIFT)));
+
         va += xen_phys_start - XEN_VIRT_START;
     }
     return (va & ma_va_bottom_mask) |
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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