* [PATCH] arm64: move kimage_vaddr to .rodata
@ 2020-03-12 9:40 Rémi Denis-Courmont
2020-03-12 16:40 ` Mark Rutland
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Rémi Denis-Courmont @ 2020-03-12 9:40 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, maz, james.morse, julien.thierry.kdev,
suzuki.poulose, kvmarm, will, catalin.marinas
From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
This datum is not referenced from .idmap.text: it does not need to be
mapped in idmap. Lets move it to .rodata as it is never written to after
early boot of the primary CPU.
(Maybe .data.ro_after_init would be cleaner though?)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
---
arch/arm64/kernel/head.S | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 6e08ee2b4d55..8e5c0e0040e4 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -457,17 +457,19 @@ SYM_FUNC_START_LOCAL(__primary_switched)
b start_kernel
SYM_FUNC_END(__primary_switched)
+ .pushsection ".rodata", "a"
+SYM_DATA_START(kimage_vaddr)
+ .quad _text - TEXT_OFFSET
+SYM_DATA_END(kimage_vaddr)
+EXPORT_SYMBOL(kimage_vaddr)
+ .popsection
+
/*
* end early head section, begin head code that is also used for
* hotplug and needs to have the same protections as the text region
*/
.section ".idmap.text","awx"
-SYM_DATA_START(kimage_vaddr)
- .quad _text - TEXT_OFFSET
-SYM_DATA_END(kimage_vaddr)
-EXPORT_SYMBOL(kimage_vaddr)
-
/*
* If we're fortunate enough to boot at EL2, ensure that the world is
* sane before dropping to EL1.
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: move kimage_vaddr to .rodata
2020-03-12 9:40 [PATCH] arm64: move kimage_vaddr to .rodata Rémi Denis-Courmont
@ 2020-03-12 16:40 ` Mark Rutland
2020-03-12 16:42 ` Remi Denis-Courmont
2020-03-16 10:32 ` Rémi Denis-Courmont
2020-03-17 22:26 ` Will Deacon
2020-03-20 18:24 ` Catalin Marinas
2 siblings, 2 replies; 7+ messages in thread
From: Mark Rutland @ 2020-03-12 16:40 UTC (permalink / raw)
To: Rémi Denis-Courmont
Cc: linux-arm-kernel, suzuki.poulose, maz, linux-kernel, james.morse,
catalin.marinas, will, kvmarm, julien.thierry.kdev,
ard.biesheuvel
On Thu, Mar 12, 2020 at 11:40:02AM +0200, Rémi Denis-Courmont wrote:
> From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
>
> This datum is not referenced from .idmap.text: it does not need to be
> mapped in idmap. Lets move it to .rodata as it is never written to after
> early boot of the primary CPU.
> (Maybe .data.ro_after_init would be cleaner though?)
Can we move this into arch/arm64/mm/mmu.c, where we already have
kimage_voffset:
| u64 kimage_voffset __ro_after_init;
| EXPORT_SYMBOL(kimage_voffset);
... or is it not possible to initialize kimage_vaddr correctly in C?
Thanks,
Mark.
>
> Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
> ---
> arch/arm64/kernel/head.S | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index 6e08ee2b4d55..8e5c0e0040e4 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -457,17 +457,19 @@ SYM_FUNC_START_LOCAL(__primary_switched)
> b start_kernel
> SYM_FUNC_END(__primary_switched)
>
> + .pushsection ".rodata", "a"
> +SYM_DATA_START(kimage_vaddr)
> + .quad _text - TEXT_OFFSET
> +SYM_DATA_END(kimage_vaddr)
> +EXPORT_SYMBOL(kimage_vaddr)
> + .popsection
> +
> /*
> * end early head section, begin head code that is also used for
> * hotplug and needs to have the same protections as the text region
> */
> .section ".idmap.text","awx"
>
> -SYM_DATA_START(kimage_vaddr)
> - .quad _text - TEXT_OFFSET
> -SYM_DATA_END(kimage_vaddr)
> -EXPORT_SYMBOL(kimage_vaddr)
> -
> /*
> * If we're fortunate enough to boot at EL2, ensure that the world is
> * sane before dropping to EL1.
> --
> 2.25.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: move kimage_vaddr to .rodata
2020-03-12 16:40 ` Mark Rutland
@ 2020-03-12 16:42 ` Remi Denis-Courmont
2020-03-16 10:32 ` Rémi Denis-Courmont
1 sibling, 0 replies; 7+ messages in thread
From: Remi Denis-Courmont @ 2020-03-12 16:42 UTC (permalink / raw)
To: Mark Rutland
Cc: linux-arm-kernel, suzuki.poulose, maz, linux-kernel, james.morse,
catalin.marinas, will, kvmarm, julien.thierry.kdev,
ard.biesheuvel
Le 2020-03-12 18:40, Mark Rutland a écrit :
> On Thu, Mar 12, 2020 at 11:40:02AM +0200, Rémi Denis-Courmont wrote:
>> From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
>>
>> This datum is not referenced from .idmap.text: it does not need to be
>> mapped in idmap. Lets move it to .rodata as it is never written to
>> after
>> early boot of the primary CPU.
>> (Maybe .data.ro_after_init would be cleaner though?)
>
> Can we move this into arch/arm64/mm/mmu.c, where we already have
> kimage_voffset:
>
> | u64 kimage_voffset __ro_after_init;
> | EXPORT_SYMBOL(kimage_voffset);
>
> ... or is it not possible to initialize kimage_vaddr correctly in C?
Good question... I'll check tomorrow.
--
Rémi Denis-Courmont
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: move kimage_vaddr to .rodata
2020-03-12 16:40 ` Mark Rutland
2020-03-12 16:42 ` Remi Denis-Courmont
@ 2020-03-16 10:32 ` Rémi Denis-Courmont
1 sibling, 0 replies; 7+ messages in thread
From: Rémi Denis-Courmont @ 2020-03-16 10:32 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Mark Rutland, suzuki.poulose, catalin.marinas, ard.biesheuvel,
linux-kernel, james.morse, julien.thierry.kdev, maz, will
Le torstaina 12. maaliskuuta 2020, 18.40.36 EET Mark Rutland a écrit :
> On Thu, Mar 12, 2020 at 11:40:02AM +0200, Rémi Denis-Courmont wrote:
> > From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
> >
> > This datum is not referenced from .idmap.text: it does not need to be
> > mapped in idmap. Lets move it to .rodata as it is never written to after
> > early boot of the primary CPU.
> > (Maybe .data.ro_after_init would be cleaner though?)
>
> Can we move this into arch/arm64/mm/mmu.c, where we already have
>
> kimage_voffset:
> | u64 kimage_voffset __ro_after_init;
> | EXPORT_SYMBOL(kimage_voffset);
>
> ... or is it not possible to initialize kimage_vaddr correctly in C?
Currently TEXT_OFFSET is defined by the Makefile only for assembler sources and
the linker script. So that would need to be exposed to CPPFLAGS as well.
--
Реми Дёни-Курмон
http://www.remlab.net/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: move kimage_vaddr to .rodata
2020-03-12 9:40 [PATCH] arm64: move kimage_vaddr to .rodata Rémi Denis-Courmont
2020-03-12 16:40 ` Mark Rutland
@ 2020-03-17 22:26 ` Will Deacon
2020-03-20 18:24 ` Catalin Marinas
2 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2020-03-17 22:26 UTC (permalink / raw)
To: Rémi Denis-Courmont
Cc: linux-arm-kernel, linux-kernel, maz, james.morse,
julien.thierry.kdev, suzuki.poulose, kvmarm, catalin.marinas
On Thu, Mar 12, 2020 at 11:40:02AM +0200, Rémi Denis-Courmont wrote:
> From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
>
> This datum is not referenced from .idmap.text: it does not need to be
> mapped in idmap. Lets move it to .rodata as it is never written to after
> early boot of the primary CPU.
> (Maybe .data.ro_after_init would be cleaner though?)
>
> Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
> ---
> arch/arm64/kernel/head.S | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index 6e08ee2b4d55..8e5c0e0040e4 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -457,17 +457,19 @@ SYM_FUNC_START_LOCAL(__primary_switched)
> b start_kernel
> SYM_FUNC_END(__primary_switched)
>
> + .pushsection ".rodata", "a"
> +SYM_DATA_START(kimage_vaddr)
> + .quad _text - TEXT_OFFSET
> +SYM_DATA_END(kimage_vaddr)
> +EXPORT_SYMBOL(kimage_vaddr)
> + .popsection
> +
> /*
> * end early head section, begin head code that is also used for
> * hotplug and needs to have the same protections as the text region
> */
> .section ".idmap.text","awx"
>
> -SYM_DATA_START(kimage_vaddr)
> - .quad _text - TEXT_OFFSET
> -SYM_DATA_END(kimage_vaddr)
> -EXPORT_SYMBOL(kimage_vaddr)
Acked-by: Will Deacon <will@kernel.org>
Will
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] arm64: move kimage_vaddr to .rodata
2020-03-12 9:40 [PATCH] arm64: move kimage_vaddr to .rodata Rémi Denis-Courmont
2020-03-12 16:40 ` Mark Rutland
2020-03-17 22:26 ` Will Deacon
@ 2020-03-20 18:24 ` Catalin Marinas
2 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2020-03-20 18:24 UTC (permalink / raw)
To: Rémi Denis-Courmont
Cc: linux-arm-kernel, linux-kernel, maz, james.morse,
julien.thierry.kdev, suzuki.poulose, kvmarm, will
On Thu, Mar 12, 2020 at 11:40:02AM +0200, Rémi Denis-Courmont wrote:
> From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
>
> This datum is not referenced from .idmap.text: it does not need to be
> mapped in idmap. Lets move it to .rodata as it is never written to after
> early boot of the primary CPU.
> (Maybe .data.ro_after_init would be cleaner though?)
>
> Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
Queued for 5.7. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] arm64: move kimage_vaddr to .rodata
@ 2020-03-12 9:38 Rémi Denis-Courmont
0 siblings, 0 replies; 7+ messages in thread
From: Rémi Denis-Courmont @ 2020-03-12 9:38 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: linux-kernel, catalin.marinas, will
From: Remi Denis-Courmont <remi.denis.courmont@huawei.com>
This datum is not referenced from .idmap.text: it does not need to be
mapped in idmap. Lets move it to .rodata as it is never written to after
early boot of the primary CPU.
(Maybe .data.ro_after_init would be cleaner though?)
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
---
arch/arm64/kernel/head.S | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 6e08ee2b4d55..8e5c0e0040e4 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -457,17 +457,19 @@ SYM_FUNC_START_LOCAL(__primary_switched)
b start_kernel
SYM_FUNC_END(__primary_switched)
+ .pushsection ".rodata", "a"
+SYM_DATA_START(kimage_vaddr)
+ .quad _text - TEXT_OFFSET
+SYM_DATA_END(kimage_vaddr)
+EXPORT_SYMBOL(kimage_vaddr)
+ .popsection
+
/*
* end early head section, begin head code that is also used for
* hotplug and needs to have the same protections as the text region
*/
.section ".idmap.text","awx"
-SYM_DATA_START(kimage_vaddr)
- .quad _text - TEXT_OFFSET
-SYM_DATA_END(kimage_vaddr)
-EXPORT_SYMBOL(kimage_vaddr)
-
/*
* If we're fortunate enough to boot at EL2, ensure that the world is
* sane before dropping to EL1.
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-20 18:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 9:40 [PATCH] arm64: move kimage_vaddr to .rodata Rémi Denis-Courmont
2020-03-12 16:40 ` Mark Rutland
2020-03-12 16:42 ` Remi Denis-Courmont
2020-03-16 10:32 ` Rémi Denis-Courmont
2020-03-17 22:26 ` Will Deacon
2020-03-20 18:24 ` Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2020-03-12 9:38 Rémi Denis-Courmont
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).