]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/64s: Reduce exception alignment
authorNicholas Piggin <npiggin@gmail.com>
Thu, 13 Oct 2016 03:43:52 +0000 (14:43 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 14 Nov 2016 00:11:51 +0000 (11:11 +1100)
Exception handlers are aligned to 128 bytes (L1 cache) on 64s, which is
overkill. It can reduce the icache footprint of any individual exception
path. However taken as a whole, the expansion in icache footprint seems
likely to be counter-productive and cause more total misses.

Create IFETCH_ALIGN_SHIFT/BYTES, which should give optimal ifetch
alignment with much more reasonable alignment. This saves 1792 bytes
from head_64.o text with an allmodconfig build.

Other subarchitectures should define appropriate IFETCH_ALIGN_SHIFT
values if this becomes more widely used.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/cache.h
arch/powerpc/include/asm/head-64.h
arch/powerpc/kernel/exceptions-64s.S

index ffbafbf76b193a28338d8721e22c63644c55ec35..7657aa897a38e5382d64a4d7504abb50c95ea723 100644 (file)
 #endif
 #else /* CONFIG_PPC64 */
 #define L1_CACHE_SHIFT         7
+#define IFETCH_ALIGN_SHIFT     4 /* POWER8,9 */
 #endif
 
 #define        L1_CACHE_BYTES          (1 << L1_CACHE_SHIFT)
 
 #define        SMP_CACHE_BYTES         L1_CACHE_BYTES
 
+#define IFETCH_ALIGN_BYTES     (1 << IFETCH_ALIGN_SHIFT)
+
 #if defined(__powerpc64__) && !defined(__ASSEMBLY__)
 struct ppc64_caches {
        u32     dsize;                  /* L1 d-cache size */
index ab90c2fa1ea63215fc969105dc6e8071646ace02..fca7033839a9d7033643895bbe74271a6a31beac 100644 (file)
@@ -95,12 +95,12 @@ end_##sname:
 
 #define __FIXED_SECTION_ENTRY_BEGIN(sname, name, __align)      \
        USE_FIXED_SECTION(sname);                               \
-       .align __align;                                         \
+       .balign __align;                                        \
        .global name;                                           \
 name:
 
 #define FIXED_SECTION_ENTRY_BEGIN(sname, name)                 \
-       __FIXED_SECTION_ENTRY_BEGIN(sname, name, 0)
+       __FIXED_SECTION_ENTRY_BEGIN(sname, name, IFETCH_ALIGN_BYTES)
 
 #define FIXED_SECTION_ENTRY_BEGIN_LOCATION(sname, name, start)         \
        USE_FIXED_SECTION(sname);                               \
@@ -203,9 +203,9 @@ name:
 #define EXC_VIRT_END(name, start, end)                 \
        FIXED_SECTION_ENTRY_END_LOCATION(virt_vectors, exc_virt_##start##_##name, end)
 
-#define EXC_COMMON_BEGIN(name)                                 \
+#define EXC_COMMON_BEGIN(name)                                         \
        USE_TEXT_SECTION();                                             \
-       .align  7;                                                      \
+       .balign IFETCH_ALIGN_BYTES;                                     \
        .global name;                                                   \
        DEFINE_FIXED_SYMBOL(name);                                      \
 name:
index 08ba447a4b3dae99676c8b42b8c6deea1866b042..50f0c5ab7e029ef405d7c03cd11e753cc991a96f 100644 (file)
@@ -1403,7 +1403,7 @@ USE_TEXT_SECTION()
 /*
  * Hash table stuff
  */
-       .align  7
+       .balign IFETCH_ALIGN_BYTES
 do_hash_page:
 #ifdef CONFIG_PPC_STD_MMU_64
        andis.  r0,r4,0xa410            /* weird error? */