From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 182E4C04AB4 for ; Tue, 14 May 2019 21:05:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D967820879 for ; Tue, 14 May 2019 21:05:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HNMe7lJX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726336AbfENVFq (ORCPT ); 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-Google-Smtp-Source: APXvYqz18bKfEM+qcHPBKQrWe+JFncgiIpoNu7rrAuyxF/9xscQmII8ueAu5RYyZ1oE1cXXVHko4AQ== 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? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: Re: [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan() Date: Tue, 14 May 2019 14:05:43 -0700 Message-ID: <155786794318.14659.2925897827978978040@swboyd.mtv.corp.google.com> References: <20190513003819.356-1-hsinyi@chromium.org> <20190513003819.356-2-hsinyi@chromium.org> <20190513085853.GB9271@rapoport-lnx> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Hsin-Yi Wang , Mike Rapoport Cc: Mark Rutland , devicetree@vger.kernel.org, Architecture Mailman List , Michal Hocko , Kees Cook , Ard Biesheuvel , Catalin Marinas , Rasmus Villemoes , linux-kernel@vger.kernel.org, Will Deacon , Miles Chen , Rob Herring , James Morse , Andrew Murray , Andrew Morton , Frank Rowand , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" List-Id: devicetree@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: > > > > > 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? > 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? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4E04C04AB4 for ; Tue, 14 May 2019 21:05:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E17F20879 for ; Tue, 14 May 2019 21:05:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PQr/QkUC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HNMe7lJX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E17F20879 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-ID:To:Subject:From: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w557P+rwa6rJEpvYzAZp+grLaawBkj9MjsGtQzhG/R0=; b=PQr/QkUCSdhCgd F6CbIH12kmK7v45w07UluS+pCGsv/9z8UtDmUDwOeBIqNBx1N3cdOPNPonyCkFbKDVf9pmm6f+fqX CQQYaE2KBWoaRwwB1hhYE5pQhES0i7QlVJImOuXC29dqAdPazU/dm0lY8bO888/OM0lbmrmUT5+Ft M91orW7DOnYFL65d30eSutbttFseBg4A2WAYuRWuZna2iF16ltntwLyqeLeXPDZe3UZEE33I4ykPw aTX1MSWW40Xi6aX92+mVIiriB64JnlqapwjrFICA8yt9GVKUtE1LMVxL4uESqrJbzJSQBFMoMBXZl uT26F03xMxco9/erknFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQecP-0005IO-84; Tue, 14 May 2019 21:05:49 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hQecM-0005I5-6j for linux-arm-kernel@lists.infradead.org; Tue, 14 May 2019 21:05:47 +0000 Received: by mail-pg1-x543.google.com with SMTP id z16so162996pgv.11 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=RDF6iSPAeyyNdWm6nIrIu43vcCqvPvKL4F9MyVD1nSHTT96H6g7PNqYa9oXg5vmwx/ s430RkSSKQxRd14QcRKfgLtlCmPbDDmUKHJ64Hx0oXz9f24vY8WVP8JzCyz7l/TDlpFW aWSRkKzqV8oSRDDybcDGEuzGTzog0fejwnIJbr7XYg7HInLJ5CAHSDL7nf3/zJALiNdf X3htdzC+Vt06gkmrnoC6meS17FHiM26EUCibGx/bCMi6Yq67u2fH5y/w6qYo/2ngpXDq 5TR0IaKSDq4tWyj5irCxp2ejaOduKhFBsgCcPhp5OnrkbqcpjUa/nFOZLbwwfUYl7Gaw Sezg== X-Gm-Message-State: APjAAAV8RNlTEy42rzgLUsusxObQtL6tkzRfz/nyF2/Gj6IcPTgMtFor mTIe72A3NS2rKqHmFip9fWm7cxgGfYg6Pw== X-Google-Smtp-Source: APXvYqz18bKfEM+qcHPBKQrWe+JFncgiIpoNu7rrAuyxF/9xscQmII8ueAu5RYyZ1oE1cXXVHko4AQ== 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) MIME-Version: 1.0 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() 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190514_140546_272389_943EC7FF X-CRM114-Status: GOOD ( 17.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Architecture Mailman List , Michal Hocko , Kees Cook , Ard Biesheuvel , Catalin Marinas , Rasmus Villemoes , linux-kernel@vger.kernel.org, Will Deacon , Miles Chen , Rob Herring , James Morse , Andrew Murray , Andrew Morton , Frank Rowand , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting Hsin-Yi Wang (2019-05-13 04:14:32) > On Mon, May 13, 2019 at 4:59 PM Mike Rapoport 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? > 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? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel