* [PATCH] arm64/mm: Drop redundant extern declaration for rodata_full
@ 2025-10-15 2:36 Anshuman Khandual
2025-11-04 15:43 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Anshuman Khandual @ 2025-10-15 2:36 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, linux-kernel
Drop the redundant extern declaration 'rodata_full' which can be included
via the header <asm/setup.h> after moving exiting declaration outside the
function arch_parse_debug_rodata(). While here also drop 'rodata_enabled'
which is anyways available via the generic header <linux/init.h>.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/include/asm/mmu_context.h | 2 --
arch/arm64/include/asm/setup.h | 4 +---
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index 0375ca3162ff..e4b3563e1d96 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -26,8 +26,6 @@
#include <asm/sysreg.h>
#include <asm/tlbflush.h>
-extern bool rodata_full;
-
static inline void contextidr_thread_switch(struct task_struct *next)
{
if (!IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR))
diff --git a/arch/arm64/include/asm/setup.h b/arch/arm64/include/asm/setup.h
index 3d96dde4d214..902f1aab520f 100644
--- a/arch/arm64/include/asm/setup.h
+++ b/arch/arm64/include/asm/setup.h
@@ -12,12 +12,10 @@
*/
extern phys_addr_t __fdt_pointer __initdata;
extern u64 __cacheline_aligned boot_args[4];
+extern bool rodata_full;
static inline bool arch_parse_debug_rodata(char *arg)
{
- extern bool rodata_enabled;
- extern bool rodata_full;
-
if (!arg)
return false;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64/mm: Drop redundant extern declaration for rodata_full
2025-10-15 2:36 [PATCH] arm64/mm: Drop redundant extern declaration for rodata_full Anshuman Khandual
@ 2025-11-04 15:43 ` Will Deacon
2025-11-05 5:30 ` Anshuman Khandual
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2025-11-04 15:43 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-arm-kernel, Catalin Marinas, linux-kernel, ryan.roberts
On Wed, Oct 15, 2025 at 03:36:09AM +0100, Anshuman Khandual wrote:
> Drop the redundant extern declaration 'rodata_full' which can be included
> via the header <asm/setup.h> after moving exiting declaration outside the
> function arch_parse_debug_rodata(). While here also drop 'rodata_enabled'
> which is anyways available via the generic header <linux/init.h>.
>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> arch/arm64/include/asm/mmu_context.h | 2 --
> arch/arm64/include/asm/setup.h | 4 +---
> 2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
> index 0375ca3162ff..e4b3563e1d96 100644
> --- a/arch/arm64/include/asm/mmu_context.h
> +++ b/arch/arm64/include/asm/mmu_context.h
> @@ -26,8 +26,6 @@
> #include <asm/sysreg.h>
> #include <asm/tlbflush.h>
>
> -extern bool rodata_full;
> -
> static inline void contextidr_thread_switch(struct task_struct *next)
> {
> if (!IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR))
> diff --git a/arch/arm64/include/asm/setup.h b/arch/arm64/include/asm/setup.h
> index 3d96dde4d214..902f1aab520f 100644
> --- a/arch/arm64/include/asm/setup.h
> +++ b/arch/arm64/include/asm/setup.h
> @@ -12,12 +12,10 @@
> */
> extern phys_addr_t __fdt_pointer __initdata;
> extern u64 __cacheline_aligned boot_args[4];
> +extern bool rodata_full;
>
> static inline bool arch_parse_debug_rodata(char *arg)
> {
> - extern bool rodata_enabled;
> - extern bool rodata_full;
> -
> if (!arg)
> return false;
It would probably be cleaner to make 'rodata_full' static in mm/pageattr.c,
move the guts of arch_parse_debug_rodata in there and then consolidate
can_set_direct_map() and force_pte_mapping().
You need to talk to Ryan for the last part, as David's made some
suggestions around that too.
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64/mm: Drop redundant extern declaration for rodata_full
2025-11-04 15:43 ` Will Deacon
@ 2025-11-05 5:30 ` Anshuman Khandual
0 siblings, 0 replies; 3+ messages in thread
From: Anshuman Khandual @ 2025-11-05 5:30 UTC (permalink / raw)
To: Will Deacon; +Cc: linux-arm-kernel, Catalin Marinas, linux-kernel, ryan.roberts
On 04/11/25 9:13 PM, Will Deacon wrote:
> On Wed, Oct 15, 2025 at 03:36:09AM +0100, Anshuman Khandual wrote:
>> Drop the redundant extern declaration 'rodata_full' which can be included
>> via the header <asm/setup.h> after moving exiting declaration outside the
>> function arch_parse_debug_rodata(). While here also drop 'rodata_enabled'
>> which is anyways available via the generic header <linux/init.h>.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> arch/arm64/include/asm/mmu_context.h | 2 --
>> arch/arm64/include/asm/setup.h | 4 +---
>> 2 files changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
>> index 0375ca3162ff..e4b3563e1d96 100644
>> --- a/arch/arm64/include/asm/mmu_context.h
>> +++ b/arch/arm64/include/asm/mmu_context.h
>> @@ -26,8 +26,6 @@
>> #include <asm/sysreg.h>
>> #include <asm/tlbflush.h>
>>
>> -extern bool rodata_full;
>> -
>> static inline void contextidr_thread_switch(struct task_struct *next)
>> {
>> if (!IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR))
>> diff --git a/arch/arm64/include/asm/setup.h b/arch/arm64/include/asm/setup.h
>> index 3d96dde4d214..902f1aab520f 100644
>> --- a/arch/arm64/include/asm/setup.h
>> +++ b/arch/arm64/include/asm/setup.h
>> @@ -12,12 +12,10 @@
>> */
>> extern phys_addr_t __fdt_pointer __initdata;
>> extern u64 __cacheline_aligned boot_args[4];
>> +extern bool rodata_full;
>>
>> static inline bool arch_parse_debug_rodata(char *arg)
>> {
>> - extern bool rodata_enabled;
>> - extern bool rodata_full;
>> -
>> if (!arg)
>> return false;
>
> It would probably be cleaner to make 'rodata_full' static in mm/pageattr.c,
> move the guts of arch_parse_debug_rodata in there and then consolidate
> can_set_direct_map() and force_pte_mapping().
>
> You need to talk to Ryan for the last part, as David's made some
> suggestions around that too.
Sure will talk to Ryan about this. But for the above suggestion - probably something
like the following (untested) should work.
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index 0dbe3b29049b..ddb964e916e1 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -26,8 +26,6 @@
#include <asm/sysreg.h>
#include <asm/tlbflush.h>
-extern bool rodata_full;
-
static inline void contextidr_thread_switch(struct task_struct *next)
{
if (!IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR))
diff --git a/arch/arm64/include/asm/setup.h b/arch/arm64/include/asm/setup.h
index 3d96dde4d214..fa77a7208826 100644
--- a/arch/arm64/include/asm/setup.h
+++ b/arch/arm64/include/asm/setup.h
@@ -13,32 +13,7 @@
extern phys_addr_t __fdt_pointer __initdata;
extern u64 __cacheline_aligned boot_args[4];
-static inline bool arch_parse_debug_rodata(char *arg)
-{
- extern bool rodata_enabled;
- extern bool rodata_full;
-
- if (!arg)
- return false;
-
- if (!strcmp(arg, "on")) {
- rodata_enabled = rodata_full = true;
- return true;
- }
-
- if (!strcmp(arg, "off")) {
- rodata_enabled = rodata_full = false;
- return true;
- }
-
- if (!strcmp(arg, "noalias")) {
- rodata_enabled = true;
- rodata_full = false;
- return true;
- }
-
- return false;
-}
+bool arch_parse_debug_rodata(char *arg);
#define arch_parse_debug_rodata arch_parse_debug_rodata
#endif
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index b8d37eb037fc..030ee4ba8a7a 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -1014,9 +1014,7 @@ static inline bool force_pte_mapping(void)
bool bbml2 = system_capabilities_finalized() ?
system_supports_bbml2_noabort() : cpu_supports_bbml2_noabort();
- return (!bbml2 && (rodata_full || arm64_kfence_can_set_direct_map() ||
- is_realm_world())) ||
- debug_pagealloc_enabled();
+ return debug_pagealloc_enabled() || (!bbml2 && can_set_direct_map());
}
static void __init map_mem(pgd_t *pgdp)
diff --git a/arch/arm64/mm/pageattr.c b/arch/arm64/mm/pageattr.c
index 5135f2d66958..60d372c630eb 100644
--- a/arch/arm64/mm/pageattr.c
+++ b/arch/arm64/mm/pageattr.c
@@ -80,7 +80,31 @@ static const struct mm_walk_ops pageattr_ops = {
.pte_entry = pageattr_pte_entry,
};
-bool rodata_full __ro_after_init = true;
+static bool rodata_full __ro_after_init = true;
+
+bool arch_parse_debug_rodata(char *arg)
+{
+ if (!arg)
+ return false;
+
+ if (!strcmp(arg, "on")) {
+ rodata_enabled = rodata_full = true;
+ return true;
+ }
+
+ if (!strcmp(arg, "off")) {
+ rodata_enabled = rodata_full = false;
+ return true;
+ }
+
+ if (!strcmp(arg, "noalias")) {
+ rodata_enabled = true;
+ rodata_full = false;
+ return true;
+ }
+
+ return false;
+}
bool can_set_direct_map(void)
{
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-05 5:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 2:36 [PATCH] arm64/mm: Drop redundant extern declaration for rodata_full Anshuman Khandual
2025-11-04 15:43 ` Will Deacon
2025-11-05 5:30 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox