Skip to content

Commit 4326683

Browse files
committed
parisc: Reduce size of the bug_table on 64-bit kernel by half
Enable GENERIC_BUG_RELATIVE_POINTERS which will store 32-bit relative offsets to the bug address and the source file name instead of 64-bit absolute addresses. This effectively reduces the size of the bug_table[] array by half on 64-bit kernels. Signed-off-by: Helge Deller <[email protected]>
1 parent e5f3e29 commit 4326683

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

arch/parisc/Kconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64
115115
default n
116116

117117
config GENERIC_BUG
118-
bool
119-
default y
118+
def_bool y
120119
depends on BUG
120+
select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
121+
122+
config GENERIC_BUG_RELATIVE_POINTERS
123+
bool
121124

122125
config GENERIC_HWEIGHT
123126
bool

arch/parisc/include/asm/bug.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,27 @@
1717
#define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
1818
#define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
1919

20-
#if defined(CONFIG_64BIT)
21-
#define ASM_WORD_INSN ".dword\t"
20+
#ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
21+
# define __BUG_REL(val) ".word " __stringify(val) " - ."
2222
#else
23-
#define ASM_WORD_INSN ".word\t"
23+
# define __BUG_REL(val) ".word " __stringify(val)
2424
#endif
2525

26+
2627
#ifdef CONFIG_DEBUG_BUGVERBOSE
2728
#define BUG() \
2829
do { \
2930
asm volatile("\n" \
3031
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
3132
"\t.pushsection __bug_table,\"a\"\n" \
32-
"\t.align %4\n" \
33-
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
33+
"\t.align 4\n" \
34+
"2:\t" __BUG_REL(1b) "\n" \
35+
"\t" __BUG_REL(%c0) "\n" \
3436
"\t.short %1, %2\n" \
35-
"\t.blockz %3-2*%4-2*2\n" \
37+
"\t.blockz %3-2*4-2*2\n" \
3638
"\t.popsection" \
3739
: : "i" (__FILE__), "i" (__LINE__), \
38-
"i" (0), "i" (sizeof(struct bug_entry)), \
39-
"i" (sizeof(long)) ); \
40+
"i" (0), "i" (sizeof(struct bug_entry)) ); \
4041
unreachable(); \
4142
} while(0)
4243

@@ -54,15 +55,15 @@
5455
asm volatile("\n" \
5556
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
5657
"\t.pushsection __bug_table,\"a\"\n" \
57-
"\t.align %4\n" \
58-
"2:\t" ASM_WORD_INSN "1b, %c0\n" \
58+
"\t.align 4\n" \
59+
"2:\t" __BUG_REL(1b) "\n" \
60+
"\t" __BUG_REL(%c0) "\n" \
5961
"\t.short %1, %2\n" \
60-
"\t.blockz %3-2*%4-2*2\n" \
62+
"\t.blockz %3-2*4-2*2\n" \
6163
"\t.popsection" \
6264
: : "i" (__FILE__), "i" (__LINE__), \
6365
"i" (BUGFLAG_WARNING|(flags)), \
64-
"i" (sizeof(struct bug_entry)), \
65-
"i" (sizeof(long)) ); \
66+
"i" (sizeof(struct bug_entry)) ); \
6667
} while(0)
6768
#else
6869
#define __WARN_FLAGS(flags) \
@@ -71,13 +72,12 @@
7172
"1:\t" PARISC_BUG_BREAK_ASM "\n" \
7273
"\t.pushsection __bug_table,\"a\"\n" \
7374
"\t.align %2\n" \
74-
"2:\t" ASM_WORD_INSN "1b\n" \
75+
"2:\t" __BUG_REL(1b) "\n" \
7576
"\t.short %0\n" \
76-
"\t.blockz %1-%2-2\n" \
77+
"\t.blockz %1-4-2\n" \
7778
"\t.popsection" \
7879
: : "i" (BUGFLAG_WARNING|(flags)), \
79-
"i" (sizeof(struct bug_entry)), \
80-
"i" (sizeof(long)) ); \
80+
"i" (sizeof(struct bug_entry)) ); \
8181
} while(0)
8282
#endif
8383

0 commit comments

Comments
 (0)