Skip to content

Commit e16e65a

Browse files
ardbiesheuvelctmarinas
authored andcommitted
arm64: remove CONFIG_DEBUG_ALIGN_RODATA feature
When CONFIG_DEBUG_ALIGN_RODATA is enabled, kernel segments mapped with different permissions (r-x for .text, r-- for .rodata, rw- for .data, etc) are rounded up to 2 MiB so they can be mapped more efficiently. In particular, it permits the segments to be mapped using level 2 block entries when using 4k pages, which is expected to result in less TLB pressure. However, the mappings for the bulk of the kernel will use level 2 entries anyway, and the misaligned fringes are organized such that they can take advantage of the contiguous bit, and use far fewer level 3 entries than would be needed otherwise. This makes the value of this feature dubious at best, and since it is not enabled in defconfig or in the distro configs, it does not appear to be in wide use either. So let's just remove it. Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Mark Rutland <[email protected]> Acked-by: Will Deacon <[email protected]> Acked-by: Laura Abbott <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent b8fdef3 commit e16e65a

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

arch/arm64/Kconfig.debug

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,6 @@ config DEBUG_WX
5252

5353
If in doubt, say "Y".
5454

55-
config DEBUG_ALIGN_RODATA
56-
depends on STRICT_KERNEL_RWX
57-
bool "Align linker sections up to SECTION_SIZE"
58-
help
59-
If this option is enabled, sections that may potentially be marked as
60-
read only or non-executable will be aligned up to the section size of
61-
the kernel. This prevents sections from being split into pages and
62-
avoids a potential TLB penalty. The downside is an increase in
63-
alignment and potentially wasted space. Turn on this option if
64-
performance is more important than memory pressure.
65-
66-
If in doubt, say N.
67-
6855
config DEBUG_EFI
6956
depends on EFI && DEBUG_INFO
7057
bool "UEFI debugging"

arch/arm64/include/asm/memory.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,12 @@
120120

121121
/*
122122
* Alignment of kernel segments (e.g. .text, .data).
123-
*/
124-
#if defined(CONFIG_DEBUG_ALIGN_RODATA)
125-
/*
126-
* 4 KB granule: 1 level 2 entry
127-
* 16 KB granule: 128 level 3 entries, with contiguous bit
128-
* 64 KB granule: 32 level 3 entries, with contiguous bit
129-
*/
130-
#define SEGMENT_ALIGN SZ_2M
131-
#else
132-
/*
123+
*
133124
* 4 KB granule: 16 level 3 entries, with contiguous bit
134125
* 16 KB granule: 4 level 3 entries, without contiguous bit
135126
* 64 KB granule: 1 level 3 entry
136127
*/
137128
#define SEGMENT_ALIGN SZ_64K
138-
#endif
139129

140130
/*
141131
* Memory types available.

drivers/firmware/efi/libstub/arm64-stub.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,12 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
8282

8383
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE) && phys_seed != 0) {
8484
/*
85-
* If CONFIG_DEBUG_ALIGN_RODATA is not set, produce a
86-
* displacement in the interval [0, MIN_KIMG_ALIGN) that
87-
* doesn't violate this kernel's de-facto alignment
85+
* Produce a displacement in the interval [0, MIN_KIMG_ALIGN)
86+
* that doesn't violate this kernel's de-facto alignment
8887
* constraints.
8988
*/
9089
u32 mask = (MIN_KIMG_ALIGN - 1) & ~(EFI_KIMG_ALIGN - 1);
91-
u32 offset = !IS_ENABLED(CONFIG_DEBUG_ALIGN_RODATA) ?
92-
(phys_seed >> 32) & mask : TEXT_OFFSET;
90+
u32 offset = (phys_seed >> 32) & mask;
9391

9492
/*
9593
* With CONFIG_RANDOMIZE_TEXT_OFFSET=y, TEXT_OFFSET may not

0 commit comments

Comments
 (0)