Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] arch/arc: Explicitly set "max-page-size" for GNU LD
Date: Wed, 25 Dec 2019 22:36:03 +0100	[thread overview]
Message-ID: <20191225223603.360a7ffa@windsurf> (raw)
In-Reply-To: <20191224141032.34544-1-abrodkin@synopsys.com>

On Tue, 24 Dec 2019 17:10:32 +0300
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:

> Back in the day we relied on a default value that used to be 8KiB
> and it worked perfectly fine for ARC's default 8KiB page as well as
> 4 KiB ones, but not for 16 KiB, see [1] for more details.
> 
> So that we fixed by setting "max-page-size" if 16KiB pages are in use by
> commit d024d369b82d2 ("arch/arc: Accommodate 16 KiB MMU pages").
> 
> But as Yann very rightfully mentioned here [2] we should be setting this
> thing explicitly for all page sizes because:
>  1. Defaults might change unexpectedly
>  2. Explicitly set stuff is better understood
>  3. We act similarly to all settings but not only addressing some corner cases
> 
> [1] https://git.buildroot.org/buildroot/commit/?id=d024d369b82d2d3d9d4d75489c19e9488202bca0
> [2] https://patchwork.ozlabs.org/patch/1212544/#2330647
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>

I have applied to master, with one change (see below), and I have one
suggestion (see below as well).


> -# By default MAXPAGESIZE for ARC is 8192 so for larger MMU pages
> -# it needs to be overridden.
> +# Explicitly set LD's "max-page-size" instead of relying on some defaults
> +ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
> +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
> +endif
> +
> +ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
> +ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
> +endif
> +
>  ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
>  ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
>  endif

Since these options are mutually exclusive:

ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
endif

is a bit more compact, so I changed to use this before committing.

Also, we already have an option called BR2_ARC_PAGE_SIZE, which
contains 4K, 8K or 16K, so I thought if we could use it here as well. I
think we can, but I'd like to hear from Yann about this, because it
uses bash arithmetic, which I'm not sure we're allowed to use:

ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=$(shell echo $$(($(patsubst %K,%,$(BR2_ARC_PAGE_SIZE)) * 1024)))

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-12-25 21:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24 14:10 [Buildroot] [PATCH] arch/arc: Explicitly set "max-page-size" for GNU LD Alexey Brodkin
2019-12-25 21:36 ` Thomas Petazzoni [this message]
2019-12-26 17:05   ` Yann E. MORIN
2019-12-27  9:00     ` [Buildroot] [arc-buildroot] " Alexey Brodkin
2019-12-27 15:43       ` 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=20191225223603.360a7ffa@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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