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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 AEB82C433F5 for ; Thu, 23 Sep 2021 09:47:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2B17C61241 for ; Thu, 23 Sep 2021 09:47:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2B17C61241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgroup.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3C86F6B006C; Thu, 23 Sep 2021 05:47:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3506E6B0071; Thu, 23 Sep 2021 05:47:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F0DB6B0072; Thu, 23 Sep 2021 05:47:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 08B3A6B006C for ; Thu, 23 Sep 2021 05:47:55 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B0A6B8249980 for ; Thu, 23 Sep 2021 09:47:54 +0000 (UTC) X-FDA: 78618361668.01.F12B672 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf07.hostedemail.com (Postfix) with ESMTP id 3958010000A6 for ; Thu, 23 Sep 2021 09:47:54 +0000 (UTC) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4HFVhS1HTcz9sTZ; Thu, 23 Sep 2021 11:47:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N2iojAvTUjrW; Thu, 23 Sep 2021 11:47:52 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4HFVhS0G8Vz9sTX; Thu, 23 Sep 2021 11:47:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E65698B775; Thu, 23 Sep 2021 11:47:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id HEg50hnqH7U5; Thu, 23 Sep 2021 11:47:51 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.202.200]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 224928B763; Thu, 23 Sep 2021 11:47:50 +0200 (CEST) Subject: Re: [PATCH 3/3] memblock: cleanup memblock_free interface To: Mike Rapoport , Linus Torvalds Cc: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, Mike Rapoport , kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mips@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, linux-usb@vger.kernel.org, linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, xen-devel@lists.xenproject.org, Andrew Morton , linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20210923074335.12583-1-rppt@kernel.org> <20210923074335.12583-4-rppt@kernel.org> From: Christophe Leroy Message-ID: <1101e3c7-fcb7-a632-8e22-47f4a01ea02e@csgroup.eu> Date: Thu, 23 Sep 2021 11:47:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210923074335.12583-4-rppt@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr-FR X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3958010000A6 X-Stat-Signature: bofqg9b6tkde6utof9jarpitqkpqkh3h Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf07.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu X-HE-Tag: 1632390474-393214 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Le 23/09/2021 =C3=A0 09:43, Mike Rapoport a =C3=A9crit=C2=A0: > From: Mike Rapoport >=20 > For ages memblock_free() interface dealt with physical addresses even > despite the existence of memblock_alloc_xx() functions that return a > virtual pointer. >=20 > Introduce memblock_phys_free() for freeing physical ranges and repurpos= e > memblock_free() to free virtual pointers to make the following pairing > abundantly clear: >=20 > int memblock_phys_free(phys_addr_t base, phys_addr_t size); > phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size); >=20 > void *memblock_alloc(phys_addr_t size, phys_addr_t align); > void memblock_free(void *ptr, size_t size); >=20 > Replace intermediate memblock_free_ptr() with memblock_free() and drop > unnecessary aliases memblock_free_early() and memblock_free_early_nid()= . >=20 > Suggested-by: Linus Torvalds > Signed-off-by: Mike Rapoport > --- > diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c > index 1a04e5bdf655..37826d8c4f74 100644 > --- a/arch/s390/kernel/smp.c > +++ b/arch/s390/kernel/smp.c > @@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void) > /* Get the CPU registers */ > smp_save_cpu_regs(sa, addr, is_boot_cpu, page); > } > - memblock_free(page, PAGE_SIZE); > + memblock_phys_free(page, PAGE_SIZE); > diag_amode31_ops.diag308_reset(); > pcpu_set_smt(0); > } > @@ -880,7 +880,7 @@ void __init smp_detect_cpus(void) > =20 > /* Add CPUs present at boot */ > __smp_rescan_cpus(info, true); > - memblock_free_early((unsigned long)info, sizeof(*info)); > + memblock_free(info, sizeof(*info)); > } > =20 > /* I'm a bit lost. IIUC memblock_free_early() and memblock_free() where=20 identical. In the first hunk memblock_free() gets replaced by memblock_phys_free() In the second hunk memblock_free_early() gets replaced by memblock_free() I think it would be easier to follow if you could split it in several=20 patches: - First patch: Create memblock_phys_free() and change all relevant=20 memblock_free() to memblock_phys_free() - Or change memblock_free() to=20 memblock_phys_free() and make memblock_free() an alias of it. - Second patch: Make memblock_free_ptr() become memblock_free() and=20 change all remaining callers to the new semantics (IIUC=20 memblock_free(__pa(ptr)) becomes memblock_free(ptr) and make=20 memblock_free_ptr() an alias of memblock_free() - Fourth patch: Replace and drop memblock_free_ptr() - Fifth patch: Drop memblock_free_early() and memblock_free_early_nid()=20 (All users should have been upgraded to memblock_free_phys() in patch 1=20 or memblock_free() in patch 2) Christophe