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

[Xen-changelog] [xen master] x86: generate labels at the beginning of unlikely sub-sections



commit d4ae1c999171bceb0649956047f814e1996391a4
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Dec 15 14:15:43 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 15 14:15:43 2015 +0100

    x86: generate labels at the beginning of unlikely sub-sections
    
    This is to limit symbol table growth, which would be quite a bit worse
    if we went with the "label every unlikely sub-section contribution"
    approach proposed previously.
    
    Older gas doesn't support quoted symbols, yet the result looks quite
    bit better that way. Hence two variants get introduced, one using
    proper path names (including slashes and dashes) and one using path
    names after converting them to valid symbol names (slashes and dashes
    replaced).
    
    As a secondary adjustment also change the section name used with Clang.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper@xxxxxxxxxx>
---
 xen/arch/x86/Rules.mk           |    4 ++++
 xen/include/asm-x86/asm_defns.h |   32 ++++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 5b8eaed..637d252 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -20,6 +20,7 @@ xenoprof := y
 CFLAGS += -I$(BASEDIR)/include 
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
 CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
+CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst 
$(BASEDIR)/,,$(CURDIR))/$@))'
 
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
@@ -29,6 +30,9 @@ $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-insn-check,CFLAGS,CC,"vmcall",-DHAVE_GAS_VMX)
 $(call as-insn-check,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_GAS_EPT)
 $(call as-insn-check,CFLAGS,CC,"rdfsbase %rax",-DHAVE_GAS_FSGSBASE)
+$(call as-insn-check,CFLAGS,CC,".equ \"x\"$$(comma)1", \
+                     -U__OBJECT_LABEL__ -DHAVE_GAS_QUOTED_SYM \
+                     '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$$@')
 
 x86 := y
 x86_32 := n
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/asm-x86/asm_defns.h
index 95ea21d..7cf4408 100644
--- a/xen/include/asm-x86/asm_defns.h
+++ b/xen/include/asm-x86/asm_defns.h
@@ -93,10 +93,24 @@ void ret_from_intr(void);
 
 #ifdef __ASSEMBLY__
 
+#ifdef HAVE_GAS_QUOTED_SYM
+#define SUBSECTION_LBL(tag)                        \
+        .ifndef .L.tag;                            \
+        .equ .L.tag, 1;                            \
+        .equ __stringify(__OBJECT_LABEL__.tag), .; \
+        .endif
+#else
+#define SUBSECTION_LBL(tag)                        \
+        .ifndef __OBJECT_LABEL__.tag;              \
+        __OBJECT_LABEL__.tag:;                     \
+        .endif
+#endif
+
 #define UNLIKELY_START(cond, tag) \
         .Ldispatch.tag:           \
         j##cond .Lunlikely.tag;   \
         .subsection 1;            \
+        SUBSECTION_LBL(unlikely); \
         .Lunlikely.tag:
 
 #define UNLIKELY_DISPATCH_LABEL(tag) \
@@ -141,9 +155,22 @@ void ret_from_intr(void);
 
 #else
 
+#ifdef HAVE_GAS_QUOTED_SYM
+#define SUBSECTION_LBL(tag)                                          \
+        ".ifndef .L." #tag "\n\t"                                    \
+        ".equ .L." #tag ", 1\n\t"                                    \
+        ".equ \"" __stringify(__OBJECT_LABEL__) "." #tag "\", .\n\t" \
+        ".endif"
+#else
+#define SUBSECTION_LBL(tag)                                          \
+        ".ifndef " __stringify(__OBJECT_LABEL__) "." #tag "\n\t"     \
+        __stringify(__OBJECT_LABEL__) "." #tag ":\n\t"               \
+        ".endif"
+#endif
+
 #ifdef __clang__ /* clang's builtin assember can't do .subsection */
 
-#define UNLIKELY_START_SECTION ".pushsection .fixup,\"ax\""
+#define UNLIKELY_START_SECTION ".pushsection .text.unlikely,\"ax\""
 #define UNLIKELY_END_SECTION   ".popsection"
 
 #else
@@ -155,7 +182,8 @@ void ret_from_intr(void);
 
 #define UNLIKELY_START(cond, tag)          \
         "j" #cond " .Lunlikely%=.tag;\n\t" \
-        UNLIKELY_START_SECTION "\n"        \
+        UNLIKELY_START_SECTION "\n\t"      \
+        SUBSECTION_LBL(unlikely) "\n"      \
         ".Lunlikely%=.tag:"
 
 #define UNLIKELY_END(tag)                  \
--
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®.