xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
@ 2018-08-29 10:57 Andrew Cooper
  2018-08-29 12:00 ` Jan Beulich
  2018-08-29 13:15 ` Wei Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Cooper @ 2018-08-29 10:57 UTC (permalink / raw)
  To: Xen-devel
  Cc: Wei Liu, Andrew Cooper, Ross Lagerwall, Jan Beulich,
	Roger Pau Monné

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@aepfle.de>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 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 ea835d9..1ae4923 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 98ec012..1b1817c 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)
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
  2018-08-29 10:57 [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled Andrew Cooper
@ 2018-08-29 12:00 ` Jan Beulich
  2018-08-29 13:15 ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2018-08-29 12:00 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Ross Lagerwall, Xen-devel, Wei Liu, Roger Pau Monne

>>> On 29.08.18 at 12:57, <andrew.cooper3@citrix.com> 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
> 
> Introduce init_or_livepatch_read_mostly and switch the annotation for
> toolchain_nops_are_ideal.
> 
> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

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



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
  2018-08-29 10:57 [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled Andrew Cooper
  2018-08-29 12:00 ` Jan Beulich
@ 2018-08-29 13:15 ` Wei Liu
  2018-08-29 13:25   ` Konrad Rzeszutek Wilk
  1 sibling, 1 reply; 4+ messages in thread
From: Wei Liu @ 2018-08-29 13:15 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Wei Liu, Xen-devel, Ross Lagerwall, Jan Beulich,
	Roger Pau Monné

On Wed, Aug 29, 2018 at 11:57:02AM +0100, Andrew Cooper 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
> 
> Introduce init_or_livepatch_read_mostly and switch the annotation for
> toolchain_nops_are_ideal.
> 
> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled
  2018-08-29 13:15 ` Wei Liu
@ 2018-08-29 13:25   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2018-08-29 13:25 UTC (permalink / raw)
  To: Wei Liu
  Cc: Andrew Cooper, Roger Pau Monné, Ross Lagerwall, Jan Beulich,
	Xen-devel

On Wed, Aug 29, 2018 at 02:15:12PM +0100, Wei Liu wrote:
> On Wed, Aug 29, 2018 at 11:57:02AM +0100, Andrew Cooper 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
> > 
> > Introduce init_or_livepatch_read_mostly and switch the annotation for
> > toolchain_nops_are_ideal.
> > 
> > Reported-by: Olaf Hering <olaf@aepfle.de>
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>


Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Thank you!

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-29 13:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-29 10:57 [PATCH] x86/alt: Fix build when CONFIG_LIVEPATCH is disabled Andrew Cooper
2018-08-29 12:00 ` Jan Beulich
2018-08-29 13:15 ` Wei Liu
2018-08-29 13:25   ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).