Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp159883yba; Tue, 14 May 2019 22:02:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfi1CROWg7WJklPHMvOXeLktBw8R3YWQGPNFevexN8xo9kOMj2/dD+QBjix9T+o+PCmrIs X-Received: by 2002:a63:1a03:: with SMTP id a3mr42329953pga.412.1557896565030; Tue, 14 May 2019 22:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557896565; cv=none; d=google.com; s=arc-20160816; b=Fgb6r5MhRxwZySq9Xf22GjtGI+bOygcoxv21ykmGtK1gqPd8PmvL97WZwDsw25Ghly jvOPCuOkzzx7wjAIxWehi5/sNaqXEGgRDwvqFxp4qZHC/jahIgjc3DvdVrgJmSxlc84c Ja2NDTb1O9kpGWt7DSa3tKp+oclxDsnU3d+y4D8yHkwdAe/XMoiW+mIGwM69uw+5mRR/ XBB6j3RmoWdOtBDpsZd+6a4QUpbJIvcrysgB8m+tACfwTuPJi6fAt6Ic45hlBpI/kzto dbCioc9bvph4yLkzT0/tlUztpHUYr0bWiuH3dnekHz/wZ5q1YckzrVKHdkA7QoYHxCvK VroQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date; bh=Va1m0+6s1zTTLSUD911P0aRurnmDav8CL/rNzaX05eg=; b=ifDOwnjR7gVMt3/IamVCg8PbZiECrKqyexmrKL12c8PKbPU4C1A43OKrl/URD/zFRE VTKV1/dKj9fEkvlj0aU+52NdiTbV5FiCXobeaDYKpHryu7T5Dp13PFVlMzxl0sS3ccUE R0CUm3AJAdc8sPV1bOTUR8EuxqFNaEV0897uO3uu8MrArCn1PLzG/3dlgo0IF+h/ufUo cSZVh55iPan+hEtjwCqX0vMxJu2KMxTDQOBjvMDYy+sbcl+gZORT3ZRLyPdoBi+CcgdZ RpfAhWNeUlBocHQrOgfl3Cn8rz5SOo5rnYdywE1VkLiREiOsgH4a8Dx2nQDhpZIg6dHl 2/WQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r140si865459pgr.585.2019.05.14.22.02.28; Tue, 14 May 2019 22:02:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbfEOFBO (ORCPT + 99 others); Wed, 15 May 2019 01:01:14 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33056 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725876AbfEOFBO (ORCPT ); Wed, 15 May 2019 01:01:14 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4F4w0BL120299 for ; Wed, 15 May 2019 01:01:12 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2sgaxgtyqw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 May 2019 01:01:12 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 15 May 2019 06:01:10 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 15 May 2019 06:01:03 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4F512xp42795236 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 May 2019 05:01:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8CD14A4057; Wed, 15 May 2019 05:01:02 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36EDBA406E; Wed, 15 May 2019 05:01:01 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.112]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 15 May 2019 05:01:01 +0000 (GMT) Date: Wed, 15 May 2019 08:00:59 +0300 From: Mike Rapoport To: Stephen Boyd Cc: Hsin-Yi Wang , "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 Subject: Re: [PATCH v2 2/2] amr64: map FDT as RW for early_init_dt_scan() References: <20190513003819.356-1-hsinyi@chromium.org> <20190513003819.356-2-hsinyi@chromium.org> <20190513085853.GB9271@rapoport-lnx> <155786794318.14659.2925897827978978040@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <155786794318.14659.2925897827978978040@swboyd.mtv.corp.google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19051505-0028-0000-0000-0000036DCC02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19051505-0029-0000-0000-0000242D606A Message-Id: <20190515050059.GA4081@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-05-15_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905150031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 14, 2019 at 02:05:43PM -0700, Stephen Boyd wrote: > 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? There's no desire to call memblock_reserve() twice. It's just that leaving the call for it in kaslr rather than in setup_arch() may end up with unreserved FDT because kaslr was disabled or even compiled out. I've suggested to use fixmap_remap_fdt() everywhere because IMHO this improves readability and allows to un-export __fixmap_remap_fdt(). -- Sincerely yours, Mike.