LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Hsin-Yi Wang <hsinyi@chromium.org>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Frank Rowand <frowand.list@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stephen Boyd <swboyd@chromium.org>,
	Kees Cook <keescook@chromium.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Architecture Mailman List <boot-architecture@lists.linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Miles Chen <miles.chen@mediatek.com>,
	James Morse <james.morse@arm.com>,
	Andrew Murray <andrew.murray@arm.com>
Subject: Re: [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan()
Date: Mon, 13 May 2019 19:14:32 +0800	[thread overview]
Message-ID: <CAJMQK-hKrU2J0_uGe3eO_JTNwM=HRkXbDx2u45izcdD7wqwGeQ@mail.gmail.com> (raw)
In-Reply-To: <20190513085853.GB9271@rapoport-lnx>

On Mon, May 13, 2019 at 4:59 PM Mike Rapoport <rppt@linux.ibm.com> wrote:

>
> This makes the fdt mapped without the call to meblock_reserve(fdt) which
> makes the fdt memory available for memblock allocations.
>
> Chances that is will be actually allocated are small, but you know, things
> happen.
>
> IMHO, instead of calling directly __fixmap_remap_fdt() it would be better
> to add pgprot parameter to fixmap_remap_fdt(). Then here and in kaslr.c it
> can be called with PAGE_KERNEL and below with PAGE_KERNEL_RO.
>
> There is no problem to call memblock_reserve() for the same area twice,
> it's essentially a NOP.
>
Thanks for the suggestion. Will update fixmap_remap_fdt() in next patch.

However, I tested on some arm64 platform, if we also call
memblock_reserve() in kaslr.c, would cause warning[1] when
memblock_reserve() is called again in setup_machine_fdt(). The warning
comes from https://elixir.bootlin.com/linux/latest/source/mm/memblock.c#L601
```
if (type->regions[0].size == 0) {
  WARN_ON(type->cnt != 1 || type->total_size);
  ...
```

Call memblock_reserve() multiple times after setup_machine_fdt()
doesn't have such warning though.

I didn't trace the real reason causing this. But in this case, maybe
don't call memblock_reserve() in kaslr?

[1]
[    0.000000] WARNING: CPU: 0 PID: 0 at
/mnt/host/source/src/third_party/kernel/v4.19/mm/memblock.c:583
memblock_add_range+0x1bc/0x1c8
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.38 #125
[    0.000000] pstate: 600001c5 (nZCv dAIF -PAN -UAO)
[    0.000000] pc : memblock_add_range+0x1bc/0x1c8
[    0.000000] lr : memblock_add_range+0x30/0x1c8
[    0.000000] sp : ffffff9b5e203e80
[    0.000000] x29: ffffff9b5e203ed0 x28: 0000000040959324
[    0.000000] x27: 0000000040080000 x26: 0000000000080000
[    0.000000] x25: 0000000080127e4b x24: 0000000000000000
[    0.000000] x23: 0000001b55000000 x22: 000000000001152b
[    0.000000] x21: 000000005f800000 x20: 0000000000000000
[    0.000000] x19: ffffff9b5e24bf00 x18: 00000000ffffffb8
[    0.000000] x17: 000000000000003c x16: ffffffbefea00000
[    0.000000] x15: ffffffbefea00000 x14: ffffff9b5e3c17d8
[    0.000000] x13: 00e8000000000713 x12: 0000000000000000
[    0.000000] x11: ffffffbefea00000 x10: 00e800005f800710
[    0.000000] x9 : 000000000001152b x8 : ffffff9b5e365690
[    0.000000] x7 : 6f20646573616228 x6 : 0000000000000002
[    0.000000] x5 : 0000000000000000 x4 : 0000000000000000
[    0.000000] x3 : 0000000000200000 x2 : 000000000001152b
[    0.000000] x1 : 000000005f800000 x0 : ffffff9b5e24bf00
[    0.000000] Call trace:
[    0.000000]  memblock_add_range+0x1bc/0x1c8
[    0.000000]  memblock_reserve+0x60/0xac
[    0.000000]  fixmap_remap_fdt+0x4c/0x78
[    0.000000]  setup_machine_fdt+0x64/0xfc
[    0.000000]  setup_arch+0x68/0x1e0
[    0.000000]  start_kernel+0x68/0x380

  reply	other threads:[~2019-05-13 11:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13  0:38 [PATCH v2 1/2] fdt: add support for rng-seed Hsin-Yi Wang
2019-05-13  0:38 ` [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan() Hsin-Yi Wang
2019-05-13  8:58   ` Mike Rapoport
2019-05-13 11:14     ` Hsin-Yi Wang [this message]
2019-05-14 15:42       ` Mike Rapoport
2019-05-15 10:24         ` Hsin-Yi Wang
2019-05-15 20:11           ` Ard Biesheuvel
2019-05-16 11:07             ` Mike Rapoport
2019-05-14 21:05       ` Stephen Boyd
2019-05-15  5:00         ` Mike Rapoport
2019-05-15 10:34           ` Hsin-Yi Wang
2019-05-13  8:42 ` [PATCH v2 1/2] fdt: add support for rng-seed Mike Rapoport
2019-05-13 13:14 ` Rob Herring
2019-05-15  9:07   ` Hsin-Yi Wang

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='CAJMQK-hKrU2J0_uGe3eO_JTNwM=HRkXbDx2u45izcdD7wqwGeQ@mail.gmail.com' \
    --to=hsinyi@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.murray@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=boot-architecture@lists.linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=james.morse@arm.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mark.rutland@arm.com \
    --cc=mhocko@suse.com \
    --cc=miles.chen@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=swboyd@chromium.org \
    --cc=will.deacon@arm.com \
    --subject='Re: [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan()' \
    /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

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).