Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4111805ybe; Mon, 16 Sep 2019 06:58:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDi6isu93K9JWz8m/1XC4ZVPPH7dg8mH3jygoYtA3wNxIsanPNQV8bBFBbngJ43qhMIBkb X-Received: by 2002:a17:906:19d9:: with SMTP id h25mr118426ejd.43.1568642283090; Mon, 16 Sep 2019 06:58:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568642283; cv=none; d=google.com; s=arc-20160816; b=HC4WGN15Ji4so/zKjDN5yRnQnQsOyWsCLqIuICRACe68KjLgKfL7hp3l7Cb85jeUab k6hxgkml8xEi0VmfFDnpbcgdF29iN+pw4exUKTJGyOJsrWAASN/EY1vzM7IvTcwT5qu/ dhhX9xAQhxmC5ucS8Rck3D2AJKkbBZQv50RJ345hr1sP9E254oHO9b9hciXjv04Ocwp8 F1Aw7DRJRxt/eYfoZiNKsqErzRpnoojm2EMqIXMiaAot8/bwAzG3Fc+aJE3hFuKhbJZj 9hvZiBP8A3K0EQtk1zSxJYN1eQTcXtTRReaZyhCe1Tcl3sTQy/nyN7zWuLyavlPsRGZ5 AqqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=W6F08vwnlVrU3LxmDqwELbYRQIKlhmJM4bTt33vzXII=; b=prGAH4bvDf79vzYhjv3ajqUYDsXDr/qwob4bUjW1Nihn+4ZDskjOA8VHA1Nk8nU1B2 Bu6mzLHuQMJ7xhL13EPgF1TXY7xTI3HyvJD/8EAhH/OlPAEM1LXrbr0ca2/+KReYjCje V0rVMb9p2xps/pIR9M3gUUDsrnJ9PxeiK+1eJNvxUDG39ifwP3NgJHDemiyVmFTr+vjg Cn3MERKiaJOxDsGg365i1/e1mwRBMj3XMZnUpjsvrWMwSgysckLHCcSiFwuArim+AnQ7 P8FK65UZJASnWOBna/v4chQPvmIK4FCESbpQHsYHzkVxaRzm5UjDKm3licqrKhHmvZk/ a9vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XPTufvuH; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si1321891edq.264.2019.09.16.06.57.39; Mon, 16 Sep 2019 06:58:03 -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=@kernel.org header.s=default header.b=XPTufvuH; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388148AbfIPNzu (ORCPT + 99 others); Mon, 16 Sep 2019 09:55:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:41950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbfIPNzt (ORCPT ); Mon, 16 Sep 2019 09:55:49 -0400 Received: from rapoport-lnx (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5F82214AF; Mon, 16 Sep 2019 13:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568642149; bh=Qw6DlJe9h17KJF1+v+dT72oQWDOddUyjHUhlMCEhp8c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XPTufvuH1UTy/pOvMGZQdOF7SQV3VB01raZ4EKG+o4EXiEY3D2hLRYUlRw3OYTudk 7ifs3vTA3J/UlC1HeoIc5365txH9KKqQGWl5ssh7Ckkc1fx6SAp9yZrtpcJUD2NkJz eu1aaMNnpR6YsHUTCAo2eol6j0CPHLbbhM6NdbPg= Date: Mon, 16 Sep 2019 16:55:43 +0300 From: Mike Rapoport To: Laura Abbott Cc: Catalin Marinas , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mike Rapoport , linux-arch@vger.kernel.org Subject: Re: [PATCH] arm64: use generic free_initrd_mem() Message-ID: <20190916135542.GC5196@rapoport-lnx> References: <1568618488-19055-1-git-send-email-rppt@kernel.org> <0ba20aa4-d2dd-2263-6b5f-16a5c8a39f67@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0ba20aa4-d2dd-2263-6b5f-16a5c8a39f67@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (added linux-arch) On Mon, Sep 16, 2019 at 08:23:29AM -0400, Laura Abbott wrote: > On 9/16/19 8:21 AM, Mike Rapoport wrote: > >From: Mike Rapoport > > > >arm64 calls memblock_free() for the initrd area in its implementation of > >free_initrd_mem(), but this call has no actual effect that late in the boot > >process. By the time initrd is freed, all the reserved memory is managed by > >the page allocator and the memblock.reserved is unused, so there is no > >point to update it. > > > > People like to use memblock for keeping track of memory even if it has no > actual effect. We made this change explicitly (see 05c58752f9dc ("arm64: To remove > initrd reserved area entry from memblock") That said, moving to the generic > APIs would be nice. Maybe we can find another place to update the accounting? Any other place in arch/arm64 would make it messy because it would have to duplicate keepinitrd logic. We could put the memblock_free() in the generic free_initrd_mem() with something like: diff --git a/init/initramfs.c b/init/initramfs.c index c47dad0..403c6a0 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -531,6 +531,10 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end) { free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, "initrd"); + +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK + memblock_free(__virt_to_phys(start), end - start); +#endif } #ifdef CONFIG_KEXEC_CORE Then powerpc and s390 folks will also be able to track the initrd memory :) > >Without the memblock_free() call the only difference between arm64 and the > >generic versions of free_initrd_mem() is the memory poisoning. Switching > >arm64 to the generic version will enable the poisoning. > > > >Signed-off-by: Mike Rapoport > >--- > > > >I've boot tested it on qemu and I've checked that kexec works. > > > > arch/arm64/mm/init.c | 8 -------- > > 1 file changed, 8 deletions(-) > > > >diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > >index f3c7952..8ad2934 100644 > >--- a/arch/arm64/mm/init.c > >+++ b/arch/arm64/mm/init.c > >@@ -567,14 +567,6 @@ void free_initmem(void) > > unmap_kernel_range((u64)__init_begin, (u64)(__init_end - __init_begin)); > > } > >-#ifdef CONFIG_BLK_DEV_INITRD > >-void __init free_initrd_mem(unsigned long start, unsigned long end) > >-{ > >- free_reserved_area((void *)start, (void *)end, 0, "initrd"); > >- memblock_free(__virt_to_phys(start), end - start); > >-} > >-#endif > >- > > /* > > * Dump out memory limit information on panic. > > */ > > > -- Sincerely yours, Mike.