From: "Jan Beulich" Subject: [PATCH 1/2] x86: force suitable alignment in sources rather than in linker script Date: Fri, 12 Aug 2016 08:47:53 -0600 Message-ID: <57ADFDB9020000780010582B@prv-mh.provo.novell.com> References: <57ADFCC402000078001057F2@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartFACC0D89.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bYDka-0002Kn-Sl for xen-devel@lists.xenproject.org; Fri, 12 Aug 2016 14:47:56 +0000 In-Reply-To: <57ADFCC402000078001057F2@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: George Dunlap , Andrew Cooper List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartFACC0D89.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Besides being more logical this also allows verifying correct recording of alignments in .o files. The cpu0_stack related ASSERT() in xen.lds.S is now of questionable value (as it now verifies correct tool chain behavior), but I've left it in nevertheless. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -89,6 +89,7 @@ struct hvm_function_table hvm_funcs __re */ #define HVM_IOBITMAP_SIZE (3 * PAGE_SIZE) unsigned long __section(".bss.page_aligned") + __attribute__((aligned(PAGE_SIZE))) hvm_io_bitmap[HVM_IOBITMAP_SIZE / BYTES_PER_LONG]; =20 /* Xen command-line option to enable HAP */ --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -125,7 +125,8 @@ #include =20 /* Mapping of the fixmap space needed early. */ -l1_pgentry_t __section(".bss.page_aligned") l1_fixmap[L1_PAGETABLE_ENTRIES= ]; +l1_pgentry_t __section(".bss.page_aligned") __attribute__((aligned(PAGE_SI= ZE))) + l1_fixmap[L1_PAGETABLE_ENTRIES]; =20 #define MEM_LOG(_f, _a...) gdprintk(XENLOG_WARNING , _f "\n" , ## _a) =20 @@ -588,7 +589,8 @@ static inline void guest_get_eff_kern_l1 TOGGLE_MODE(); } =20 -const char __section(".bss.page_aligned.const") zero_page[PAGE_SIZE]; +const char __section(".bss.page_aligned.const") + __attribute__((aligned(PAGE_SIZE))) zero_page[PAGE_SIZE]; =20 static void invalidate_shadow_ldt(struct vcpu *v, int flush) { --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -105,7 +105,8 @@ unsigned long __read_mostly xen_virt_end =20 DEFINE_PER_CPU(struct tss_struct, init_tss); =20 -char __section(".bss.stack_aligned") cpu0_stack[STACK_SIZE]; +char __section(".bss.stack_aligned") __attribute__((aligned(STACK_SIZE))) + cpu0_stack[STACK_SIZE]; =20 struct cpuinfo_x86 __read_mostly boot_cpu_data =3D { 0, 0, 0, 0, -1 }; =20 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -222,7 +222,6 @@ SECTIONS } :text =20 .data : { /* Data */ - . =3D ALIGN(PAGE_SIZE); *(.data.page_aligned) *(.data) *(.data.rel) @@ -231,10 +230,8 @@ SECTIONS } :text =20 .bss : { /* BSS */ - . =3D ALIGN(STACK_SIZE); __bss_start =3D .; *(.bss.stack_aligned) - . =3D ALIGN(PAGE_SIZE); *(.bss.page_aligned*) *(.bss) . =3D ALIGN(SMP_CACHE_BYTES); --=__PartFACC0D89.2__= Content-Type: text/plain; name="x86-bss-align.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-bss-align.patch" x86: force suitable alignment in sources rather than in linker script=0A=0A= Besides being more logical this also allows verifying correct recording=0Ao= f alignments in .o files.=0A=0AThe cpu0_stack related ASSERT() in = xen.lds.S is now of questionable=0Avalue (as it now verifies correct tool = chain behavior), but I've left=0Ait in nevertheless.=0A=0ASigned-off-by: = Jan Beulich =0A=0A--- a/xen/arch/x86/hvm/hvm.c=0A+++ = b/xen/arch/x86/hvm/hvm.c=0A@@ -89,6 +89,7 @@ struct hvm_function_table = hvm_funcs __re=0A */=0A #define HVM_IOBITMAP_SIZE (3 * PAGE_SIZE)=0A = unsigned long __section(".bss.page_aligned")=0A+ __attribute__((aligned(= PAGE_SIZE)))=0A hvm_io_bitmap[HVM_IOBITMAP_SIZE / BYTES_PER_LONG];=0A = =0A /* Xen command-line option to enable HAP */=0A--- a/xen/arch/x86/mm.c= =0A+++ b/xen/arch/x86/mm.c=0A@@ -125,7 +125,8 @@=0A #include =0A= =0A /* Mapping of the fixmap space needed early. */=0A-l1_pgentry_t = __section(".bss.page_aligned") l1_fixmap[L1_PAGETABLE_ENTRIES];=0A+l1_pgent= ry_t __section(".bss.page_aligned") __attribute__((aligned(PAGE_SIZE)))=0A+= l1_fixmap[L1_PAGETABLE_ENTRIES];=0A =0A #define MEM_LOG(_f, _a...) = gdprintk(XENLOG_WARNING , _f "\n" , ## _a)=0A =0A@@ -588,7 +589,8 @@ = static inline void guest_get_eff_kern_l1=0A TOGGLE_MODE();=0A }=0A = =0A-const char __section(".bss.page_aligned.const") zero_page[PAGE_SIZE];= =0A+const char __section(".bss.page_aligned.const")=0A+ __attribute__((a= ligned(PAGE_SIZE))) zero_page[PAGE_SIZE];=0A =0A static void invalidate_sha= dow_ldt(struct vcpu *v, int flush)=0A {=0A--- a/xen/arch/x86/setup.c=0A+++ = b/xen/arch/x86/setup.c=0A@@ -105,7 +105,8 @@ unsigned long __read_mostly = xen_virt_end=0A =0A DEFINE_PER_CPU(struct tss_struct, init_tss);=0A = =0A-char __section(".bss.stack_aligned") cpu0_stack[STACK_SIZE];=0A+char = __section(".bss.stack_aligned") __attribute__((aligned(STACK_SIZE)))=0A+ = cpu0_stack[STACK_SIZE];=0A =0A struct cpuinfo_x86 __read_mostly boot_cpu_d= ata =3D { 0, 0, 0, 0, -1 };=0A =0A--- a/xen/arch/x86/xen.lds.S=0A+++ = b/xen/arch/x86/xen.lds.S=0A@@ -222,7 +222,6 @@ SECTIONS=0A } :text=0A = =0A .data : { /* Data */=0A- . =3D ALIGN(PAGE_SI= ZE);=0A *(.data.page_aligned)=0A *(.data)=0A = *(.data.rel)=0A@@ -231,10 +230,8 @@ SECTIONS=0A } :text=0A =0A .bss : = { /* BSS */=0A- . =3D ALIGN(STACK_SIZE);=0A = __bss_start =3D .;=0A *(.bss.stack_aligned)=0A- . =3D = ALIGN(PAGE_SIZE);=0A *(.bss.page_aligned*)=0A *(.bss)=0A = . =3D ALIGN(SMP_CACHE_BYTES);=0A --=__PartFACC0D89.2__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__PartFACC0D89.2__=--