From patchwork Mon Jul 16 08:00:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10526077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 154F760348 for ; Mon, 16 Jul 2018 08:00:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1635128B26 for ; Mon, 16 Jul 2018 08:00:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 146E928B2C; Mon, 16 Jul 2018 08:00:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D65628B11 for ; Mon, 16 Jul 2018 08:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ED1C6B0271; Mon, 16 Jul 2018 04:00:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2C4BF6B0272; Mon, 16 Jul 2018 04:00:41 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B3966B0273; Mon, 16 Jul 2018 04:00:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by kanga.kvack.org (Postfix) with ESMTP id E5C3F6B0271 for ; Mon, 16 Jul 2018 04:00:40 -0400 (EDT) Received: by mail-oi0-f70.google.com with SMTP id v4-v6so33567632oix.2 for ; Mon, 16 Jul 2018 01:00:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=zZ6p/Sc2I99v39NhRJaD7khi3rlii105QybPOtsfc24=; b=TzPsuIjkSUQBxQ+Z62scJf7HUisf4Jlpy3TMSuKu4wMRS459IDtV6v2UMyNOuxbZqt hWI19bXjVGUn0S4DXnwD7jY74qRXLqlc+xo1311hC7kdRDbpxmIyalxA8hLJOrI/qJW2 shALmwZyhN1kqzm9GMhTpngdxWdVes8OJsl32Obxba6HJ6OpQ6khsVV8pdwVu4xn+evs 8ROseL4xpIdE210Mk8xZ2o5cv6WxrGJ4FwTtslTBxBlXqZxCKR/Tl9VekFOs4Iuqoo02 aH2KDPkq5vCWOURwDkOenh5M194ySX/hDvsIRrY/po9+KSHoXsU8cc1NJIXroJeB0t3g qWrw== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlFVyaTM3cZGPvHGScB+7n5vj0ZAWamsIB+55EFQrmlt4HLNQAtX BAbBAS8wGk6AiPiVar4rgUE0dosZqZe/pcqqzhtDqo8qAakeGjraDGYFvUjSh0PqpAOUQ86tj4I 2zi1HdzVHbCJpyRq1RVtC1qJGjNpro/wO1S079TAAw+5kWci7MngQwEztBUFKSXY= X-Received: by 2002:aca:a8cc:: with SMTP id r195-v6mr15974473oie.212.1531728040705; Mon, 16 Jul 2018 01:00:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcURpsT4KzOc4nDqFKalBKPWKHDyqTBheoU+UE67/7UUnMRw6Vaeyh5aC5G/zJ669J9G3DO X-Received: by 2002:aca:a8cc:: with SMTP id r195-v6mr15974428oie.212.1531728039962; Mon, 16 Jul 2018 01:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531728039; cv=none; d=google.com; s=arc-20160816; b=Ym6KYfRB/ZT9Ka2nCE8HQ1IVspnr2ogkVzvUUqUQU+b1m9QyJ5rBwu93p6in5QM62j Im3WpOfa2iJL/MxnUqZsQirjmirZpb4YMYLqG8tTB7zU0doO5kdCZ8HUn0Bt/CrwUnkR hJM1YPjLimyVCRPcmT4Xue03F2jt2CUlnQU2rvV6Jb0TBEB+TkO5Gk2p9gLgfieYEVPM Xt6PBTpGKMjy0IQnxzlsLcLTDUFIRVEdFjAdaw57TFLIE7yZMDnF4Qah5Vg5FXKxX8XH YRoBzZufN6g06A4RYrd+hMCqFGRHZO2Kq1M/PwLDmKbhoRGj3SBikPq4NNwi2l5sY4+W wUmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=zZ6p/Sc2I99v39NhRJaD7khi3rlii105QybPOtsfc24=; b=dMCg+Cz3pmTKkP97svdjGWmQ4BhVUSs3m9hKElFascFC7OauodU7DmXlssR+mm50pD KgqzDVtj06RU58wNzwX4luc6luH/XZZuKNigz0SYwaQrptB8rlE2GJ0egfhlmPaT7lq2 PXCcX1wPPzbukue2yBszGIaDdE4f4x7KTmVusMFJ2xZuAUGtka65bsJQdMjvKD8b4nYw 7a4ajyGnaX5NTJSF78v875cs1smpfdECLj7tO/xdk3OmCpzPQY6J2Wtm6rerJ8ym7I6k dDQygX8C1FgeI+kzNu9XQBaP76XA209q4DqZrNSS+hTAoSABviXM2fGzX8hwVFVmXSFg YvOw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id k126-v6si19127198oih.305.2018.07.16.01.00.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 01:00:39 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6G7xwjp001604 for ; Mon, 16 Jul 2018 04:00:39 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k8hcgv24s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 16 Jul 2018 04:00:38 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Jul 2018 09:00:36 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 16 Jul 2018 09:00:32 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6G80Wcs42008810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Jul 2018 08:00:32 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0782E4205F; Mon, 16 Jul 2018 11:00:51 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9094842057; Mon, 16 Jul 2018 11:00:49 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.99]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 16 Jul 2018 11:00:49 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 16 Jul 2018 11:00:29 +0300 From: Mike Rapoport To: Guan Xuetao Cc: Michal Hocko , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH] unicore32: switch to NO_BOOTMEM Date: Mon, 16 Jul 2018 11:00:24 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18071608-0020-0000-0000-000002A6F0C5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071608-0021-0000-0000-000020F34F0D Message-Id: <1531728024-13259-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-16_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=52 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=773 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807160096 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: X-Virus-Scanned: ClamAV using ClamSMTP The unicore32 already supports memblock and uses it for some early memory reservations, e.g initrd and the page tables. At some point unicore32 allocates the bootmem bitmap from the memblock and then hands over the memory reservations from memblock to bootmem. This patch removes the bootmem initialization and leaves memblock as the only boot time memory manager for unicore32. Signed-off-by: Mike Rapoport Acked-by: Guan Xuetao --- I couldn't get unicore32 toolchain as the only link I was able to find [1] gives me timeout, so the best I could do to check the changes was gcc -c arch/unicore32/mm/init.c [1] http://mprc.pku.edu.cn/~guanxuetao/linux/uc4-1.0.5-hard.tgz arch/unicore32/Kconfig | 1 + arch/unicore32/mm/init.c | 54 +----------------------------------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index 03f991e..cff4b9d 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig @@ -5,6 +5,7 @@ config UNICORE32 select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select HAVE_MEMBLOCK + select NO_BOOTMEM select HAVE_GENERIC_DMA_COHERENT select HAVE_KERNEL_GZIP select HAVE_KERNEL_BZIP2 diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index f4950fb..44ccc15 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c @@ -84,58 +84,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low, } } -static void __init uc32_bootmem_init(unsigned long start_pfn, - unsigned long end_pfn) -{ - struct memblock_region *reg; - unsigned int boot_pages; - phys_addr_t bitmap; - pg_data_t *pgdat; - - /* - * Allocate the bootmem bitmap page. This must be in a region - * of memory which has already been mapped. - */ - boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); - bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, - __pfn_to_phys(end_pfn)); - - /* - * Initialise the bootmem allocator, handing the - * memory banks over to bootmem. - */ - node_set_online(0); - pgdat = NODE_DATA(0); - init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); - - /* Free the lowmem regions from memblock into bootmem. */ - for_each_memblock(memory, reg) { - unsigned long start = memblock_region_memory_base_pfn(reg); - unsigned long end = memblock_region_memory_end_pfn(reg); - - if (end >= end_pfn) - end = end_pfn; - if (start >= end) - break; - - free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT); - } - - /* Reserve the lowmem memblock reserved regions in bootmem. */ - for_each_memblock(reserved, reg) { - unsigned long start = memblock_region_reserved_base_pfn(reg); - unsigned long end = memblock_region_reserved_end_pfn(reg); - - if (end >= end_pfn) - end = end_pfn; - if (start >= end) - break; - - reserve_bootmem(__pfn_to_phys(start), - (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT); - } -} - static void __init uc32_bootmem_free(unsigned long min, unsigned long max_low, unsigned long max_high) { @@ -232,7 +180,7 @@ void __init bootmem_init(void) find_limits(&min, &max_low, &max_high); - uc32_bootmem_init(min, max_low); + node_set_online(0); #ifdef CONFIG_SWIOTLB swiotlb_init(1);