Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp409291pxb; Thu, 23 Sep 2021 02:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4Pu9D7E7j53Ykip+ozomReAL9U2rkBSLYRADvvzwKxhBu2o0MiST3FN/3iTlQGKaVtscx X-Received: by 2002:a5e:d612:: with SMTP id w18mr3138880iom.196.1632390621010; Thu, 23 Sep 2021 02:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632390621; cv=none; d=google.com; s=arc-20160816; b=imH72LItBvtsRTPAQIGjAV+4unT9iBljtTjFhb5OyO4xVIq9V50KDVr9tEx7ScDA0Y /Dn/JgRjyXgSUfnrInHOQ6iy4fNAuRLM5w/xXezcCcUe+LhB2Uo20mgkbamBZ5SiMzp/ 661vG83ZorRMzU90OvnpUJc1TADTw21mjPZTHuZwKDNz7iGH4tgM87TkgZF/F3DmJHmG BV2wQGj4FjOP1ETmm33Xq0WvRypqHwcfYIjW4YhdwDbtVqJgDvLCd4St1mcpVEG8jIol ee0WoPOELyk4lgQ4OCO8TP4XW+kry7VzbNT9p3yJDit1zyLDEIf3NBnfoY9rZEL2Zx8s j64Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=7dkB4YftKEtJxLwwwy0sZKaec62sCoeLdxn2t6GHcyU=; b=Ed16lG7lDfziZvZUOIJ9qLo3UJ9vaUh0MSo/kIok4hee/Jg6g1CMEI2DBkzGxNWC5B ieTwoYa2eQs/789x4Qu26MgygIUcRPgsGhHK8VCTtHZ3dNtvMrRreSLBtyiOsvgzYhUs mz9cLfzZEnLlZxIWkyF9WK4hzVHT5tW8ac6Rdnkfb95uRNRFiw07qb8x2DH/eQqSuUXo CKY2dmyhFCOVT/ZowhItB4nt+6fAsRPLFscp4AH5KA5P36c3gBJOIscbLJ9WbQlCUnwc Bb7/TzspqdIBqWUPgi3qn1Fuwk1v6YILd/aMw7JQM3dwGgrKF6H4NPTBjpsTlb1L3j1q yYxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si5398009ilh.153.2021.09.23.02.50.09; Thu, 23 Sep 2021 02:50:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240222AbhIWJt1 (ORCPT + 99 others); Thu, 23 Sep 2021 05:49:27 -0400 Received: from pegase2.c-s.fr ([93.17.235.10]:52743 "EHLO pegase2.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240175AbhIWJt0 (ORCPT ); Thu, 23 Sep 2021 05:49:26 -0400 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 23/09/2021 à 09:43, Mike Rapoport a écrit : > From: Mike Rapoport > > For ages memblock_free() interface dealt with physical addresses even > despite the existence of memblock_alloc_xx() functions that return a > virtual pointer. > > Introduce memblock_phys_free() for freeing physical ranges and repurpose > memblock_free() to free virtual pointers to make the following pairing > abundantly clear: > > 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); > > void *memblock_alloc(phys_addr_t size, phys_addr_t align); > void memblock_free(void *ptr, size_t size); > > Replace intermediate memblock_free_ptr() with memblock_free() and drop > unnecessary aliases memblock_free_early() and memblock_free_early_nid(). > > 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) > > /* Add CPUs present at boot */ > __smp_rescan_cpus(info, true); > - memblock_free_early((unsigned long)info, sizeof(*info)); > + memblock_free(info, sizeof(*info)); > } > > /* I'm a bit lost. IIUC memblock_free_early() and memblock_free() where 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 patches: - First patch: Create memblock_phys_free() and change all relevant memblock_free() to memblock_phys_free() - Or change memblock_free() to memblock_phys_free() and make memblock_free() an alias of it. - Second patch: Make memblock_free_ptr() become memblock_free() and change all remaining callers to the new semantics (IIUC memblock_free(__pa(ptr)) becomes memblock_free(ptr) and make 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() (All users should have been upgraded to memblock_free_phys() in patch 1 or memblock_free() in patch 2) Christophe