arm64: Allow user selection of ARM64_MODULE_PLTS
PATCH 1/1 arm64: Allow user selection of ARM64_MODULE_PLTS
Make ARM64_MODULE_PLTS a selectable Kconfig symbol, since some people might have very big modules spilling out of the dedicated module area into vmalloc. Help text is copied from the ARM 32-bit counterpart.
--- arch/arm64/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/arm64/Kconfig +13 -1
@@ -1418,8 +1418,20 @@ config ARM64_SVE KVM in the same kernel image. config ARM64_MODULE_PLTS - bool + bool "Use PLTs to allow module memory to spill over into vmalloc area" select HAVE_MOD_ARCH_SPECIFIC + help + Allocate PLTs when loading modules so that jumps and calls whose + targets are too far away for their relative offsets to be encoded + in the instructions themselves can be bounced via veneers in the + module's PLT. This allows modules to be allocated in the generic + vmalloc area after the dedicated module memory area has been + exhausted. The modules will use slightly more memory, but after + rounding up to page size, the actual memory footprint is usually + the same. + + Disabling this is usually safe for small single-platform + configurations. If unsure, say y. config ARM64_PSEUDO_NMI bool "Support for NMI-like interrupts"
Signature · 1 line
2.17.1
Quoted 24 lines · Florian Fainelli
Make
ARM64_MODULE_PLTSa selectableKconfigsymbol, since some people might have very big modules spilling out of the dedicated module area into vmalloc. Help text is copied from the ARM 32-bit counterpart.Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)arch/arm64/Kconfig +4
-1@@ -1418,8 +1418,20 @@ config ARM64_SVE KVM in the same kernel image. config ARM64_MODULE_PLTS - bool + bool "Use PLTs to allow module memory to spill over into vmalloc area" select HAVE_MOD_ARCH_SPECIFIC + help + Allocate PLTs when loading modules so that jumps and calls whose + targets are too far away for their relative offsets to be encoded
arch/arm64/Kconfig config ARM64_SVE · line 1435
Quoted 10 lines
arch/arm64/Kconfig +9
-0+ in the instructions themselves can be bounced via veneers in the + module's PLT. This allows modules to be allocated in the generic + vmalloc area after the dedicated module memory area has been + exhausted. The modules will use slightly more memory, but after + rounding up to page size, the actual memory footprint is usually + the same. + + Disabling this is usually safe for small single-platform + configurations. If unsure, say y.
I don't mind adding this, but it makes sense to add an explanation why KASLR enables this. E.g.,
"""
When running with address space randomization (KASLR), the module region itself may be too far away for ordinary relative jumps and calls, and so in that case, module PLTs are required and cannot be disabled.
"""
Quoted 5 lines
arch/arm64/Kconfig +0
-1config ARM64_PSEUDO_NMI bool "Support for NMI-like interrupts" --2.17.1
Quoted 19 lines · Florian Fainelli
Make
ARM64_MODULE_PLTSa selectableKconfigsymbol, since some people might have very big modules spilling out of the dedicated module area into vmalloc. Help text is copied from the ARM 32-bit counterpart.Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)arch/arm64/Kconfig +1
-1@@ -1418,8 +1418,20 @@ config ARM64_SVE KVM in the same kernel image. config ARM64_MODULE_PLTS - bool + bool "Use PLTs to allow module memory to spill over into vmalloc area"
arch/arm64/Kconfig config ARM64_SVE · line 1431
Quoted 10 lines
arch/arm64/Kconfig +9
-0select HAVE_MOD_ARCH_SPECIFIC + help + Allocate PLTs when loading modules so that jumps and calls whose + targets are too far away for their relative offsets to be encoded + in the instructions themselves can be bounced via veneers in the + module's PLT. This allows modules to be allocated in the generic + vmalloc area after the dedicated module memory area has been + exhausted. The modules will use slightly more memory, but after + rounding up to page size, the actual memory footprint is usually + the same.
Isn't the worry really about the runtime performance overhead introduced by the veneers, as opposed to the memory usage of the module?
arch/arm64/Kconfig config ARM64_SVE · line 1434
Quoted 2 lines
arch/arm64/Kconfig +2
-0+ Disabling this is usually safe for small single-platform + configurations. If unsure, say y.
So should this be on by default?
Will
Quoted 17 lines · Will Deacon
Quoted 16 lines · Florian Fainelli
Make
ARM64_MODULE_PLTSa selectableKconfigsymbol, since some people might have very big modules spilling out of the dedicated module area into vmalloc. Help text is copied from the ARM 32-bit counterpart.Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)arch/arm64/Kconfig +0
-0@@ -1418,8 +1418,20 @@ config ARM64_SVE KVM in the same kernel image.
Quoted 16 lines
arch/arm64/Kconfig config ARM64_SVE · line 1431
Quoted 13 lines
arch/arm64/Kconfig +10
-1config ARM64_MODULE_PLTS - bool + bool "Use PLTs to allow module memory to spill over into vmalloc area" select HAVE_MOD_ARCH_SPECIFIC + help + Allocate PLTs when loading modules so that jumps and calls whose + targets are too far away for their relative offsets to be encoded + in the instructions themselves can be bounced via veneers in the + module's PLT. This allows modules to be allocated in the generic + vmalloc area after the dedicated module memory area has been + exhausted. The modules will use slightly more memory, but after + rounding up to page size, the actual memory footprint is usually + the same.Isn't the worry really about the runtime performance overhead introduced by the veneers, as opposed to the memory usage of the module?
The main concern is indeed runtime performance (both added veneers and possibly increased cache trashing) and second could be the increased vmalloc usage. Do you want me to rephrase that part, or drop it?
Quoted 5 lines
arch/arm64/Kconfig config ARM64_SVE · line 1434
Quoted 3 lines
arch/arm64/Kconfig +2
-0+ Disabling this is usually safe for small single-platform + configurations. If unsure, say y.So should this be on by default?
It is turned on under certain conditions that require it (v2 makes that clearer, based on Ard's feedback), having it turned off by default at least makes people realize (or rather can be used as argument) that the modules are possibly too big.
Under certain build configurations like test/manufacturing, you might have a set of large modules that should still load, hence this patch.
Signature · 1 line
Florian
Will Deacon
maintainerQuoted 35 lines · Florian Fainelli
Quoted 17 lines · Will Deacon
Quoted 16 lines · Florian Fainelli
Make
ARM64_MODULE_PLTSa selectableKconfigsymbol, since some people might have very big modules spilling out of the dedicated module area into vmalloc. Help text is copied from the ARM 32-bit counterpart.Signed-off-by Florian Fainelli <[email protected]>--- arch/arm64/Kconfig | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)arch/arm64/Kconfig +0
-0@@ -1418,8 +1418,20 @@ config ARM64_SVE KVM in the same kernel image.Quoted 16 lines
arch/arm64/Kconfig config ARM64_SVE · line 1431
Quoted 13 lines
arch/arm64/Kconfig +10
-1config ARM64_MODULE_PLTS - bool + bool "Use PLTs to allow module memory to spill over into vmalloc area" select HAVE_MOD_ARCH_SPECIFIC + help + Allocate PLTs when loading modules so that jumps and calls whose + targets are too far away for their relative offsets to be encoded + in the instructions themselves can be bounced via veneers in the + module's PLT. This allows modules to be allocated in the generic + vmalloc area after the dedicated module memory area has been + exhausted. The modules will use slightly more memory, but after + rounding up to page size, the actual memory footprint is usually + the same.Isn't the worry really about the runtime performance overhead introduced by the veneers, as opposed to the memory usage of the module?
Quoted 3 lines
The main concern is indeed runtime performance (both added veneers and possibly increased cache trashing) and second could be the increased vmalloc usage. Do you want me to rephrase that part, or drop it?
Whichever you prefer.
Quoted 6 lines
Quoted 5 lines
arch/arm64/Kconfig config ARM64_SVE · line 1434
Quoted 3 lines
arch/arm64/Kconfig +2
-0+ Disabling this is usually safe for small single-platform + configurations. If unsure, say y.So should this be on by default?
Quoted 7 lines
It is turned on under certain conditions that require it (v2 makes that clearer, based on Ard's feedback), having it turned off by default at least makes people realize (or rather can be used as argument) that the modules are possibly too big.
Under certain build configurations like test/manufacturing, you might have a set of large modules that should still load, hence this patch.
I'm fine with leaving it default off, but then let's not say "If unsure, say y". In fact, you can remove that whole "disabling this is usually safe" part I reckon.
Will