Skip to contentSkip to conversation

x86/alt: Fix build when CONFIG_LIVEPATCH is disabled

PATCH In review Andrew Cooper 4 participants 4 messages Aug 29, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Ross Lagerwall <[email protected]>

---
 xen/arch/x86/alternative.c  | 2 +-
 xen/include/xen/livepatch.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
xen/arch/x86/alternative.c +1 -1
index ea835d9..1ae4923 100644
@@ -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
xen/include/xen/livepatch.h +2 -0
index 98ec012..1b1817c 100644
@@ -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)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 29.08.18 at 12:57, <[email protected]> wrote:

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

Quoted 5 lines

Introduce init_or_livepatch_read_mostly and switch the annotation for toolchain_nops_are_ideal.

(I've just run into this as well.)

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

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

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

Quoted 5 lines

Introduce init_or_livepatch_read_mostly and switch the annotation for toolchain_nops_are_ideal.

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

#3 lore raw
Quoted 12 lines · Wei Liu
Quoted 11 lines · Andrew Cooper

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

Quoted 7 lines
Quoted 5 lines

Introduce init_or_livepatch_read_mostly and switch the annotation for toolchain_nops_are_ideal.

Thank you!

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