diff mbox

[v2,1/8] xen/lockprof: Move .lockprofile.data into .rodata

Message ID 1456245085-2302-2-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper Feb. 23, 2016, 4:31 p.m. UTC
The entire contents of .lockprofile.data are unchanging pointers to
lock_profile structure in .data.  Annotate the type as such, and link the
section in .rodata.  As these are just pointers, there is no need for 32byte
alignment.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>

New in v2
---
 xen/arch/arm/xen.lds.S     | 14 +++++++-------
 xen/arch/x86/xen.lds.S     | 13 ++++++-------
 xen/include/xen/spinlock.h |  2 +-
 3 files changed, 14 insertions(+), 15 deletions(-)

Comments

Jan Beulich Feb. 24, 2016, 11:16 a.m. UTC | #1
>>> On 23.02.16 at 17:31, <andrew.cooper3@citrix.com> wrote:
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -65,6 +65,12 @@ SECTIONS
>  
>         *(.rodata)
>         *(.rodata.*)
> +
> +#ifdef LOCK_PROFILE
> +       __lock_profile_start = .;
> +       *(.lockprofile.data)
> +       __lock_profile_end = .;
> +#endif
>    } :text
>  
>    . = ALIGN(SMP_CACHE_BYTES);
> @@ -97,13 +103,6 @@ SECTIONS
>         CONSTRUCTORS
>    } :text
>  
> -#ifdef LOCK_PROFILE
> -  . = ALIGN(32);
> -  __lock_profile_start = .;
> -  .lockprofile.data : { *(.lockprofile.data) } :text
> -  __lock_profile_end = .;
> -#endif

As I've said on a different patch of yours where you also moved
stuff around - an alignment of 32 is not needed here, but completely
dropping the ALIGN() is wrong, since __lock_profile_start may end
up misaligned (and not on the start of the first .lockprofile.data
section).

Jan
diff mbox

Patch

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index f501a2f..6bbfba1 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -50,6 +50,13 @@  SECTIONS
        __stop_bug_frames_2 = .;
        *(.rodata)
        *(.rodata.*)
+
+#ifdef LOCK_PROFILE
+       __lock_profile_start = .;
+       *(.lockprofile.data)
+       __lock_profile_end = .;
+#endif
+
         _erodata = .;          /* End of read-only data */
   } :text
 
@@ -83,13 +90,6 @@  SECTIONS
        *(.data.rel.ro.*)
   } :text
 
-#ifdef LOCK_PROFILE
-  . = ALIGN(32);
-  __lock_profile_start = .;
-  .lockprofile.data : { *(.lockprofile.data) } :text
-  __lock_profile_end = .;
-#endif
-
   . = ALIGN(8);
   .arch.info : {
       _splatform = .;
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 9fde1db..106067a 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -65,6 +65,12 @@  SECTIONS
 
        *(.rodata)
        *(.rodata.*)
+
+#ifdef LOCK_PROFILE
+       __lock_profile_start = .;
+       *(.lockprofile.data)
+       __lock_profile_end = .;
+#endif
   } :text
 
   . = ALIGN(SMP_CACHE_BYTES);
@@ -97,13 +103,6 @@  SECTIONS
        CONSTRUCTORS
   } :text
 
-#ifdef LOCK_PROFILE
-  . = ALIGN(32);
-  __lock_profile_start = .;
-  .lockprofile.data : { *(.lockprofile.data) } :text
-  __lock_profile_end = .;
-#endif
-
   . = ALIGN(PAGE_SIZE);             /* Init code and data */
   __init_begin = .;
   .init.text : {
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 77ab7d5..88b53f9 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -79,7 +79,7 @@  struct lock_profile_qhead {
 
 #define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
 #define _LOCK_PROFILE_PTR(name)                                               \
-    static struct lock_profile *__lock_profile_##name                         \
+    static struct lock_profile * const __lock_profile_##name                  \
     __used_section(".lockprofile.data") =                                     \
     &__lock_profile_data_##name
 #define _SPIN_LOCK_UNLOCKED(x) { { 0 }, SPINLOCK_NO_CPU, 0, _LOCK_DEBUG, x }