x86: Use alternative mechanism to define CLAC/STAC
v3 cover x86: Use alternative mechanism to define CLAC/STAC
This patch set ports the basic alternative mechanism from Linux to Xen and use it to define CLAC/STAC.
Version 1:
* Initial version.
Version 2:
* Use STR() as the only method for performing preprocessor stringificaion.
* Set ideal_nops to k8_nops by default.
* Make ideal_nops static and __initdata.
* Mask the lowest bit when handling relative jump in apply_alternatives().
* Move .altinstr_replacemen and altinstructions to .init section.
* Include nops.h in alternative.h.
* Some code style changes.
Version 3:
* Use __stringify() instead of STR().
* Coding style changes.
* Add ASSERT(!local_irq_is_enabled()) in the beginning of apply_alternatives().
* Remove local_irq_save()/local_irq_restore() in text_poke_early().
There are some changes related to ARM and AMD code in the first patch of this series, but I don't have ARM and AMD environment to verify it. The changes in Intel platform side have the same logic, and I verify it in Intel side.
Feng Wu (5):
Use __stringify() as the only method for performing preprocessor
stringificaion
x86: Add definitions for NOP operation
x86: Make set_nmi_callback return the old nmi callback
x86: Port the basic alternative mechanism from Linux to Xen
x86: Use alternative mechanism to define CLAC/STAC
xen/arch/x86/Makefile | 1 + xen/arch/x86/alternative.c | 213 ++++++++++++++++++++++++++++++++++++++ xen/arch/x86/bitops.c | 9 +- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/setup.c | 3 + xen/arch/x86/traps.c | 4 +- xen/arch/x86/usercopy.c | 20 ++-- xen/arch/x86/xen.lds.S | 15 +++ xen/include/asm-arm/current.h | 4 +- xen/include/asm-x86/alternative.h | 78 ++++++++++++++ xen/include/asm-x86/asm_defns.h | 23 ++-- xen/include/asm-x86/multicall.h | 115 ++++++++++---------- xen/include/asm-x86/nmi.h | 4 +- xen/include/asm-x86/nops.h | 66 ++++++++++++ xen/include/asm-x86/system.h | 9 +- xen/include/xen/config.h | 3 - 16 files changed, 475 insertions(+), 94 deletions(-) create mode 100644 xen/arch/x86/alternative.c create mode 100644 xen/include/asm-x86/alternative.h create mode 100644 xen/include/asm-x86/nops.h
Signature · 1 line
1.8.3.1
PATCH v3 1/5 Use __stringify() as the only method for performing preprocessor stringificaion
There are two ways of performing preprocessor stringificaion in the current code: __stringify() from stringify.h, and STR() from config.h. This patch consolidates down to one.
--- xen/arch/x86/bitops.c | 9 ++-- xen/arch/x86/hvm/svm/svm.c | 2 +- xen/arch/x86/usercopy.c | 20 +++---- xen/include/asm-arm/current.h | 4 +- xen/include/asm-x86/multicall.h | 115 ++++++++++++++++++++-------------------- xen/include/asm-x86/system.h | 9 ++-- xen/include/xen/config.h | 3 -- 7 files changed, 81 insertions(+), 81 deletions(-)
xen/arch/x86/bitops.c +5 -4
@@ -1,6 +1,7 @@#include <xen/bitops.h> #include <xen/lib.h> +#include <xen/stringify.h> unsigned int __find_first_bit (const unsigned long *addr,unsigned int size)
@@ -11,9 +12,9 @@ unsigned int __find_first_bit("1: xor %%eax,%%eax\n\t" /* also ensures ZF==1 if size==0 */ " repe; scas" __OS"\n\t" " je 2f\n\t" - " bsf -"STR(BITS_PER_LONG/8)"(%2),%0\n\t" + " bsf -"__stringify(BITS_PER_LONG/8)"(%2),%0\n\t"" jz 1b\n\t" - " lea -"STR(BITS_PER_LONG/8)"(%2),%2\n\t" + " lea -"__stringify(BITS_PER_LONG/8)"(%2),%2\n\t""2: sub %%ebx,%%edi\n\t" " shl $3,%%edi\n\t" " add %%edi,%%eax"
@@ -60,10 +61,10 @@ unsigned int __find_first_zero_bit(" xor %%edx,%%edx\n\t" /* also ensures ZF==1 if size==0 */ " repe; scas" __OS"\n\t" " je 2f\n\t" - " xor -"STR(BITS_PER_LONG/8)"(%2),%3\n\t" + " xor -"__stringify(BITS_PER_LONG/8)"(%2),%3\n\t"" jz 1b\n\t" " bsf %3,%0\n\t" - " lea -"STR(BITS_PER_LONG/8)"(%2),%2\n\t" + " lea -"__stringify(BITS_PER_LONG/8)"(%2),%2\n\t""2: sub %%ebx,%%edi\n\t" " shl $3,%%edi\n\t" " add %%edi,%%edx"
xen/arch/x86/hvm/svm/svm.c +1 -1
@@ -72,7 +72,7 @@ u32 svm_feature_flags;bool_t cpu_has_lmsl;#define set_segment_register (name, value) \ - asm volatile ( "movw %%ax ,%%" STR(name) "" : : "a" (value) ) + asm volatile ( "movw %%ax ,%%" __stringify(name) "" : : "a" (value) )static void svm_update_guest_efer (struct vcpu *);
xen/arch/x86/usercopy.c +10 -10
@@ -16,16 +16,16 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned n)stac (); asmvolatile ( - " cmp $"STR(2*BYTES_PER_LONG-1)",%0\n" + " cmp $"__stringify(2*BYTES_PER_LONG-1)",%0\n"" jbe 1f\n" " mov %1,%0\n" " neg %0\n" - " and $"STR(BYTES_PER_LONG-1)",%0\n" + " and $"__stringify(BYTES_PER_LONG-1)",%0\n"" sub %0,%3\n" "4: rep movsb\n" /* make 'to' address aligned */ " mov %3,%0\n" - " shr $"STR(LONG_BYTEORDER)",%0\n" - " and $"STR(BYTES_PER_LONG-1)",%3\n" + " shr $"__stringify(LONG_BYTEORDER)",%0\n" + " and $"__stringify(BYTES_PER_LONG-1)",%3\n"" .align 2,0x90\n" "0: rep movs" __OS"\n" /* as many words as possible... */ " mov %3,%0\n"
@@ -34,7 +34,7 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned n)".section .fixup,\"ax\"\n" "5: add %3,%0\n" " jmp 2b\n" - "3: lea 0(%3,%0,"STR(BYTES_PER_LONG)"),%0\n" + "3: lea 0(%3,%0,"__stringify(BYTES_PER_LONG)"),%0\n"" jmp 2b\n" ".previous\n" _ASM_EXTABLE(4b ,5b )
@@ -55,16 +55,16 @@ __copy_from_user_ll(void *to, const void __user *from, unsigned n)stac (); asmvolatile ( - " cmp $"STR(2*BYTES_PER_LONG-1)",%0\n" + " cmp $"__stringify(2*BYTES_PER_LONG-1)",%0\n"" jbe 1f\n" " mov %1,%0\n" " neg %0\n" - " and $"STR(BYTES_PER_LONG-1)",%0\n" + " and $"__stringify(BYTES_PER_LONG-1)",%0\n"" sub %0,%3\n" "4: rep; movsb\n" /* make 'to' address aligned */ " mov %3,%0\n" - " shr $"STR(LONG_BYTEORDER)",%0\n" - " and $"STR(BYTES_PER_LONG-1)",%3\n" + " shr $"__stringify(LONG_BYTEORDER)",%0\n" + " and $"__stringify(BYTES_PER_LONG-1)",%3\n"" .align 2,0x90\n" "0: rep; movs" __OS"\n" /* as many words as possible... */ " mov %3,%0\n"
@@ -73,7 +73,7 @@ __copy_from_user_ll(void *to, const void __user *from, unsigned n)".section .fixup,\"ax\"\n" "5: add %3,%0\n" " jmp 6f\n" - "3: lea 0(%3,%0,"STR(BYTES_PER_LONG)"),%0\n" + "3: lea 0(%3,%0,"__stringify(BYTES_PER_LONG)"),%0\n""6: push %0\n" " push %%" __OP"ax\n" " xor %%eax,%%eax\n"
xen/include/asm-arm/current.h +2 -2
@@ -1,12 +1,12 @@#ifndef __ARM_CURRENT_H__#define __ARM_CURRENT_H__ -#include <xen/config.h> #include <xen/percpu.h> #include <public/xen.h> #include <asm/percpu.h> #include <asm/processor.h> +#include <xen/stringify.h> #ifndef __ASSEMBLY__
@@ -34,7 +34,7 @@ static inline struct cpu_info *get_cpu_info(void)#define guest_cpu_user_regs () (&get_cpu_info()->guest_cpu_user_regs)#define switch_stack_and_jump (stack, fn) \ - asm volatile ("mov sp,%0; b " STR(fn) : : "r" (stack) : "memory" ) + asm volatile ("mov sp,%0; b " __stringify(fn) : : "r" (stack) : "memory" )#define reset_stack_and_jump (fn) switch_stack_and_jump(get_cpu_info(), fn)
xen/include/asm-x86/multicall.h +58 -57
123 lines not on this page · raw message
xen/include/asm-x86/system.h +5 -4
@@ -4,11 +4,12 @@#include <xen/lib.h> #include <xen/bitops.h> #include <asm/processor.h> +#include <xen/stringify.h> -#define read_segment_register (name) \ -({ u16 __sel; \ - asm volatile ( "movw %%" STR(name) ",%0" : "=r" (__sel) ); \ - __sel; \ +#define read_segment_register (name) \ +({ u16 __sel; \ + asm volatile ( "movw %%" __stringify(name) ",%0" : "=r" (__sel) ); \ + __sel; \ })#define wbinvd () \
xen/include/xen/config.h +0 -3
@@ -82,9 +82,6 @@#endif /* !__ASSEMBLY__ */ -#define __STR (...) #__VA_ARGS__ -#define STR (...) __STR(__VA_ARGS__) -#ifndef __ASSEMBLY__/* Turn a plain number into a C unsigned long constant. */ #define __mk_unsigned_long (x) x ## UL
Signature · 1 line
1.8.3.1
PATCH v3 2/5 x86: Add definitions for NOP operation
In reply to Feng WuThis patch adds definitions for different length of NOP operation.
--- xen/include/asm-x86/nops.h | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 xen/include/asm-x86/nops.h
xen/include/asm-x86/nops.h new file +66 -0
@@ -0,0 +1,66 @@ +#ifndef __X86_ASM_NOPS_H__ +#define __X86_ASM_NOPS_H__ + +#include <xen/config.h> + +/* +* Define nops for use with alternative(). +*/ + +/* +* Opteron 64bit nops +* 1: nop +* 2: osp nop +* 3: osp osp nop +* 4: osp osp osp nop +*/ +#define K8_NOP1 0x90 +#define K8_NOP2 0x66,K8_NOP1 +#define K8_NOP3 0x66,K8_NOP2 +#define K8_NOP4 0x66,K8_NOP3 +#define K8_NOP5 K8_NOP3,K8_NOP2 +#define K8_NOP6 K8_NOP3,K8_NOP3 +#define K8_NOP7 K8_NOP4,K8_NOP3 +#define K8_NOP8 K8_NOP4,K8_NOP4 + +/* +* P6 nops +* uses eax dependencies (Intel-recommended choice) +* 1: nop +* 2: osp nop +* 3: nopl (%eax) +* 4: nopl 0x00(%eax) +* 5: nopl 0x00(%eax,%eax,1) +* 6: osp nopl 0x00(%eax,%eax,1) +* 7: nopl 0x00000000(%eax) +* 8: nopl 0x00000000(%eax,%eax,1) +* Note: All the above are assumed to be a single instruction. +* There is kernel code that depends on this. +*/ +#define P6_NOP1 0x90 +#define P6_NOP2 0x66,0x90 +#define P6_NOP3 0x0f,0x1f,0x00 +#define P6_NOP4 0x0f,0x1f,0x40,0 +#define P6_NOP5 0x0f,0x1f,0x44,0x00,0 +#define P6_NOP6 0x66,0x0f,0x1f,0x44,0x00,0 +#define P6_NOP7 0x0f,0x1f,0x80,0,0,0,0 +#define P6_NOP8 0x0f,0x1f,0x84,0x00,0,0,0,0 + +#ifdef __ASSEMBLY__ +#define _ASM_MK_NOP (x) .byte x +#else +#define _ASM_MK_NOP (x) ".byte " __stringify(x) "\n" +#endif + +#define ASM_NOP1 _ASM_MK_NOP(K8_NOP1) +#define ASM_NOP2 _ASM_MK_NOP(K8_NOP2) +#define ASM_NOP3 _ASM_MK_NOP(K8_NOP3) +#define ASM_NOP4 _ASM_MK_NOP(K8_NOP4) +#define ASM_NOP5 _ASM_MK_NOP(K8_NOP5) +#define ASM_NOP6 _ASM_MK_NOP(K8_NOP6) +#define ASM_NOP7 _ASM_MK_NOP(K8_NOP7) +#define ASM_NOP8 _ASM_MK_NOP(K8_NOP8) + +#define ASM_NOP_MAX 8 + +#endif /* __X86_ASM_NOPS_H__ */
Signature · 1 line
1.8.3.1
PATCH v3 3/5 x86: Make set_nmi_callback return the old nmi callback
In reply to Feng WuThis patch makes set_nmi_callback return the old nmi callback, so we can set it back later.
--- xen/arch/x86/traps.c | 4 +++- xen/include/asm-x86/nmi.h | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
xen/arch/x86/traps.c +3 -1
@@ -3322,9 +3322,11 @@ void do_nmi(struct cpu_user_regs *regs) } } -void set_nmi_callback (nmi_callback_t callback) +nmi_callback_t set_nmi_callback (nmi_callback_t callback) { +nmi_callback_t old_nmi_callback = nmi_callback; nmi_callback = callback; +return old_nmi_callback; }void unset_nmi_callback (void )
xen/include/asm-x86/nmi.h +2 -2
@@ -15,9 +15,9 @@ typedef int (*nmi_callback_t)(struct cpu_user_regs *regs, int cpu);* set_nmi_callback * * Set a handler for an NMI. Only one handler may be -* set. Return 1 if the NMI was handled. +* set. Return the old nmi callback handler. */ -void set_nmi_callback (nmi_callback_t callback); +nmi_callback_t set_nmi_callback (nmi_callback_t callback);/** * unset_nmi_callback
Signature · 1 line
1.8.3.1
PATCH v3 4/5 x86: Port the basic alternative mechanism from Linux to Xen
In reply to Feng WuThis patch ports the basic alternative mechanism from Linux to Xen. With this mechanism, we can patch code based on the CPU features.
--- xen/arch/x86/Makefile | 1 + xen/arch/x86/alternative.c | 213 ++++++++++++++++++++++++++++++++++++++ xen/arch/x86/setup.c | 3 + xen/arch/x86/xen.lds.S | 15 +++ xen/include/asm-x86/alternative.h | 78 ++++++++++++++ 5 files changed, 310 insertions(+) create mode 100644 xen/arch/x86/alternative.c create mode 100644 xen/include/asm-x86/alternative.h
xen/arch/x86/Makefile +1 -0
@@ -58,6 +58,7 @@ obj-y += crash.o obj-y += tboot.o obj-y += hpet.o obj-y += xstate.o +obj-y += alternative.o obj-$(crash_debug) += gdbstub.o
xen/arch/x86/alternative.c new file +213 -0
213 lines not on this page · raw message
xen/arch/x86/setup.c +3 -0
@@ -48,6 +48,7 @@#include <asm/setup.h> #include <xen/cpu.h> #include <asm/nmi.h> +#include <asm/alternative.h> /* opt_nosmp: If true, secondary processors are ignored. */ static bool_t __initdata opt_nosmp;
@@ -1288,6 +1289,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)if ( cpu_has_fsgsbase )set_in_cr4 (X86_CR4_FSGSBASE ); +alternative_instructions (); +local_irq_enable ();pt_pci_init ();
xen/arch/x86/xen.lds.S +15 -0
@@ -105,6 +105,12 @@ SECTIONS .init.text : { _sinittext = .; *(.init.text) + /* + * Here are the replacement instructions. The linker sticks them + * as binary blobs. The .altinstructions has enough data to get + * the address and the length of them to patch the kernel safely. + */ + *(.altinstr_replacement) _einittext = .; } :text .init.data : {
@@ -120,6 +126,15 @@ SECTIONS __trampoline_seg_start = .; *(.trampoline_seg) __trampoline_seg_stop = .; + /* + * struct alt_inst entries. From the header (alternative.h): + * "Alternative instructions for different CPU types or capabilities" + * Think locking instructions on spinlocks. + */ + . = ALIGN(8); + __alt_instructions = .; + *(.altinstructions) + __alt_instructions_end = .; . = ALIGN(8); __ctors_start = .;
xen/include/asm-x86/alternative.h new file +78 -0
78 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 5/5 x86: Use alternative mechanism to define CLAC/STAC
In reply to Feng WuThis patch use alternative mechanism to define CLAC/STAC.
--- xen/include/asm-x86/asm_defns.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
xen/include/asm-x86/asm_defns.h +13 -10
@@ -10,6 +10,7 @@#include <asm/percpu.h> #include <xen/stringify.h> #include <asm/cpufeature.h> +#include <asm/alternative.h> #ifndef __ASSEMBLY__void ret_from_intr (void );
@@ -166,26 +167,28 @@ void ret_from_intr(void);#define __ASM_STAC .byte 0x0f,0x01,0xcb#ifdef __ASSEMBLY__ -#define ASM_AC (op) \ - btl $X86_FEATURE_SMAP & 31, \ - CPUINFO_FEATURE_OFFSET(X86_FEATURE_SMAP)+boot_cpu_data(%rip); \ - jnc 881f; \ - __ASM_##op; \ -881: +#define ASM_AC (op) \ + 661: ASM_NOP3; \ + .pushsection .altinstr_replacement, "ax"; \ + 662: __ASM_##op; \ + .popsection; \ + .pushsection .altinstructions, "a"; \ + altinstruction_entry 661b, 662b, X86_FEATURE_SMAP, 3, 3; \ + .popsection#define ASM_STAC ASM_AC(STAC)#define ASM_CLAC ASM_AC(CLAC)#else static inline void clac (void ) { -if (boot_cpu_has (X86_FEATURE_SMAP ) ) - asm volatile (__stringify(__ASM_CLAC) : : : "memory"); +/* Note: a barrier is implicit in alternative() */ +alternative (ASM_NOP3 ,__stringify (__ASM_CLAC),X86_FEATURE_SMAP ); }static inline void stac (void ) { -if (boot_cpu_has (X86_FEATURE_SMAP ) ) - asm volatile (__stringify(__ASM_STAC) : : : "memory"); +/* Note: a barrier is implicit in alternative() */ +alternative (ASM_NOP3 ,__stringify (__ASM_STAC),X86_FEATURE_SMAP ); }#endif
Signature · 1 line
1.8.3.1
Re: [PATCH v3 1/5] Use __stringify() as the only method for performing preprocessor stringificaion
In reply to Feng WuQuoted 4 lines
Quoted 1 line
Quoted 1 line
Feng Wu <[email protected]> 05/30/14 10:59 AM >>>
There are two ways of performing preprocessor stringificaion in the current code:
__stringify()fromstringify.h, andSTR()fromconfig.h. This patch consolidates down to one.
Looking at the changes here I'm not really sure we want this as is. Is there anything going to break in the rest of the series if this patch was left out?
Jan
Re: [PATCH v3 1/5] Use __stringify() as the only method for performing preprocessor stringificaion
Quoted 17 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, May 30, 2014 7:36 PM
To: Wu, Feng; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/5] Use__stringify()as the only method for performing preprocessor stringificaionQuoted 4 lines
Quoted 1 line
Quoted 1 line
Feng Wu <[email protected]> 05/30/14 10:59 AM >>>
There are two ways of performing preprocessor stringificaion in the current code:
__stringify()fromstringify.h, andSTR()fromconfig.h. This patch consolidates down to one.
Quoted 5 lines
Looking at the changes here I'm not really sure we want this as is. Is there anything going to break in the rest of the series if this patch was left out?
Jan
I think nothing will be broken without this patch. Andrew finds there are two different ways for handling this, and tend to unify them to one. This is the story.
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
In reply to Feng WuQuoted 38 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +37
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char *const k8_nops[ASM_NOP_MAX +1 ]__initconst = { +NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[]__initconst = { +P6_NOP1 , +P6_NOP2 , +P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , +P6_NOP8 +}; +static const unsigned char *const p6_nops[ASM_NOP_MAX +1 ]__initconst = { + NULL,
xen/arch/x86/alternative.c line 77
Quoted 10 lines
xen/arch/x86/alternative.c new file +10
-0+ p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif
The uses of __initconst together with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Jan
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 69 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xenxen/arch/x86/alternative.c
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +12
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 14 lines
xen/arch/x86/alternative.c new file +14
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[] __initconst = {xen/arch/x86/alternative.c
Quoted 10 lines
xen/arch/x86/alternative.c new file +10
-0+P6_NOP1 , +P6_NOP2 , +P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , +P6_NOP8 +}; +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] __initconst ={
xen/arch/x86/alternative.c line 77
Quoted 11 lines
xen/arch/x86/alternative.c new file +11
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif The uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Quoted 1 line
Jan
Thanks a lot for pointing this out. Do I need to do something for this?
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 68 lines
Quoted 59 lines
Quoted 1 line · On 03.06.14 at 12:13, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xenxen/arch/x86/alternative.c
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +12
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 14 lines
xen/arch/x86/alternative.c new file +14
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[] __initconst = {xen/arch/x86/alternative.c
Quoted 10 lines
xen/arch/x86/alternative.c new file +10
-0+P6_NOP1 , +P6_NOP2 , +P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , +P6_NOP8 +}; +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 9 lines
xen/arch/x86/alternative.c new file +9
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+}; +#endifThe uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Quoted 1 line
Thanks a lot for pointing this out. Do I need to do something for this?
If you're up to it, you could of course save me the time to do what I outlined above...
Jan
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 83 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:25 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 7 lines
Quoted 7 lines
Quoted 1 line · On 03.06.14 at 12:13, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 5 lines
Quoted 5 lines
[email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 1 line
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/alternative.c new file +4
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , + K8_NOP2,Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , + K8_NOP8 +}; +static const unsigned char *const k8_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 17 lines
Quoted 17 lines
{
Quoted 16 lines
xen/arch/x86/alternative.c new file +16
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[]__initconst = { +P6_NOP1 , + P6_NOP2,Quoted 8 lines
Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , + P6_NOP8 +}; +static const unsigned char *const p6_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 19 lines
Quoted 18 lines
{
xen/arch/x86/alternative.c line 77
Quoted 11 lines
xen/arch/x86/alternative.c new file +11
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif The uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Quoted 8 lines
Quoted 1 line
Thanks a lot for pointing this out. Do I need to do something for this?
If you're up to it, you could of course save me the time to do what I outlined above...
Jan
From the above you mentioned, seems we cannot use
__initconsttogether with -fPIC on
some old gcc. Do you know what is the reason, and does the problem occur with "__initdata ", "__init ", etc?
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 86 lines
Quoted 86 lines
Quoted 1 line · On 03.06.14 at 12:35, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:25 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 7 lines
Quoted 7 lines
Quoted 1 line · On 03.06.14 at 12:13, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 5 lines
Quoted 5 lines
[email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 1 line
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/alternative.c new file +4
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , + K8_NOP2,Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , + K8_NOP8 +}; +static const unsigned char *const k8_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 17 lines
Quoted 17 lines
{
Quoted 16 lines
xen/arch/x86/alternative.c new file +16
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[]__initconst = { +P6_NOP1 , + P6_NOP2,Quoted 8 lines
Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , + P6_NOP8 +}; +static const unsigned char *const p6_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 20 lines
Quoted 10 lines
{
Quoted 9 lines
xen/arch/x86/alternative.c new file +9
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+}; +#endifThe uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).Thanks a lot for pointing this out. Do I need to do something for this?
Quoted 7 lines
Quoted 2 lines
If you're up to it, you could of course save me the time to do what I outlined above...
From the above you mentioned, seems we cannot use
__initconsttogether with -fPIC on
some old gcc. Do you know what is the reason, and does the problem occur with "__initdata", "__init", etc?
The problem is only with __initconst afaict, the reason being that with -fPIC constant data with relocations doesn't get put into r/o sections (irrespective of the "const" modifier) by older gcc versions.
Jan
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 109 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:51 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 9 lines
Quoted 9 lines
Quoted 1 line · On 03.06.14 at 12:35, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:25 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 11 lines
Quoted 11 lines
[email protected]; [email protected]
Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 7 lines
Quoted 7 lines
Quoted 1 line · On 03.06.14 at 12:13, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 3 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
[email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanismfrom
Quoted 61 lines
Quoted 61 lines
Quoted 15 lines
Quoted 15 lines
Linux to Xen
xen/arch/x86/alternative.c
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +12
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char *const k8_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 17 lines
Quoted 17 lines
{
Quoted 16 lines
xen/arch/x86/alternative.c new file +16
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[]__initconst = { +P6_NOP1 , + P6_NOP2,Quoted 8 lines
Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , + P6_NOP8 +}; +static const unsigned char *const p6_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 19 lines
Quoted 18 lines
{
xen/arch/x86/alternative.c line 77
Quoted 11 lines
xen/arch/x86/alternative.c new file +11
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif The uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Thanks a lot for pointing this out. Do I need to do something for this?
If you're up to it, you could of course save me the time to do what I outlined above...
From the above you mentioned, seems we cannot use
__initconsttogetherwith
Quoted 3 lines
-fPIC on
some old gcc. Do you know what is the reason, and does the problem occur with "__initdata", "__init", etc?
Quoted 5 lines
The problem is only with
__initconstafaict, the reason being that with -fPIC constant data with relocations doesn't get put into r/o sections (irrespective of the "const" modifier) by older gcc versions.Jan
I am a little curious, from xen.lds.S, we can see both *(.init.data) and *(.init.rodata) go into section .init.data. So even we use __initconst and "const" modifier, the data is still not constant, right?
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 03.06.14 at 13:42, <[email protected]> wrote:
I am a little curious, from
xen.lds.S, we can see both *(.init.data) and *(.init.rodata) go into section .init.data.
So even we use__initconstand "const" modifier, the data is still not constant, right?
The use of the "const" modifier makes it so the compiler guarantees const-ness. But yes, this isn't being enforced at the processor level.
The same compiler issue as observed here prevents the use of __initdata for "const" objects: Some older gcc versions produce "section type conflict" warnings/errors if you try to put both const and non-const data into the same section.
Jan
Re: [PATCH v3 1/5] Use __stringify() as the only method for performing preprocessor stringificaion
In reply to Wu, FengQuoted 35 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu, Feng
Sent: Tuesday, June 03, 2014 8:43 AM
To: Jan Beulich; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v3 1/5] Use__stringify()as the only method for performing preprocessor stringificaionQuoted 8 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, May 30, 2014 7:36 PM
To: Wu, Feng; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/5] Use__stringify()as the only method forperforming
Quoted 11 lines
preprocessor stringificaion
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Feng Wu <[email protected]> 05/30/14 10:59 AM >>>
There are two ways of performing preprocessor stringificaion in the current code:
__stringify()fromstringify.h, andSTR()fromconfig.h. This patch consolidates down to one.Looking at the changes here I'm not really sure we want this as is. Is there anything going to break in the rest of the series if this patch was left out?
Quoted 8 lines
Quoted 1 line
Jan
I think nothing will be broken without this patch. Andrew finds there are two different
ways for handling this, and tend to unify them to one. This is the story.Thanks,
Feng
Andrew & Jan, do you have any final decision about this change?
Thanks,
Feng
Quoted 6 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v3 1/5] Use __stringify() as the only method for performing preprocessor stringificaion
Quoted 37 lines
Quoted 12 lines
Quoted 1 line · On 03.06.14 at 14:37, <[email protected]> wrote:
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu, Feng
Sent: Tuesday, June 03, 2014 8:43 AM
To: Jan Beulich; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v3 1/5] Use__stringify()as the only methodfor
Quoted 24 lines
performing preprocessor stringificaion
Quoted 8 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, May 30, 2014 7:36 PM
To: Wu, Feng; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/5] Use__stringify()as the only method forperforming
Quoted 10 lines
preprocessor stringificaion
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Feng Wu <[email protected]> 05/30/14 10:59 AM >>>
There are two ways of performing preprocessor stringificaion in the current code:
__stringify()fromstringify.h, andSTR()fromconfig.h. This patch consolidates down to one.Looking at the changes here I'm not really sure we want this as is. Is there anything going to break in the rest of the series if this patch was left out?
Quoted 6 lines
Quoted 1 line
I think nothing will be broken without this patch. Andrew finds there are
two
Quoted 2 lines
different
ways for handling this, and tend to unify them to one. This is the story.Andrew & Jan, do you have any final decision about this change?
As you've seen I applied the other patches in this series, but not this one. If such a cleanup was done, it should imo be done such that at the same time stringification gets dropped where pointlessly used, i.e. the set of use cases should get reduced to the bare minimum needed. And personally I have no problem gradually fading out STR() instead of doing this with a separate patch, thus reducing overall code churn.
Jan
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
In reply to Jan BeulichQuoted 69 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xenxen/arch/x86/alternative.c
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +12
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 14 lines
xen/arch/x86/alternative.c new file +14
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[] __initconst = {xen/arch/x86/alternative.c
Quoted 10 lines
xen/arch/x86/alternative.c new file +10
-0+P6_NOP1 , +P6_NOP2 , +P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , +P6_NOP8 +}; +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] __initconst ={
xen/arch/x86/alternative.c line 77
Quoted 11 lines
xen/arch/x86/alternative.c new file +11
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif The uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Quoted 1 line
Jan
BTW, is there any difference after converting alternative.o to alternative.init.o, since everything in alternative.c has already been __init__?
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
Quoted 70 lines
Quoted 61 lines
Quoted 1 line · On 03.06.14 at 15:05, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xenxen/arch/x86/alternative.c
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
xen/arch/x86/alternative.c new file +12
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , +K8_NOP2 , +K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , +K8_NOP8 +}; +static const unsigned char * const k8_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 14 lines
xen/arch/x86/alternative.c new file +14
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[] __initconst = {xen/arch/x86/alternative.c
Quoted 10 lines
xen/arch/x86/alternative.c new file +10
-0+P6_NOP1 , +P6_NOP2 , +P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , +P6_NOP8 +}; +static const unsigned char * const p6_nops[ASM_NOP_MAX+1] __initconst ={
Quoted 9 lines
xen/arch/x86/alternative.c new file +9
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+}; +#endifThe uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).
Quoted 3 lines
BTW, is there any difference after converting alternative.o to alternative.init.o, since
everything inalternative.chas already been__init__?
Yes, there is: String literals will also get moved to .init.*. Plus inadvertent addition of non-init code/date would get detected at build time.
Jan
Re: [PATCH v3 1/5] Use __stringify() as the only method for performing preprocessor stringificaion
In reply to Jan BeulichQuoted 56 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 9:05 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH v3 1/5] Use__stringify()as the only method for performing preprocessor stringificaionQuoted 37 lines
Quoted 12 lines
Quoted 1 line · On 03.06.14 at 14:37, <[email protected]> wrote:
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu, Feng
Sent: Tuesday, June 03, 2014 8:43 AM
To: Jan Beulich; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v3 1/5] Use__stringify()as the only methodfor
Quoted 24 lines
performing preprocessor stringificaion
Quoted 8 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Friday, May 30, 2014 7:36 PM
To: Wu, Feng; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 1/5] Use__stringify()as the only method forperforming
Quoted 10 lines
preprocessor stringificaion
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Feng Wu <[email protected]> 05/30/14 10:59 AM >>>
There are two ways of performing preprocessor stringificaion in the current code:
__stringify()fromstringify.h, andSTR()fromconfig.h. This patch consolidates down to one.Looking at the changes here I'm not really sure we want this as is. Is there anything going to break in the rest of the series if this patch was left out?
Quoted 6 lines
Quoted 1 line
I think nothing will be broken without this patch. Andrew finds there are
two
Quoted 2 lines
different
ways for handling this, and tend to unify them to one. This is the story.Andrew & Jan, do you have any final decision about this change?
Quoted 8 lines
As you've seen I applied the other patches in this series, but not this one. If such a cleanup was done, it should imo be done such that at the same time stringification gets dropped where pointlessly used, i.e. the set of use cases should get reduced to the bare minimum needed. And personally I have no problem gradually fading out
STR()instead of doing this with a separate patch, thus reducing overall code churn.Jan
Okay, got it, thanks for the explanation!
Thanks,
Feng
Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to Xen
In reply to Jan BeulichQuoted 89 lines
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 9:10 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 9 lines
Quoted 9 lines
Quoted 1 line · On 03.06.14 at 15:05, <[email protected]> wrote:
-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, June 03, 2014 6:00 PM
To: Wu, Feng
Cc: [email protected]; [email protected]; [email protected]; [email protected];Quoted 5 lines
Quoted 5 lines
[email protected]; [email protected]
Subject: Re: [PATCH v3 4/5] x86: Port the basic alternative mechanism from Linux to XenQuoted 1 line
Quoted 1 line
Quoted 1 line · On 30.05.14 at 10:56, <[email protected]> wrote:
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/alternative.c new file +4
-0+#ifdef K8_NOP1 +static const unsigned char k8nops[]__initconst = { +K8_NOP1 , + K8_NOP2,Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+K8_NOP3 , +K8_NOP4 , +K8_NOP5 , +K8_NOP6 , +K8_NOP7 , + K8_NOP8 +}; +static const unsigned char *const k8_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 17 lines
Quoted 17 lines
{
Quoted 16 lines
xen/arch/x86/alternative.c new file +16
-0+NULL , + k8nops, + k8nops +1 , + k8nops +1 +2 , + k8nops +1 +2 +3 , + k8nops +1 +2 +3 +4 , + k8nops +1 +2 +3 +4 +5 , + k8nops +1 +2 +3 +4 +5 +6 , + k8nops +1 +2 +3 +4 +5 +6 +7 +}; +#endif + +#ifdef P6_NOP1 +static const unsigned char p6nops[]__initconst = { +P6_NOP1 , + P6_NOP2,Quoted 8 lines
Quoted 8 lines
xen/arch/x86/alternative.c
Quoted 8 lines
xen/arch/x86/alternative.c new file +8
-0+P6_NOP3 , +P6_NOP4 , +P6_NOP5 , +P6_NOP6 , +P6_NOP7 , + P6_NOP8 +}; +static const unsigned char *const p6_nops[ASM_NOP_MAX +1 ]
__initconst=Quoted 19 lines
Quoted 10 lines
{
Quoted 9 lines
xen/arch/x86/alternative.c new file +9
-0+NULL , + p6nops, + p6nops +1 , + p6nops +1 +2 , + p6nops +1 +2 +3 , + p6nops +1 +2 +3 +4 , + p6nops +1 +2 +3 +4 +5 , + p6nops +1 +2 +3 +4 +5 +6 , + p6nops +1 +2 +3 +4 +5 +6 +7 Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+}; +#endifThe uses of
__initconsttogether with -fPIC cause build problems on older gcc. I fixed this up in a temporary way, but put a work item on my todo list to deal with this properly while at once converting alternative.o to alternative.init.o (as the file consists of only init code and data).Quoted 3 lines
BTW, is there any difference after converting alternative.o to alternative.init.o, since
everything inalternative.chas already been__init__?
Quoted 5 lines
Yes, there is: String literals will also get moved to .init.*. Plus inadvertent addition of non-init code/date would get detected at build time.
Jan
Thanks, good to know this!
Feng