From patchwork Mon Dec 31 09:29:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 1019520 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43SsX66cgYz9s2P for ; Mon, 31 Dec 2018 20:31:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43SsX64cR4zDqDW for ; Mon, 31 Dec 2018 20:31:50 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=rppt@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43SsTj3DmQzDqDh for ; Mon, 31 Dec 2018 20:29:45 +1100 (AEDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBV9Sh6P089064 for ; Mon, 31 Dec 2018 04:29:42 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pqfth1ekv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Dec 2018 04:29:42 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 31 Dec 2018 09:29:40 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) 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) Mon, 31 Dec 2018 09:29:33 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBV9TWYT26017906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 31 Dec 2018 09:29:32 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 154B84C040; Mon, 31 Dec 2018 09:29:32 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83CC14C04A; Mon, 31 Dec 2018 09:29:28 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.181]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 31 Dec 2018 09:29:28 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 31 Dec 2018 11:29:27 +0200 From: Mike Rapoport To: Andrew Morton Subject: [PATCH v4 0/6] memblock: simplify several early memory allocation Date: Mon, 31 Dec 2018 11:29:20 +0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18123109-0028-0000-0000-00000331258E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18123109-0029-0000-0000-000023EE69C7 Message-Id: <1546248566-14910-1-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-12-31_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 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-1812310088 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michal Hocko , linux-sh@vger.kernel.org, Heiko Carstens , linux-mm@kvack.org, Rich Felker , Paul Mackerras , sparclinux@vger.kernel.org, Vincent Chen , Jonas Bonn , linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Russell King , Mike Rapoport , Mark Salter , Arnd Bergmann , Stefan Kristiansson , openrisc@lists.librecores.org, Greentime Hu , Stafford Horne , Guan Xuetao , linux-arm-kernel@lists.infradead.org, Michal Simek , linux-kernel@vger.kernel.org, Martin Schwidefsky , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi, These patches simplify some of the early memory allocations by replacing usage of older memblock APIs with newer and shinier ones. Quite a few places in the arch/ code allocated memory using a memblock API that returns a physical address of the allocated area, then converted this physical address to a virtual one and then used memset(0) to clear the allocated range. More recent memblock APIs do all the three steps in one call and their usage simplifies the code. It's important to note that regardless of API used, the core allocation is nearly identical for any set of memblock allocators: first it tries to find a free memory with all the constraints specified by the caller and then falls back to the allocation with some or all constraints disabled. The first three patches perform the conversion of call sites that have exact requirements for the node and the possible memory range. The fourth patch is a bit one-off as it simplifies openrisc's implementation of pte_alloc_one_kernel(), and not only the memblock usage. The fifth patch takes care of simpler cases when the allocation can be satisfied with a simple call to memblock_alloc(). The sixth patch removes one-liner wrappers for memblock_alloc on arm and unicore32, as suggested by Christoph. v4: * rebased on the current upstream * added conversion of s390 node data allocation v3: * added Tested-by from Michal Simek for microblaze changes * updated powerpc changes as per Michael Ellerman comments: - use allocations that clear memory in alloc_paca_data() and alloc_stack() - ensure the replacement is equivalent to old API v2: * added Ack from Stafford Horne for openrisc changes * entirely drop early_alloc wrappers on arm and unicore32, as per Christoph Hellwig Mike Rapoport (6): powerpc: prefer memblock APIs returning virtual address microblaze: prefer memblock API returning virtual address sh: prefer memblock APIs returning virtual address openrisc: simplify pte_alloc_one_kernel() arch: simplify several early memory allocations arm, s390, unicore32: remove oneliner wrappers for memblock_alloc() arch/arm/mm/mmu.c | 13 +++---------- arch/c6x/mm/dma-coherent.c | 9 ++------- arch/microblaze/mm/init.c | 5 +++-- arch/nds32/mm/init.c | 12 ++++-------- arch/openrisc/mm/ioremap.c | 11 ++++------- arch/powerpc/kernel/paca.c | 16 ++++++---------- arch/powerpc/kernel/setup-common.c | 4 ++-- arch/powerpc/kernel/setup_64.c | 24 ++++++++++-------------- arch/powerpc/mm/hash_utils_64.c | 6 +++--- arch/powerpc/mm/pgtable-book3e.c | 8 ++------ arch/powerpc/mm/pgtable-book3s64.c | 5 +---- arch/powerpc/mm/pgtable-radix.c | 25 +++++++------------------ arch/powerpc/mm/ppc_mmu_32.c | 3 +-- arch/powerpc/platforms/pasemi/iommu.c | 5 +++-- arch/powerpc/platforms/powernv/opal.c | 3 +-- arch/powerpc/platforms/pseries/setup.c | 18 ++++++++++++++---- arch/powerpc/sysdev/dart_iommu.c | 7 +++++-- arch/s390/numa/numa.c | 14 +------------- arch/sh/mm/init.c | 18 +++++------------- arch/sh/mm/numa.c | 5 ++--- arch/sparc/kernel/prom_64.c | 7 ++----- arch/sparc/mm/init_64.c | 9 +++------ arch/unicore32/mm/mmu.c | 14 ++++---------- 23 files changed, 88 insertions(+), 153 deletions(-)