Message ID | 20200611134914.765827-2-gregory.clement@bootlin.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM: Add support for large kernel page (from 8K to 64K) | expand |
On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT <gregory.clement@bootlin.com> wrote: > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In > order to be able to use other size of page than 4K, use PAGE_SIZE > instead of the hardcoded value. > > The use of PAGE_SIZE will be also aligned with what we find in other > architectures such as arm64. > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page > sizes") from > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> IIRC using page sizes above 16KB here also requires using a non-ancient linker in user space that places sections on ELF_EXEC_PAGESIZE boundaries, right? Arnd
On Fri, Jun 12, 2020 at 10:22:17AM +0200, Arnd Bergmann wrote: > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > <gregory.clement@bootlin.com> wrote: > > > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In > > order to be able to use other size of page than 4K, use PAGE_SIZE > > instead of the hardcoded value. > > > > The use of PAGE_SIZE will be also aligned with what we find in other > > architectures such as arm64. > > > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and > > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page > > sizes") from > > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git > > > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > > IIRC using page sizes above 16KB here also requires using a > non-ancient linker in user space that places sections on > ELF_EXEC_PAGESIZE boundaries, right? Doesn't that mean that this change breaks all existing userspace when ELF_EXEC_PAGESIZE is not 4k?
On Fri, Jun 12, 2020 at 10:35 AM Russell King - ARM Linux admin <linux@armlinux.org.uk> wrote: > On Fri, Jun 12, 2020 at 10:22:17AM +0200, Arnd Bergmann wrote: > > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > > <gregory.clement@bootlin.com> wrote: > > > > > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In > > > order to be able to use other size of page than 4K, use PAGE_SIZE > > > instead of the hardcoded value. > > > > > > The use of PAGE_SIZE will be also aligned with what we find in other > > > architectures such as arm64. > > > > > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and > > > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page > > > sizes") from > > > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git > > > > > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > > > > IIRC using page sizes above 16KB here also requires using a > > non-ancient linker in user space that places sections on > > ELF_EXEC_PAGESIZE boundaries, right? Correction: I was thinking of SHMLBA, not ELF_EXEC_PAGESIZE. SHMLBA is defined to 16KB in arch/arm/ at the moment (based on 4K page size), or (4 * PAGE_SIZE) on arm64, which can blow up to 256KB. AFAICT, SHMLBA should now be defined as "min(16384, PAGE_SIZE)". > Doesn't that mean that this change breaks all existing userspace when > ELF_EXEC_PAGESIZE is not 4k? I think a lot of older user space would be broken with page sizes larger than 16KB, but would still work with 8KB or 16KB. Larger page sizes would only work with user space that was linked in the last five years or so, using a toolchain that has the workarounds for running on arm64 with 64KB page size. Arnd
On Fri, Jun 12, 2020 at 10:46:17AM +0200, Arnd Bergmann wrote: > Correction: I was thinking of SHMLBA, not ELF_EXEC_PAGESIZE. > SHMLBA is defined to 16KB in arch/arm/ at the moment (based on 4K > page size), or (4 * PAGE_SIZE) on arm64, which can blow up to 256KB. > > AFAICT, SHMLBA should now be defined as "min(16384, PAGE_SIZE)". Yes, because the 16k comes from the aliasing VIPT cache to avoid aliases.
Hello Arnd, > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > <gregory.clement@bootlin.com> wrote: >> >> Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In >> order to be able to use other size of page than 4K, use PAGE_SIZE >> instead of the hardcoded value. >> >> The use of PAGE_SIZE will be also aligned with what we find in other >> architectures such as arm64. >> >> This is inspired from fa0ca2726ea9 ("DSMP 64K support") and >> 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page >> sizes") from >> https://github.com/MarvellEmbeddedProcessors/linux-marvell.git >> >> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > > IIRC using page sizes above 16KB here also requires using a > non-ancient linker in user space that places sections on > ELF_EXEC_PAGESIZE boundaries, right? Actually I only tested the kernel with userspace built with pretty recent toolchains. The oldest one I used was using gcc 7.3 and ld 2.28. Gregory > > Arnd
On Fri, Jun 12, 2020 at 10:46:17AM +0200, Arnd Bergmann wrote: > On Fri, Jun 12, 2020 at 10:35 AM Russell King - ARM Linux admin > <linux@armlinux.org.uk> wrote: > > On Fri, Jun 12, 2020 at 10:22:17AM +0200, Arnd Bergmann wrote: > > > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > > > <gregory.clement@bootlin.com> wrote: > > > > > > > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In > > > > order to be able to use other size of page than 4K, use PAGE_SIZE > > > > instead of the hardcoded value. > > > > > > > > The use of PAGE_SIZE will be also aligned with what we find in other > > > > architectures such as arm64. > > > > > > > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and > > > > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page > > > > sizes") from > > > > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git > > > > > > > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> > > > > > > IIRC using page sizes above 16KB here also requires using a > > > non-ancient linker in user space that places sections on > > > ELF_EXEC_PAGESIZE boundaries, right? > > Correction: I was thinking of SHMLBA, not ELF_EXEC_PAGESIZE. > SHMLBA is defined to 16KB in arch/arm/ at the moment (based on 4K > page size), or (4 * PAGE_SIZE) on arm64, which can blow up to 256KB. > > AFAICT, SHMLBA should now be defined as "min(16384, PAGE_SIZE)". Good point. We should do this with the COMPAT_SHMLBA on arm64 (we didn't bother since COMPAT had a dependency on 4K but you can override it with EXPERT). > > Doesn't that mean that this change breaks all existing userspace when > > ELF_EXEC_PAGESIZE is not 4k? > > I think a lot of older user space would be broken with page sizes larger > than 16KB, but would still work with 8KB or 16KB. Larger page sizes > would only work with user space that was linked in the last five years > or so, using a toolchain that has the workarounds for running on arm64 > with 64KB page size. FWIW, Debian armhf now boots fine on an arm64 kernel with 64K pages (it wasn't the case some years ago).
Hi Arnd, > On Fri, Jun 12, 2020 at 10:35 AM Russell King - ARM Linux admin > <linux@armlinux.org.uk> wrote: >> On Fri, Jun 12, 2020 at 10:22:17AM +0200, Arnd Bergmann wrote: >> > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT >> > <gregory.clement@bootlin.com> wrote: >> > > >> > > Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In >> > > order to be able to use other size of page than 4K, use PAGE_SIZE >> > > instead of the hardcoded value. >> > > >> > > The use of PAGE_SIZE will be also aligned with what we find in other >> > > architectures such as arm64. >> > > >> > > This is inspired from fa0ca2726ea9 ("DSMP 64K support") and >> > > 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page >> > > sizes") from >> > > https://github.com/MarvellEmbeddedProcessors/linux-marvell.git >> > > >> > > Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> >> > >> > IIRC using page sizes above 16KB here also requires using a >> > non-ancient linker in user space that places sections on >> > ELF_EXEC_PAGESIZE boundaries, right? > > Correction: I was thinking of SHMLBA, not ELF_EXEC_PAGESIZE. > SHMLBA is defined to 16KB in arch/arm/ at the moment (based on 4K > page size), or (4 * PAGE_SIZE) on arm64, which can blow up to 256KB. > > AFAICT, SHMLBA should now be defined as "min(16384, PAGE_SIZE)". We took care of it in patch 5: +#ifdef CONFIG_ARM_LARGE_PAGE_SUPPORT +#define SHMLBA (16 << 10) /* attach addr a multiple of (4 * 4096) */ +#else #define SHMLBA (4 * PAGE_SIZE) /* attach addr a multiple of this */ +#endif But your version is better, with it we don't need anymore this ifdef. Gregory > >> Doesn't that mean that this change breaks all existing userspace when >> ELF_EXEC_PAGESIZE is not 4k? > > I think a lot of older user space would be broken with page sizes larger > than 16KB, but would still work with 8KB or 16KB. Larger page sizes > would only work with user space that was linked in the last five years > or so, using a toolchain that has the workarounds for running on arm64 > with 64KB page size. > > Arnd
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index b078d992414b..0e406ce25379 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -116,7 +116,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs); #define ELF_CORE_COPY_TASK_REGS dump_task_regs #define CORE_DUMP_USE_REGSET -#define ELF_EXEC_PAGESIZE 4096 +#define ELF_EXEC_PAGESIZE PAGE_SIZE /* This is the base location for PIE (ET_DYN with INTERP) loads. */ #define ELF_ET_DYN_BASE 0x400000UL
Currently ELF_EXEC_PAGESIZE is 4096 which is also the page size. In order to be able to use other size of page than 4K, use PAGE_SIZE instead of the hardcoded value. The use of PAGE_SIZE will be also aligned with what we find in other architectures such as arm64. This is inspired from fa0ca2726ea9 ("DSMP 64K support") and 4ef803e12baf ("mmu: large-page: Added support for multiple kernel page sizes") from https://github.com/MarvellEmbeddedProcessors/linux-marvell.git Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> --- arch/arm/include/asm/elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)