From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: "Gaël PORTAY" <gael.portay@rtone.fr>
Cc: Adam Duskett <adam.duskett@amarulasolutions.com>,
Julien Grossholtz <julien.grossholtz@openest.io>,
Martin Bark <martin@barkynet.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 2/2] configs: add raspberrypi 5 defconfig
Date: Sat, 20 Jan 2024 09:53:17 +0100 [thread overview]
Message-ID: <ZauJ_dYctLmTPU_I@landeda> (raw)
In-Reply-To: <CYJDK0VJP7DC.3TY6V25XFO40U@rtone.fr>
Gaël, All,
On 2024-01-20 09:01 +0100, Gaël PORTAY spake thusly:
> On Sat Jan 20, 2024 at 4:11 AM CET, Adam Duskett wrote:
> > On Fri, Jan 19, 2024 at 1:36 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > > On 2023-12-11 16:59 +0100, Gaël PORTAY spake thusly:
> > > > This configuration builds an image for the RaspberryPi 5.
> > > > +BR2_ARM64_PAGE_SIZE_16K=y
> > > So, we choose 16K for the userland page alignment, because...
> > > > +BR2_LINUX_KERNEL_DEFCONFIG="bcm2712"
> > > ... the bcm2712_defconfig in the kernel tree default to use 16K pages:
> > > CONFIG_ARM64_16K_PAGES=y
> ... and because BCM2712 support 16k.
Yes, it _supports_ 16K pages, but it also supports 4K and 64K, so there
is no reason to shoose 16K or 64K over 4K, except for the fact that the
kernel defconfig uses 16K pages.
> Otherwise I would have chosen the
> bcm2711_defconfig that is 4K.
Isn't bcm2711_defconfig for the rpi4? It would be weird to use th rpi4
defconfig for the rpi5. Presumably, also, the rpi4 defconfig does not
enmable the drivers for the rpi5-only rp1 IOs...
So, using bcm2712_defconfig is understandable...
[--SNIP--]
> IIRC, I have built with:
>
> - the (internal) buildroot toolchain and it works (16k indeed).
> - the external Bootlin toolchain and it fails to run init (4k according
> to Thomas).
> - the external Arm AArch64 toolchain and it works (16k I guess ???).
>
> And thus, I suspect both userland and kernel page size must match.
Now I read buildroot/arch/Config.in.arm, which states:
... the kernel
configuration must match this choice. If your kernel is
built by Buildroot, the kernel configuration is
automatically adjusted, ...
So, it currently works, because:
- the toolchain is built by buildroot,
- the kernel is built by buildroot
So, if we were to set BR2_ARM64_PAGE_SIZE_4K instead, then it would
*also* work.
Which is my point. We should not be doing 16K pages on the rpi5 by
default.
The tests Adam did (thanks!), was to use your defconfig, and just switch
to the bootlin toolchain, which uncovered the two issues at hand.
> So, if the assomption is right (i.e. userland and kernel page sizes must
> match), I guess it would be interesting to filter-in (or to filter-out)
> the external toolchains that match the config because buildroot prompts
> for all the external toolchain; but some of them fail at runtime because
> of a mismatch page-size.
>
> What about introducing BR2_TOOLCHAIN_HAS_PAGE_SIZE_{4,16,64}K?
Yes, we'll have to do so.
The thing is, we are passing the proper ld flags in our wrapper (e.g.
for 16K):
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384
so we would eventually generated binaries that are 16K-enabled.
The problem is that the C library in an external toolchain will have
been built with an arbitrary page size, and we need to be able to find
out, if we want to check that.
For preconfigured toolchains, that's OK: all those we now ahve are
configured for 4K pages. They have to be, because nothing in Buildroot
enables non-4K pages for now.
But for a custom external toolchain, the user may not know, so we need
to validate that their choice is correct, e.g. lie we do for the type of
C library, the gcc or kernel headers versions, etc...
So, we need to:
1. add a depends on BR2_ARM64_PAGE_SIZE_4K to all current external
pre-configured aarch64 toolchains; ditto for arc; indeed, we should
simply hide the toolchains that do not have the page size the user
selected.
2. introduce BR2_TOOLCHAIN_EXTERNAL_PAGE_SIZE_{4,8,16,64}K (8K is for
arc) and BR2_TOOLCHAIN_EXTERNAL_PAGE_SIZE="{4,8,16,64}K" in
toolchain/toolchain-external/toolchain-external-custom/Config.in.options
and add a checkpage_size helper in toolchain/helpers.mk, that
validates that the C library was indeed built with the page size
BR2_TOOLCHAIN_EXTERNAL_PAGE_SIZE.
The last item, checking the page size a .so was built for, is not
something I know how to do, though... Any idea?
Note that 1. and 2. are separate, and doing 1. should be relatively
easy, and does not require 2.
> Or, I am totally wrong :/
Hehe! I am happy I would not walk alone! :-)
> Regards,
> Gaël
>
> PS: Also, BR could have two configs for pi5:
> - raspberrypi5_defconfig: 4k
> BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
> # BR2_ARM64_PAGE_SIZE_4K=y
> - raspberrypi5-16k_defconfig: 16k
> BR2_LINUX_KERNEL_DEFCONFIG="bcm2712"
> BR2_ARM64_PAGE_SIZE_16K=y
Not sure it would make much sense, if all the above proves to be
correct.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-01-20 8:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 15:59 [Buildroot] [PATCH v2 0/2] Add support for Pi5 Gaël PORTAY
2023-12-11 15:59 ` [Buildroot] [PATCH v2 1/2] arch: add support 16k page size on ARM64 Gaël PORTAY
2024-01-19 20:24 ` Yann E. MORIN
2023-12-11 15:59 ` [Buildroot] [PATCH v2 2/2] configs: add raspberrypi 5 defconfig Gaël PORTAY
2024-01-19 20:35 ` Yann E. MORIN
2024-01-20 3:11 ` Adam Duskett
2024-01-20 8:01 ` Gaël PORTAY
2024-01-20 8:53 ` Yann E. MORIN [this message]
2024-01-19 20:13 ` [Buildroot] [PATCH v2 0/2] Add support for Pi5 Yann E. MORIN
2024-01-20 8:10 ` Gaël PORTAY
2024-01-20 8:57 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZauJ_dYctLmTPU_I@landeda \
--to=yann.morin.1998@free.fr \
--cc=adam.duskett@amarulasolutions.com \
--cc=buildroot@buildroot.org \
--cc=gael.portay@rtone.fr \
--cc=julien.grossholtz@openest.io \
--cc=martin@barkynet.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox