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

[Xen-changelog] [xen staging] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled



commit 70c0144f924aea141574390faa5b35900e97a1a3
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Aug 29 11:55:32 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Aug 29 14:28:48 2018 +0100

    x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
    
    c/s b28cd21c3628 "x86/build: Use new .nops directive when available"
    introduced a __read_mostly boolean which is included if the toolchain 
supports
    the .nops directive.
    
    When CONFIG_LIVEPATCH is compiled out, alternative.o is expected to be a 
fully
    init module, and toolchain_nops_are_ideal trips the build system check:
    
      Error: size of alternative.o:.data.read_mostly is 0x01
      /local/xen.git/xen/Rules.mk:206: recipe for target 'alternative.init.o' 
failed
      make[3]: *** [alternative.init.o] Error 12
    
    Introduce init_or_livepatch_read_mostly and switch the annotation for
    toolchain_nops_are_ideal.
    
    Reported-by: Olaf Hering <olaf@xxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 xen/arch/x86/alternative.c  | 2 +-
 xen/include/xen/livepatch.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index ea835d98a3..1ae49239d8 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -91,7 +91,7 @@ asm ( ".pushsection .init.rodata, \"a\", @progbits\n\t"
       "toolchain_nops: .nops " __stringify(ASM_NOP_MAX) "\n\t"
       ".popsection\n\t");
 extern char toolchain_nops[ASM_NOP_MAX];
-static bool __read_mostly toolchain_nops_are_ideal;
+static bool init_or_livepatch_read_mostly toolchain_nops_are_ideal;
 
 #else
 # define toolchain_nops_are_ideal false
diff --git a/xen/include/xen/livepatch.h b/xen/include/xen/livepatch.h
index 98ec01216b..1b1817ca0d 100644
--- a/xen/include/xen/livepatch.h
+++ b/xen/include/xen/livepatch.h
@@ -23,6 +23,7 @@ struct xen_sysctl_livepatch_op;
 #define init_or_livepatch_const
 #define init_or_livepatch_constrel
 #define init_or_livepatch_data
+#define init_or_livepatch_read_mostly __read_mostly
 #define init_or_livepatch
 
 /* Convenience define for printk. */
@@ -121,6 +122,7 @@ void arch_livepatch_unmask(void);
 #define init_or_livepatch_const       __initconst
 #define init_or_livepatch_constrel    __initconstrel
 #define init_or_livepatch_data        __initdata
+#define init_or_livepatch_read_mostly __initdata
 #define init_or_livepatch             __init
 
 static inline int livepatch_op(struct xen_sysctl_livepatch_op *op)
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
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®.