Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6807763yba; Tue, 14 May 2019 14:08:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyH9zfn9mCfI3AcFksN0FEoSExVke45rbVv3rGtpIs5S9bbVsr5gfzMlWi9TffeFzjG8gt2 X-Received: by 2002:a65:5647:: with SMTP id m7mr39485915pgs.348.1557868116757; Tue, 14 May 2019 14:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557868116; cv=none; d=google.com; s=arc-20160816; b=IGAKLSPVEgiv/Kh8b+kcDsFBR5lQBO6G97RXEFDGJvOnXKfHRz0mTasKi4aTTTWSxS 9Xxmha+gWO/Z7YBKhndeYQrwI2y1OhaYQ1W1/+BGcp2jvifLXh+rHjv8LKPZNeLJlWxE e8kyxJfMW+/10SJMk3APoMYxholRVMk7krWAIIZdg1HZV6JKCCnXLwzXUCbdmKdrKGh8 N/Qza1Vvapie1g5CtVz2Up3Zuz8M+suZ4E2mR9caKBerQMKnZYWPyQeROlk3nk/06pTD vvvjDI19Vq146eBzMZOBN/S5R7IvCUDVt122crxKMtOFSOF61Nm/zh+udFyIJt9xU43+ oZmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:message-id:to:cc:subject :from:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=AWxN5ptvu2yKLcW7Bm5LBMGr1ZVlYaAwhpzhB0nfW30=; b=FJO3wayO4l9E9VDCthowq+dgz998+okpJ6rpfa4I4C7EYiYDOX9bDfnXcpkhgaQJhV 55h4NvGyKh3oqf6ajUQ4wIo29n7uigNxB4UVso1MJi+5DZut7h3ef7OAFaXud+HI0UJG 3M2oIEIKn5eJjEvOHT6sesJklLoHNn2LwyQOzAz71zCG1Bf+WBPVOWpe+OmEv29WIuR6 i6Kh4YwTzOnW66cJmEbRQ5JHPHNCocE1nOTCuXqEu1wl4+X3hsVTegS9NveuIzaNE5F0 3EUuiNwk3RykzYW/58/kBn+aG1DQU7KHmEcmgaQtloILVKrQrKgKoNl4N3WtUPoJ01J3 l5Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HNMe7lJX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g34si2743276pld.402.2019.05.14.14.08.19; Tue, 14 May 2019 14:08:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HNMe7lJX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbfENVFq (ORCPT + 99 others); Tue, 14 May 2019 17:05:46 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40344 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfENVFp (ORCPT ); Tue, 14 May 2019 17:05:45 -0400 Received: by mail-pg1-f196.google.com with SMTP id d31so172462pgl.7 for ; Tue, 14 May 2019 14:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references:from :subject:cc:to:message-id:user-agent:date; bh=AWxN5ptvu2yKLcW7Bm5LBMGr1ZVlYaAwhpzhB0nfW30=; b=HNMe7lJXqBT7y/2cp+foZU0p50cuTfYKYZaABdqFDmkYX0VtYXw/Kvo3ZvmvCEzShG WSo8VBK5+qTNJbQ9jH9/9p27q8As73WWcxqiY7ehdNv6hnmu4NF7FABbOlZFSkoE1wV6 ToM2vsichYz943+Om1qhsn7V2bTiJylmDMwOs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:from:subject:cc:to:message-id:user-agent :date; bh=AWxN5ptvu2yKLcW7Bm5LBMGr1ZVlYaAwhpzhB0nfW30=; b=BSTG5wgUYEQNI40iIm//6hYYLMU3cbdCTCH3OP1UkV+O5Trk3zORfFde5m08vEsfwB bNC5TMyZeWsOAZY1seaCLcamr9omepz9LCPHvtNFyjbNayYWhPc4u9fvmd+62w1zsFHT gGgAOxBWkV3PdWV4V9fzUgFsqpHiCfNQqUcNzfcF1wcESY/0Y1gC+0tuiq2BZ3+G2L+c f4RqwoF4Ps71ODbOiEkyJDF08WqeTdZxCQBffSpkvw3u6OCm+FgFFlwI0L66Sh1OieiM 3in4O/CqArPv3V6Y6cH/Z3Y9vJovcjzuc4WvPlYqymj0x/TLG4tNC3ato5J5fFW7e7yR nogQ== X-Gm-Message-State: APjAAAXad3qa1D2Ya1aYgT0fDghKoXwA2hJRNx3vG3VEtBH8rp6/IOog YrvhqrI8dovjVysiqpADRYGExg== X-Received: by 2002:aa7:8186:: with SMTP id g6mr43384614pfi.126.1557867944834; Tue, 14 May 2019 14:05:44 -0700 (PDT) Received: from localhost ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id n35sm28281pgl.44.2019.05.14.14.05.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 May 2019 14:05:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: References: <20190513003819.356-1-hsinyi@chromium.org> <20190513003819.356-2-hsinyi@chromium.org> <20190513085853.GB9271@rapoport-lnx> From: Stephen Boyd Subject: Re: [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan() Cc: "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Rob Herring , Mark Rutland , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Rasmus Villemoes , Architecture Mailman List , Catalin Marinas , Will Deacon , Andrew Morton , Michal Hocko , Ard Biesheuvel , Miles Chen , James Morse , Andrew Murray To: Hsin-Yi Wang , Mike Rapoport Message-ID: <155786794318.14659.2925897827978978040@swboyd.mtv.corp.google.com> User-Agent: alot/0.8 Date: Tue, 14 May 2019 14:05:43 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Hsin-Yi Wang (2019-05-13 04:14:32) > On Mon, May 13, 2019 at 4:59 PM Mike Rapoport wrote: >=20 > > > > 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, thi= ngs > > happen. > > > > IMHO, instead of calling directly __fixmap_remap_fdt() it would be bett= er > > 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. >=20 > 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#L= 601 > ``` > if (type->regions[0].size =3D=3D 0) { > WARN_ON(type->cnt !=3D 1 || type->total_size); > ... > ``` >=20 > Call memblock_reserve() multiple times after setup_machine_fdt() > doesn't have such warning though. >=20 > I didn't trace the real reason causing this. But in this case, maybe > don't call memblock_reserve() in kaslr? >=20 Why not just have fixmap_remap_fdt() that maps it as RW and reserves memblock once, and then call __fixmap_remap_fdt() with RO after early_init_dt_scan() or unflatten_device_tree() is called? Why the desire to call memblock_reserve() twice or even three times?