From patchwork Sun Nov 25 21:44:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EFA415A8 for ; Sun, 25 Nov 2018 21:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EBE029A36 for ; Sun, 25 Nov 2018 21:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51A7029A6C; Sun, 25 Nov 2018 21:45:04 +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 AB54329A36 for ; Sun, 25 Nov 2018 21:45:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A87A66B3E3D; Sun, 25 Nov 2018 16:45:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A11C26B3E3F; Sun, 25 Nov 2018 16:45:01 -0500 (EST) 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 8666C6B3E40; Sun, 25 Nov 2018 16:45:01 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 269C06B3E3D for ; Sun, 25 Nov 2018 16:45:01 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id v4so7974201edm.18 for ; Sun, 25 Nov 2018 13:45:01 -0800 (PST) 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:in-reply-to:references:message-id; bh=kzlh63nsQ0XUqMeprjB166aNfhcibQE5aAASP8fXZgw=; b=MEFGmEljnz8o1WHGy6+ANQFX0TCa5akkcvl+aSscnmWPLKoIFYeSm7+x0XcV9QVuNC N9x5hgP0BjDgMhtHIqQgBM0ge1cUb77nsKOD6opV0rL5auk+6fQTisIvZqLzGF6CBHW4 sZzUVIr+RtaGIpkwjmMTgAx4mpbmLm5zTMLp8E6wtwuWVoIxaw1tLad3ZJnQ8rmwBvdz mQO2gYV3zr3YV4OJHun3aCGmQ+1CsvyaNPi3fuJHUzdGbdDFOkOkWNdPbsCtD+WJtNA1 2hKlUTqrFGH58a8CYxUMM7YVc8k7s3H1DW4QXe9QAyMShPQB7MuQOHKOrmNfXAKqESaG L2+Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AA+aEWaPgW2w3+7ehVrALecwm7S9AuzTWygT01lmM1Cb2Ul8nzuV4gHn xtP/ArDmBF2hGFbOoRApX3pA7ttOtxhhLVMeQL0o1LyKtVeXlD+aBLRJZIf5PHZPc+DVOaIzrBK VKxfTFYCZk9jN67Qaz8Kj+WHj2p+f84kUTTV6HRDKYICPzp9laqWPgHkkP2qsb5JYqg== X-Received: by 2002:a50:c017:: with SMTP id r23mr21464798edb.278.1543182300548; Sun, 25 Nov 2018 13:45:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+WX4zSafNhoIvyfEw00ocCYlFmG9RBFvF+A+LcExV76hCYeSUgZHrd0tbQagfIcQs8q7n X-Received: by 2002:a50:c017:: with SMTP id r23mr21464762edb.278.1543182299178; Sun, 25 Nov 2018 13:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182299; cv=none; d=google.com; s=arc-20160816; b=KJ1J4cAIjqLbL5I8qNsVnZbr3AH/CLozEWcjDmgzLcXykwQfDJfKfP6fgsXsJioJRC sB+EVCWb5HbSyMtUWH8oTmfig4J5l4pbG+AoP6XYK9gmHrQFlxLF/CiKep7ddU98tBhs Y8t5u+VkO6uDOPZcua4kxEyOwd8v1RgDyn4MNlVVTbOXKJ6KAb8xPFBaT1V7q4NGwrGc gUWdh2MEral9AYQHLaiHQ5vvaFAxHPDbgftWqVS2w/79LVtQM1AzpUf6n6Y1mRmPGWF0 mt7kh3Tw1AfciVQVmitJosbfDtsRKpawf3z5CGjbLUgBaQMKI+ilrP//+zzaRejQDXsO XnVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=kzlh63nsQ0XUqMeprjB166aNfhcibQE5aAASP8fXZgw=; b=onsnZkih4QwbhW5AhYH/j2IiXik9Frg8jolWMO0kdMiXxzc1t3x79ROL+sjBv6dRX6 hnZBD2EYLdGv3FezS4rQfd7jyjoE/SnWZqfggNG8tP/Ne3A/ht6CBtYptNqHOSoki2gN nxablBQcWHGuiGQ3oGBxmrFPjAIoYZsqKB/WsWHQn03J7L7UgSTQwRyN0LWwNzXYt6Hd /OR2hqMpQ46f2VKjbmWMLUP2pvTC4R8TatVDLBqmKGR3okczpyxDg7XeE7RXAkWaK8Eb lS3t9VChDEEsaI2sw41hUbIjyLhiS7xQnxPiseL9BgWF03lBPBZNQFC1KjybfgbdhnJB UdHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id p8-v6si7474431ejq.121.2018.11.25.13.44.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:44:59 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAPLi5sh091902 for ; Sun, 25 Nov 2018 16:44:57 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nymsk73dc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:44:57 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:44:55 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 25 Nov 2018 21:44:48 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLilUK2949456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:44:47 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01EF5AE053; Sun, 25 Nov 2018 21:44:47 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8AA7AE051; Sun, 25 Nov 2018 21:44:43 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 25 Nov 2018 21:44:43 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:42 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH 1/5] powerpc: prefer memblock APIs returning virtual address Date: Sun, 25 Nov 2018 23:44:33 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-0012-0000-0000-000002CFFEFE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-0013-0000-0000-0000210538C5 Message-Id: <1543182277-8819-2-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=932 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 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 There are a several places that allocate memory using memblock APIs that return a physical address, convert the returned address to the virtual address and frequently also memset(0) the allocated range. Update these places to use memblock allocators already returning a virtual address; use memblock functions that clear the allocated memory instead of calling memset(0). Signed-off-by: Mike Rapoport --- arch/powerpc/kernel/paca.c | 14 ++++++-------- arch/powerpc/kernel/setup_64.c | 21 ++++++++++----------- 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 | 24 +++++++++--------------- arch/powerpc/platforms/pasemi/iommu.c | 5 +++-- arch/powerpc/platforms/pseries/setup.c | 11 +++++++---- arch/powerpc/sysdev/dart_iommu.c | 5 +++-- 9 files changed, 44 insertions(+), 55 deletions(-) diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 913bfca..fa884ad 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c @@ -27,7 +27,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align, unsigned long limit, int cpu) { - unsigned long pa; + void *ptr; int nid; /* @@ -42,17 +42,15 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align, nid = early_cpu_to_node(cpu); } - pa = memblock_alloc_base_nid(size, align, limit, nid, MEMBLOCK_NONE); - if (!pa) { - pa = memblock_alloc_base(size, align, limit); - if (!pa) - panic("cannot allocate paca data"); - } + ptr = memblock_alloc_try_nid_raw(size, align, MEMBLOCK_LOW_LIMIT, + limit, nid); + if (!ptr) + panic("cannot allocate paca data"); if (cpu == boot_cpuid) memblock_set_bottom_up(false); - return __va(pa); + return ptr; } #ifdef CONFIG_PPC_PSERIES diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 236c115..d11ee7f 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -634,19 +634,17 @@ __init u64 ppc64_bolted_size(void) static void *__init alloc_stack(unsigned long limit, int cpu) { - unsigned long pa; + void *ptr; BUILD_BUG_ON(STACK_INT_FRAME_SIZE % 16); - pa = memblock_alloc_base_nid(THREAD_SIZE, THREAD_SIZE, limit, - early_cpu_to_node(cpu), MEMBLOCK_NONE); - if (!pa) { - pa = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit); - if (!pa) - panic("cannot allocate stacks"); - } + ptr = memblock_alloc_try_nid_raw(THREAD_SIZE, THREAD_SIZE, + MEMBLOCK_LOW_LIMIT, limit, + early_cpu_to_node(cpu)); + if (!ptr) + panic("cannot allocate stacks"); - return __va(pa); + return ptr; } void __init irqstack_early_init(void) @@ -933,8 +931,9 @@ static void __ref init_fallback_flush(void) * hardware prefetch runoff. We don't have a recipe for load patterns to * reliably avoid the prefetcher. */ - l1d_flush_fallback_area = __va(memblock_alloc_base(l1d_size * 2, l1d_size, limit)); - memset(l1d_flush_fallback_area, 0, l1d_size * 2); + l1d_flush_fallback_area = memblock_alloc_try_nid(l1d_size * 2, + l1d_size, MEMBLOCK_LOW_LIMIT, + limit, NUMA_NO_NODE); for_each_possible_cpu(cpu) { struct paca_struct *paca = paca_ptrs[cpu]; diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 0cc7fbc..bc6be44 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -908,9 +908,9 @@ static void __init htab_initialize(void) #ifdef CONFIG_DEBUG_PAGEALLOC if (debug_pagealloc_enabled()) { linear_map_hash_count = memblock_end_of_DRAM() >> PAGE_SHIFT; - linear_map_hash_slots = __va(memblock_alloc_base( - linear_map_hash_count, 1, ppc64_rma_size)); - memset(linear_map_hash_slots, 0, linear_map_hash_count); + linear_map_hash_slots = memblock_alloc_try_nid( + linear_map_hash_count, 1, MEMBLOCK_LOW_LIMIT, + ppc64_rma_size, NUMA_NO_NODE); } #endif /* CONFIG_DEBUG_PAGEALLOC */ diff --git a/arch/powerpc/mm/pgtable-book3e.c b/arch/powerpc/mm/pgtable-book3e.c index e0ccf36..53cbc7d 100644 --- a/arch/powerpc/mm/pgtable-book3e.c +++ b/arch/powerpc/mm/pgtable-book3e.c @@ -57,12 +57,8 @@ void vmemmap_remove_mapping(unsigned long start, static __ref void *early_alloc_pgtable(unsigned long size) { - void *pt; - - pt = __va(memblock_alloc_base(size, size, __pa(MAX_DMA_ADDRESS))); - memset(pt, 0, size); - - return pt; + return memblock_alloc_try_nid(size, size, MEMBLOCK_LOW_LIMIT, + __pa(MAX_DMA_ADDRESS), NUMA_NO_NODE); } /* diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index 9f93c9f..70d5478 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c @@ -195,11 +195,8 @@ void __init mmu_partition_table_init(void) unsigned long ptcr; BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 36), "Partition table size too large."); - partition_tb = __va(memblock_alloc_base(patb_size, patb_size, - MEMBLOCK_ALLOC_ANYWHERE)); - /* Initialize the Partition Table with no entries */ - memset((void *)partition_tb, 0, patb_size); + partition_tb = memblock_alloc(patb_size, patb_size); /* * update partition table control register, diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c index 9311560..415a1eb0 100644 --- a/arch/powerpc/mm/pgtable-radix.c +++ b/arch/powerpc/mm/pgtable-radix.c @@ -51,24 +51,18 @@ static int native_register_process_table(unsigned long base, unsigned long pg_sz static __ref void *early_alloc_pgtable(unsigned long size, int nid, unsigned long region_start, unsigned long region_end) { - unsigned long pa = 0; + phys_addr_t min_addr = MEMBLOCK_LOW_LIMIT; + phys_addr_t max_addr = MEMBLOCK_ALLOC_ANYWHERE; void *pt; - if (region_start || region_end) /* has region hint */ - pa = memblock_alloc_range(size, size, region_start, region_end, - MEMBLOCK_NONE); - else if (nid != -1) /* has node hint */ - pa = memblock_alloc_base_nid(size, size, - MEMBLOCK_ALLOC_ANYWHERE, - nid, MEMBLOCK_NONE); + if (region_start) + min_addr = region_start; + if (region_end) + max_addr = region_end; - if (!pa) - pa = memblock_alloc_base(size, size, MEMBLOCK_ALLOC_ANYWHERE); - - BUG_ON(!pa); - - pt = __va(pa); - memset(pt, 0, size); + pt = memblock_alloc_try_nid_nopanic(size, size, min_addr, max_addr, + nid); + BUG_ON(!pt); return pt; } diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index f297152..f62930f 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c @@ -208,7 +208,9 @@ static int __init iob_init(struct device_node *dn) pr_debug(" -> %s\n", __func__); /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ - iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); + iob_l2_base = memblock_alloc_try_nid_raw(1UL << 21, 1UL << 21, + MEMBLOCK_LOW_LIMIT, 0x80000000, + NUMA_NO_NODE); pr_info("IOBMAP L2 allocated at: %p\n", iob_l2_base); @@ -269,4 +271,3 @@ void __init iommu_init_early_pasemi(void) pasemi_pci_controller_ops.dma_bus_setup = pci_dma_bus_setup_pasemi; set_pci_dma_ops(&dma_iommu_ops); } - diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 0f553dc..715ed61 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -130,8 +130,10 @@ static void __init fwnmi_init(void) * It will be used in real mode mce handler, hence it needs to be * below RMA. */ - mce_data_buf = __va(memblock_alloc_base(RTAS_ERROR_LOG_MAX * nr_cpus, - RTAS_ERROR_LOG_MAX, ppc64_rma_size)); + mce_data_buf = memblock_alloc_try_nid_raw(RTAS_ERROR_LOG_MAX * nr_cpus, + RTAS_ERROR_LOG_MAX, MEMBLOCK_LOW_LIMIT, + ppc64_rma_size, NUMA_NO_NODE); + for_each_possible_cpu(i) { paca_ptrs[i]->mce_data_buf = mce_data_buf + (RTAS_ERROR_LOG_MAX * i); @@ -140,8 +142,9 @@ static void __init fwnmi_init(void) #ifdef CONFIG_PPC_BOOK3S_64 /* Allocate per cpu slb area to save old slb contents during MCE */ size = sizeof(struct slb_entry) * mmu_slb_size * nr_cpus; - slb_ptr = __va(memblock_alloc_base(size, sizeof(struct slb_entry), - ppc64_rma_size)); + slb_ptr = memblock_alloc_try_nid_raw(size, sizeof(struct slb_entry), + MEMBLOCK_LOW_LIMIT, ppc64_rma_size, + NUMA_NO_NODE); for_each_possible_cpu(i) paca_ptrs[i]->mce_faulty_slbs = slb_ptr + (mmu_slb_size * i); #endif diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index a5b40d1..ac6d235 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -251,8 +251,9 @@ static void allocate_dart(void) * 16MB (1 << 24) alignment. We allocate a full 16Mb chuck since we * will blow up an entire large page anyway in the kernel mapping. */ - dart_tablebase = __va(memblock_alloc_base(1UL<<24, - 1UL<<24, 0x80000000L)); + dart_tablebase = memblock_alloc_try_nid_raw(1UL << 24, 1UL << 24, + MEMBLOCK_LOW_LIMIT, 0x80000000L, + NUMA_NO_NODE); /* There is no point scanning the DART space for leaks*/ kmemleak_no_scan((void *)dart_tablebase); From patchwork Sun Nov 25 21:44:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA7EA15A8 for ; Sun, 25 Nov 2018 21:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9B0B729A14 for ; Sun, 25 Nov 2018 21:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E35429A45; Sun, 25 Nov 2018 21:45:06 +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 2DA8A29A14 for ; Sun, 25 Nov 2018 21:45:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3D766B3E41; Sun, 25 Nov 2018 16:45:04 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B9ACC6B3E42; Sun, 25 Nov 2018 16:45:04 -0500 (EST) 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 A3B586B3E43; Sun, 25 Nov 2018 16:45:04 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id 524B76B3E41 for ; Sun, 25 Nov 2018 16:45:04 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id s14so9742894pfk.16 for ; Sun, 25 Nov 2018 13:45:04 -0800 (PST) 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:in-reply-to:references:message-id; bh=tfUYTw2xtNj94uKpGZXfl1+7ZvG8At7gBUJavL4EZvc=; b=GvrTNmu0SOnQD1NfNRFxAgnm0gn4N4IoRk13/cXgE3QtguPXI+lxH0EZi/fJ2QsQRF iILAedsERRmHY1Jz2kzegIJy9x1a2+NrIkd+iG8+OQhIR5UV1vUtoxUvtCukUxVPKsEh XmwRudFLFU1MLTHB2BedhNGFScpUICDEx5I1Dr3Xp1jCwJEBgZts+eW+zEjWGMhYiHw1 XlM+v+CIZ71y84QigleET6aM0pHWsudegpqiF591eYViLZFLWMcP3yepA984DjenX55r qxhDgs6VcCUeW0bCo6UaH/CScQ2oayolNzxUDug2PfbG/lT+HY+EyFosmifXlvGH7MLn SC/w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AA+aEWbOD+p2LLHe/w1/PvuSDmc1M6NdGgROqhFIiBrvw0D7L1lIVbi6 jErWdChYsaxg+7B54l5eq3dCBx5X1pscqsOmoaJFju/S8Dww2Eg8AocLTqq7kkaImBqMnjF1udQ FzGDTalUdDNBEZY92wnj4V0yPaeKdoTzOsWzMLoFDAxHI/VYgryGwoa7Db4OVhKJKRQ== X-Received: by 2002:a17:902:780a:: with SMTP id p10mr25486016pll.54.1543182304015; Sun, 25 Nov 2018 13:45:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UCfLbwDdo8Lwbsx7KkqILnrd4sa9G03UXVmWyidmT5vGX9fnYqXUx/XdNVP/TeVSKtbqye X-Received: by 2002:a17:902:780a:: with SMTP id p10mr25485989pll.54.1543182303468; Sun, 25 Nov 2018 13:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182303; cv=none; d=google.com; s=arc-20160816; b=x2kldzFFFp0GlEMq7qzuczv/BS+RkCb+wEda8iQMqCgW5e+s9T1yphw4AeCw3gk4bH TSrJ1IlZ1Fz7nbgOGHLiU+KpVTc56vujQY4CFo5xYlzV7SUiMRMF93bET+oFoWVVjGCN NkyAaig3ORD69d1XLDHC5r4L2VSBRsgktV3+my4bCSJCJ95PXX06iwxf4J8xr+g4AQEH eIDfHk756pKmTD//vyElnJvS7DUoOpsLd9JlwILaddDju1KqTMZtt7UdR6DixJsVABEf qAiSgZUA3KJFhiDVC0wOpBUotKTm2+kb6hmD2dE2rx0NCppwFhw8xyDesQeqLGL7aXhI GAGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=tfUYTw2xtNj94uKpGZXfl1+7ZvG8At7gBUJavL4EZvc=; b=Uecy938Nisf+2YuEmCmn6G/HlHwuugGX+kGvhJ4gOPUsIiZyBxecXN/sQ4KCli7OZI 6oDZkJCpbbLSY5fN8/WiXosiTH51Z7B2YJyBbPNSw7snyratcN1C944Evu/vMNfNsW12 FLyTD61+C6gv3RlQ9ng09fTaaZshyLLoYrldMLYM2w8WkEhdLn5AqrKM62E4zVivo6/r D31AgfnDSnulSRUmBmsLia71g0gFopXdc6CkdFDlz/Bl/zAQRf4wZ/Ac2tYasFz4rM8Q PqRXgXyqU6xDUQtqNoOpuRCLv2qwolNBkyx7oHtw8hOdQrA6gfhAl4sk0naPSV8vGiJY Bzyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (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 b4si58450537pgk.350.2018.11.25.13.45.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:45:03 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAPLi8XU095483 for ; Sun, 25 Nov 2018 16:45:03 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nymncf1u3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:45:01 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:44:59 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 25 Nov 2018 21:44:52 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLipEn48365636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:44:51 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E20CA405C; Sun, 25 Nov 2018 21:44:51 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C9FD4A4054; Sun, 25 Nov 2018 21:44:47 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 25 Nov 2018 21:44:47 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:47 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH 2/5] microblaze: prefer memblock API returning virtual address Date: Sun, 25 Nov 2018 23:44:34 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-4275-0000-0000-000002E681AF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-4276-0000-0000-000037F3B868 Message-Id: <1543182277-8819-3-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=693 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 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 Rather than use the memblock_alloc_base that returns a physical address and then convert this address to the virtual one, use appropriate memblock function that returns a virtual address. Signed-off-by: Mike Rapoport --- arch/microblaze/mm/init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index b17fd8a..44f4b89 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c @@ -363,8 +363,9 @@ void __init *early_get_page(void) * Mem start + kernel_tlb -> here is limit * because of mem mapping from head.S */ - return __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE, - memory_start + kernel_tlb)); + return memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE, + MEMBLOCK_LOW_LIMIT, memory_start + kernel_tlb, + NUMA_NO_NODE); } #endif /* CONFIG_MMU */ From patchwork Sun Nov 25 21:44:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 246891591 for ; Sun, 25 Nov 2018 21:45:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1546F29A14 for ; Sun, 25 Nov 2018 21:45:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 092C029A45; Sun, 25 Nov 2018 21:45:11 +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 8060229A14 for ; Sun, 25 Nov 2018 21:45:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E6F16B3E43; Sun, 25 Nov 2018 16:45:09 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 46E9D6B3E44; Sun, 25 Nov 2018 16:45:09 -0500 (EST) 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 29BF46B3E45; Sun, 25 Nov 2018 16:45:09 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by kanga.kvack.org (Postfix) with ESMTP id D4F4F6B3E43 for ; Sun, 25 Nov 2018 16:45:08 -0500 (EST) Received: by mail-pf1-f198.google.com with SMTP id 129-v6so9715434pfx.11 for ; Sun, 25 Nov 2018 13:45:08 -0800 (PST) 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:in-reply-to:references:message-id; bh=g8CeF6Laocb9gx1NSuPUxT9QoSJjlnP3AnlPKz7kaMU=; b=P7+kKo3U25DgSi9Oz1gnm7CW5FfFy+V75rvTOw9R3t8/n20TUmiCUWSUOn8L9NjYcB pVeNx5twGcCtGK/X11vGf/LfZdlxkXqxU2K62+/KVO8ja5AntiS6G5suSRmCj1rJCw1K T0h3TfnwIabYNopbh+CzHblNuRk/nYZZyUcIUibJBURKu3nbacdYI4x7cgogLBoqn4/w KaLVrGxyGM7QWO6s0nCWlGisxt2fpivPA6OMc7mhxlEtZOJbUeoT0YpRfGYofX39O8M9 Xg+qj113ubifTfGezIfehbFbGEh8twWIvf14oxGfsHfl5u+LoEojpE2ilJLjMltMZU8w z0Kw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gIlgRTaJlcYYmXWQMGwq0Odm31gSV8E0jlWLiIv8jfwNgFChOUa yEpiblP91J38pLWI1h9wANy1hySH2ijvmp2IPHtIrlUtYTTCME3Zow06m2/Tk7I2IjqDKa0SSY0 jWxsbrHVzApOFJv37Ww61+A52wyZS+6HvVMFR66BMF0aRl0t3oOzd/fSOKXfI1wff7w== X-Received: by 2002:a62:6f88:: with SMTP id k130mr24794760pfc.234.1543182308527; Sun, 25 Nov 2018 13:45:08 -0800 (PST) X-Google-Smtp-Source: AJdET5cR5+A24mdCbfyS//pSWHZiQSiPMqHWlU/2nQZMdWVFBy+pSbd4jE1SnCO3DpLkTX87lTsc X-Received: by 2002:a62:6f88:: with SMTP id k130mr24794725pfc.234.1543182307728; Sun, 25 Nov 2018 13:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182307; cv=none; d=google.com; s=arc-20160816; b=R837iKEJXDFZhJhE8PNYYhOGuYUkrhmBff90Y5S2GQ1DQ58XFSynMnlgXEc+cD93on GZQRqZ9H/H8RsRDqhwsEYBAReTvjIQgj2CBFcN6njWGGAnH4BxFvuXYXJyE8SQpz2Dgr ige5RvBmmu0W8sqthC0ePolzAQXxw5sZoE5ipTvTvHtBEK2YKGgROY0slAAF7IeIQpFc R0QZYQ9mg19I4PURBUeRXCnLNA7gU1pXSRXeTZByzksv31oVgQSNFIhaa79YN0sWpz9d qqFYvCPSnZJoolX+2LMxviCPcNhr0IcSBGsgoTd6cH9F4lUDriEZ9Fnm6XGsvj5+A9UZ 1JCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=g8CeF6Laocb9gx1NSuPUxT9QoSJjlnP3AnlPKz7kaMU=; b=XzwOTyism+gb/ytX4IHEaV6rEiK6Moh2N/iJzQ0133Nny5TaXI6MMVMA+B9xu/Y14n Mmp5rZQCySuTHMysIQCjcBG/v5E9bHcyFg7COUvHVl2ffd8DweColCdbDmzLv8hGo+xj 08w/mkUJHCqQ0c9RppaKX0CCEVnzp3pVsWTa5vzu/kNlFo2hze1x6a4bU3VmYqNO35bg lIovUk5uOojGog2yrS39xlnEBDmBp/gVOzYD0vjftr4xdrik9GeH+wjKs8wD6BXHCobK TiPhGRzAHdoOnG9C4alaIeBNsl3kQXdqDg6vSBVJACEHSzmvMRyBkdQz26hfie2rsI8m DAWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (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 x186si9377693pfx.269.2018.11.25.13.45.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:45:07 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAPLi5K8007532 for ; Sun, 25 Nov 2018 16:45:07 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nymppq7js-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:45:07 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:45:04 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 25 Nov 2018 21:44:56 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLitAN66519042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:44:55 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1936852052; Sun, 25 Nov 2018 21:44:55 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id D2A7852051; Sun, 25 Nov 2018 21:44:51 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:51 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH 3/5] sh: prefer memblock APIs returning virtual address Date: Sun, 25 Nov 2018 23:44:35 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-0012-0000-0000-000002CFFEFF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-0013-0000-0000-0000210538CA Message-Id: <1543182277-8819-4-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=891 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 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 Rather than use the memblock_alloc_base that returns a physical address and then convert this address to the virtual one, use appropriate memblock function that returns a virtual address. There is a small functional change in the allocation of then NODE_DATA(). Instead of panicing if the local allocation failed, the non-local allocation attempt will be made. Signed-off-by: Mike Rapoport --- arch/sh/mm/init.c | 18 +++++------------- arch/sh/mm/numa.c | 5 ++--- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index c8c13c77..3576b5f 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -192,24 +192,16 @@ void __init page_table_range_init(unsigned long start, unsigned long end, void __init allocate_pgdat(unsigned int nid) { unsigned long start_pfn, end_pfn; -#ifdef CONFIG_NEED_MULTIPLE_NODES - unsigned long phys; -#endif get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); #ifdef CONFIG_NEED_MULTIPLE_NODES - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end_pfn << PAGE_SHIFT); - /* Retry with all of system memory */ - if (!phys) - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, memblock_end_of_DRAM()); - if (!phys) + NODE_DATA(nid) = memblock_alloc_try_nid_nopanic( + sizeof(struct pglist_data), + SMP_CACHE_BYTES, MEMBLOCK_LOW_LIMIT, + MEMBLOCK_ALLOC_ACCESSIBLE, nid); + if (!NODE_DATA(nid)) panic("Can't allocate pgdat for node %d\n", nid); - - NODE_DATA(nid) = __va(phys); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); #endif NODE_DATA(nid)->node_start_pfn = start_pfn; diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 830e8b3..c4bde61 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c @@ -41,9 +41,8 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) __add_active_range(nid, start_pfn, end_pfn); /* Node-local pgdat */ - NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end)); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); + NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data), + SMP_CACHE_BYTES, nid); NODE_DATA(nid)->node_start_pfn = start_pfn; NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; From patchwork Sun Nov 25 21:44:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D13201591 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C297829A14 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6B3129A6C; Sun, 25 Nov 2018 21:45:13 +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 467D429A14 for ; Sun, 25 Nov 2018 21:45:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5F336B3E45; Sun, 25 Nov 2018 16:45:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BE9216B3E46; Sun, 25 Nov 2018 16:45:11 -0500 (EST) 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 A3F1B6B3E47; Sun, 25 Nov 2018 16:45:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by kanga.kvack.org (Postfix) with ESMTP id 5427F6B3E45 for ; Sun, 25 Nov 2018 16:45:11 -0500 (EST) Received: by mail-pf1-f199.google.com with SMTP id e89so9711820pfb.17 for ; Sun, 25 Nov 2018 13:45:11 -0800 (PST) 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:in-reply-to:references:message-id; bh=xMd4cYPweqc3nWr4Hf1Sat0/69ZwJ360J04Rwzyh4CA=; b=K8zwoHeFseMvbCSz35Bdt78YJG8SGT+IJPAnx5j+AVSIWY46J42fKmBoEkGU31TOPa CXNzIj4o4ddn6dcDpUsjYkEKYE3Ka/NtKsmWjEZzQMVLyL11T0sMeTILWsQW+1mz5eX8 Y3nUYI9rDT1kbiMLq5b9byY9hjhpJ66i8cZ257YnCMiDwhaUhJnDuNF3s57HlsjZwiQE WuNN/ai1OSDyDWRR587fC9lVSwTBIHbBN3AUTyeUz2mbJhVmsRlttacMhddmIa7W4z0X r0Na/BozRmdYaiUnEeIAxyIXdBE+NdBueeva8XMCJFHj1feiVjJ8sFZadfGLqzK2cqo2 9YcQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AA+aEWasPyeLYDZSHOy6Q/JtuJmYBR9GK3OB2oOVh2/8EZC+fPc5lOVR 7NzqDbp1js4aHu+RK54pr16O67kvUFLdwteJSwdC9dDbzzbNlUUrCwyV+Mp77ClnNpFQzs6wWIC xQ+h6MUW4Jp/Vw7ccAoAvWbZf7oCJwZ8OpxBxvYSTH5xIyoE/5C19IEiMY+b7fv54Gg== X-Received: by 2002:a17:902:e18c:: with SMTP id cd12mr8786662plb.279.1543182311019; Sun, 25 Nov 2018 13:45:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/U8y6KCFMRXabIVf+hCK1trY86xOgOviKUKqPdXnk0yt3P4wv6N0+ptCi3Eg9lefZ+MdLgl X-Received: by 2002:a17:902:e18c:: with SMTP id cd12mr8786637plb.279.1543182310454; Sun, 25 Nov 2018 13:45:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182310; cv=none; d=google.com; s=arc-20160816; b=YujGoWGVBMNT2FhLAQ0QgCAIJSLqFqZv2YwaHoZLtvNkFAcH/BbQpQsq3zY7DaoghG 1XIoKc3OH2k2bN84vona0Wtrw9cG76H4R9AZivaj7xaXSgyXe7JPSC8NP1Z6ir7MTGg/ ZugoKLHfK6cMLrQFI3RmvUNW/0g91QViQYumObctCgHz1zh1R7OSSgd+/+FhRbEYxaXJ 1I8rzkAiIDLX5rt2GwQMQFpOUUsi8EdZ5Dkt94CjhDpA2kzkmfUZfL8rt5joOjLXmms7 Aci/uoGFo38NLYk0xblUNtMmQ7oqTqD2gEYTpRVQWuFCJ7aCCkAIfuhAGuxdJNmWWJuk 82HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=xMd4cYPweqc3nWr4Hf1Sat0/69ZwJ360J04Rwzyh4CA=; b=B+czEC4gdiBKfXhEIWXbtWWOlb8t669+Ul41mSEHB9c81Gpk/3V8TLjgPtCfSC1Jca XrIWwmD5J01cdzh/m1AJocKr/ZvgQeLebpLTsKLq+LqCF1dDq+f/fZzqWj/Gv3Vf8+a3 gnedXEG2vgrRNNxO6H/thEPH4622K32F0L+Kkz9rGZrRYNAyWsZG0TG6OSclISXUcVJC mHPsScaXEu9UFMpZDlc8NlUqORfC1u14PFSdyvdkVCWf9rEBny+8JpQ2gQydNZrBwPmE ixsfgS6LAOu+PmDMpxCS5U8RRJeo5Yh78qFInsFpjAeZTFbQVwsqqZl9pwNaJKMXn8jO LRJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (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 q14si59863190pgg.433.2018.11.25.13.45.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:45:10 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAPLifcY013702 for ; Sun, 25 Nov 2018 16:45:10 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nymvtptpp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:45:09 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:45:07 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 25 Nov 2018 21:45:00 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLixJQ61800506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:44:59 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 312B94C044; Sun, 25 Nov 2018 21:44:59 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E78044C046; Sun, 25 Nov 2018 21:44:55 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 25 Nov 2018 21:44:55 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:55 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH 4/5] openrisc: simplify pte_alloc_one_kernel() Date: Sun, 25 Nov 2018 23:44:36 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-0016-0000-0000-0000022C7BAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-0017-0000-0000-00003284CC10 Message-Id: <1543182277-8819-5-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=741 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811250133 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 pte_alloc_one_kernel() function allocates a page using __get_free_page(GFP_KERNEL) when mm initialization is complete and memblock_phys_alloc() on the earlier stages. The physical address of the page allocated with memblock_phys_alloc() is converted to the virtual address and in the both cases the allocated page is cleared using clear_page(). The code is simplified by replacing __get_free_page() with get_zeroed_page() and by replacing memblock_phys_alloc() with memblock_alloc(). Signed-off-by: Mike Rapoport Acked-by: Stafford Horne --- arch/openrisc/mm/ioremap.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c index c969752..cfef989 100644 --- a/arch/openrisc/mm/ioremap.c +++ b/arch/openrisc/mm/ioremap.c @@ -123,13 +123,10 @@ pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm, { pte_t *pte; - if (likely(mem_init_done)) { - pte = (pte_t *) __get_free_page(GFP_KERNEL); - } else { - pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - } + if (likely(mem_init_done)) + pte = (pte_t *)get_zeroed_page(GFP_KERNEL); + else + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); - if (pte) - clear_page(pte); return pte; } From patchwork Sun Nov 25 21:44:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10697131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 73F0E1591 for ; Sun, 25 Nov 2018 21:45:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64C4929A14 for ; Sun, 25 Nov 2018 21:45:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 582F329A6C; Sun, 25 Nov 2018 21:45:20 +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=unavailable 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 8D5FD29A14 for ; Sun, 25 Nov 2018 21:45:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5813A6B3E4A; Sun, 25 Nov 2018 16:45:18 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 50CE16B3E4B; Sun, 25 Nov 2018 16:45:18 -0500 (EST) 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 385886B3E4C; Sun, 25 Nov 2018 16:45:18 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id CF6806B3E4A for ; Sun, 25 Nov 2018 16:45:17 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id s50so8135561edd.11 for ; Sun, 25 Nov 2018 13:45:17 -0800 (PST) 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:in-reply-to:references:message-id; bh=H5xDeK8r7dkLV3bzaKFazh6Z5DWTM1d5sIxpF2acLNk=; b=BVA0itItLiFKQ83Egr2S/Ag73rmfHLTryZPesQe0Oeqhc0OzNk8F5Kz/SrQwUz9z3z FbnzjLiwXVdrDryiMjCmncJrKp4m5JHDRVTR1OGOjZVt0uc53SVckAvSEvXIyxteQk6w vw4gEGKM0CcVJwQw0h8mlDzODTcmd6G3+ywtGxGfxlYn9AtXnZQM0eDb8qzOv1rG3+nL vcXHmkts10xF77RhmuJc/1S6L/GL5y8bGPrdzvKITDwsBtWQSOh+v+8CtuhmcwiGBltY xS6NAmlnCRxnOryHEEWEKACHkWE/wtjoDfiSjyTBjmgN/c8b/47RA4jo4KJ6m5FxFFbJ pK9Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AGRZ1gIG7o49gGVwCW/LGNICAzuq/HMpQWfP1UFPk4+VnnoAw9vReIOc BvuC/NgLFT6QbnC4emTPkev9VeWruZvmZE9d1IQlgbLugY+9fGh/U8fh43N3iTjRcE9dKh993Xz 9O4TFYCtts9D4B8dhzfvup0DhlXCoCrcttLJq3yegHf4Hwskqgp7JeQJfhi6gHokNhA== X-Received: by 2002:a17:906:7e19:: with SMTP id e25-v6mr18137749ejr.12.1543182317286; Sun, 25 Nov 2018 13:45:17 -0800 (PST) X-Google-Smtp-Source: AJdET5c7n4scCrjkioYNkP+AJJMw/C0hvYVLIWN1x1+PrzPSD05s1+6vLEMWecGC20vuxEAcurcH X-Received: by 2002:a17:906:7e19:: with SMTP id e25-v6mr18137705ejr.12.1543182315573; Sun, 25 Nov 2018 13:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543182315; cv=none; d=google.com; s=arc-20160816; b=lhqn664OXpdGdAUtQEUH1EdGyaWXmFQFAPkLsGWWJKrOZbQ38JkbKnAw/DCc4CPnnT var1827g4NyoKqYPj9Lu+oLeRc1uqKOm6N7shp9zA2e+KIP7YEg0E27boNUC99Q59a4N yQPoNnNRdWxBnpkriGUdY3GA0J5s/+T/yaXYAiyKvFQpyNb9iGrqZs3vgW+IOBt+IKQU ea2C0vYxgCCj9fi8mILuiYoRIiK3iBfxGCmxNqf6DDrmbb4B8s3+yByR3N5EERx3MfNo cgbtnVFfKhJwbEvTdC+T2EqliO5XpOXYgTJz5ddGwlgjh/f5mBviF2nRVT4snB2fOHQx 90Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from; bh=H5xDeK8r7dkLV3bzaKFazh6Z5DWTM1d5sIxpF2acLNk=; b=Inj9VX/7Tqu/eXBs8fL+gYcfuIy+o10zEEYTTAzsIsnxDZ7UMAHLBXQg6Iomq58t/d Fqz+4DN4h2HiGWRTpgks84+ty1J1gt02xUUjvvlnWqSDvcluw7F2SPsawOWDwdddCdh0 A51EsWFu6w2/PxUJ85E5U6LMjMPC6ZLDOInlzCdrtpPT/SHCwM13w+NS+wapyy1cR0xn EG6wcNbKOoM5HRygeGWzudUOvwHpxDvYltm/+saAUffmqsZbYyscebYlQaHiVEVUBNRn AWrAjkaYv5iChQrDOGMXrIFA72QJloaJ9y9X5CG0ZVA7nDrFOiJCOngmRt4bvYj77LKk n7uA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id h23si8858682edb.114.2018.11.25.13.45.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Nov 2018 13:45:15 -0800 (PST) Received-SPF: pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com 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 wAPLi5dM081493 for ; Sun, 25 Nov 2018 16:45:14 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p02202tx9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Nov 2018 16:45:13 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Nov 2018 21:45:11 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 25 Nov 2018 21:45:04 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAPLj3in41877620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 21:45:03 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4790DA4055; Sun, 25 Nov 2018 21:45:03 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0ADB9A4051; Sun, 25 Nov 2018 21:45:00 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.207.68]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 25 Nov 2018 21:44:59 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Sun, 25 Nov 2018 23:44:59 +0200 From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Arnd Bergmann , Benjamin Herrenschmidt , "David S. Miller" , Guan Xuetao , Greentime Hu , Jonas Bonn , Michael Ellerman , Michal Hocko , Michal Simek , Mark Salter , Paul Mackerras , Rich Felker , Russell King , Stefan Kristiansson , Stafford Horne , Vincent Chen , Yoshinori Sato , linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, Mike Rapoport Subject: [PATCH 5/5] arch: simplify several early memory allocations Date: Sun, 25 Nov 2018 23:44:37 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> References: <1543182277-8819-1-git-send-email-rppt@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112521-0012-0000-0000-000002CFFF04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112521-0013-0000-0000-0000210538CD Message-Id: <1543182277-8819-6-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-25_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1811250133 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 There are several early memory allocations in arch/ code that use memblock_phys_alloc() to allocate memory, convert the returned physical address to the virtual address and then set the allocated memory to zero. Exactly the same behaviour can be achieved simply by calling memblock_alloc(): it allocates the memory in the same way as memblock_phys_alloc(), then it performs the phys_to_virt() conversion and clears the allocated memory. Replace the longer sequence with a simpler call to memblock_alloc(). Signed-off-by: Mike Rapoport --- arch/arm/mm/mmu.c | 4 +--- arch/c6x/mm/dma-coherent.c | 9 ++------- arch/nds32/mm/init.c | 12 ++++-------- arch/powerpc/kernel/setup-common.c | 4 ++-- arch/powerpc/mm/pgtable_32.c | 4 +--- arch/powerpc/mm/ppc_mmu_32.c | 3 +-- arch/powerpc/platforms/powernv/opal.c | 3 +-- arch/sparc/kernel/prom_64.c | 7 ++----- arch/sparc/mm/init_64.c | 9 +++------ arch/unicore32/mm/mmu.c | 4 +--- 10 files changed, 18 insertions(+), 41 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index f5cc1cc..0a04c9a5 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -721,9 +721,7 @@ EXPORT_SYMBOL(phys_mem_access_prot); static void __init *early_alloc_aligned(unsigned long sz, unsigned long align) { - void *ptr = __va(memblock_phys_alloc(sz, align)); - memset(ptr, 0, sz); - return ptr; + return memblock_alloc(sz, align); } static void __init *early_alloc(unsigned long sz) diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c index 01305c7..ffc49e2 100644 --- a/arch/c6x/mm/dma-coherent.c +++ b/arch/c6x/mm/dma-coherent.c @@ -118,8 +118,6 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr, */ void __init coherent_mem_init(phys_addr_t start, u32 size) { - phys_addr_t bitmap_phys; - if (!size) return; @@ -135,11 +133,8 @@ void __init coherent_mem_init(phys_addr_t start, u32 size) if (dma_size & (PAGE_SIZE - 1)) ++dma_pages; - bitmap_phys = memblock_phys_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long), - sizeof(long)); - - dma_bitmap = phys_to_virt(bitmap_phys); - memset(dma_bitmap, 0, dma_pages * PAGE_SIZE); + dma_bitmap = memblock_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long), + sizeof(long)); } static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size, diff --git a/arch/nds32/mm/init.c b/arch/nds32/mm/init.c index 131104b..9f19be8 100644 --- a/arch/nds32/mm/init.c +++ b/arch/nds32/mm/init.c @@ -80,8 +80,7 @@ static void __init map_ram(void) } /* Alloc one page for holding PTE's... */ - pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - memset(pte, 0, PAGE_SIZE); + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); set_pmd(pme, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE)); /* Fill the newly allocated page with PTE'S */ @@ -113,8 +112,7 @@ static void __init fixedrange_init(void) pgd = swapper_pg_dir + pgd_index(vaddr); pud = pud_offset(pgd, vaddr); pmd = pmd_offset(pud, vaddr); - fixmap_pmd_p = (pmd_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - memset(fixmap_pmd_p, 0, PAGE_SIZE); + fixmap_pmd_p = memblock_alloc(PAGE_SIZE, PAGE_SIZE); set_pmd(pmd, __pmd(__pa(fixmap_pmd_p) + _PAGE_KERNEL_TABLE)); #ifdef CONFIG_HIGHMEM @@ -126,8 +124,7 @@ static void __init fixedrange_init(void) pgd = swapper_pg_dir + pgd_index(vaddr); pud = pud_offset(pgd, vaddr); pmd = pmd_offset(pud, vaddr); - pte = (pte_t *) __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - memset(pte, 0, PAGE_SIZE); + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); set_pmd(pmd, __pmd(__pa(pte) + _PAGE_KERNEL_TABLE)); pkmap_page_table = pte; #endif /* CONFIG_HIGHMEM */ @@ -152,8 +149,7 @@ void __init paging_init(void) fixedrange_init(); /* allocate space for empty_zero_page */ - zero_page = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - memset(zero_page, 0, PAGE_SIZE); + zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE); zone_sizes_init(); empty_zero_page = virt_to_page(zero_page); diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 93ee370..8f6c763 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -459,8 +459,8 @@ void __init smp_setup_cpu_maps(void) DBG("smp_setup_cpu_maps()\n"); - cpu_to_phys_id = __va(memblock_phys_alloc(nr_cpu_ids * sizeof(u32), __alignof__(u32))); - memset(cpu_to_phys_id, 0, nr_cpu_ids * sizeof(u32)); + cpu_to_phys_id = memblock_alloc(nr_cpu_ids * sizeof(u32), + __alignof__(u32)); for_each_node_by_type(dn, "cpu") { const __be32 *intserv; diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index bda3c6f..9931e68 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -50,9 +50,7 @@ __ref pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) if (slab_is_available()) { pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); } else { - pte = __va(memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE)); - if (pte) - clear_page(pte); + pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE); } return pte; } diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index f6f575b..fddf823 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c @@ -224,8 +224,7 @@ void __init MMU_init_hw(void) * Find some memory for the hash table. */ if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322); - Hash = __va(memblock_phys_alloc(Hash_size, Hash_size)); - memset(Hash, 0, Hash_size); + Hash = memblock_alloc(Hash_size, Hash_size); _SDR1 = __pa(Hash) | SDR1_LOW_BITS; Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size); diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index beed86f..29ee2ea 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -171,8 +171,7 @@ int __init early_init_dt_scan_recoverable_ranges(unsigned long node, /* * Allocate a buffer to hold the MC recoverable ranges. */ - mc_recoverable_range =__va(memblock_phys_alloc(size, __alignof__(u64))); - memset(mc_recoverable_range, 0, size); + mc_recoverable_range = memblock_alloc(size, __alignof__(u64)); for (i = 0; i < mc_recoverable_range_len; i++) { mc_recoverable_range[i].start_addr = diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c index c37955d..2a17665 100644 --- a/arch/sparc/kernel/prom_64.c +++ b/arch/sparc/kernel/prom_64.c @@ -34,16 +34,13 @@ void * __init prom_early_alloc(unsigned long size) { - unsigned long paddr = memblock_phys_alloc(size, SMP_CACHE_BYTES); - void *ret; + void *ret = memblock_alloc(size, SMP_CACHE_BYTES); - if (!paddr) { + if (!ret) { prom_printf("prom_early_alloc(%lu) failed\n", size); prom_halt(); } - ret = __va(paddr); - memset(ret, 0, size); prom_early_allocated += size; return ret; diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 3c8aac2..52884f4 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c @@ -1089,16 +1089,13 @@ static void __init allocate_node_data(int nid) struct pglist_data *p; unsigned long start_pfn, end_pfn; #ifdef CONFIG_NEED_MULTIPLE_NODES - unsigned long paddr; - paddr = memblock_phys_alloc_try_nid(sizeof(struct pglist_data), - SMP_CACHE_BYTES, nid); - if (!paddr) { + NODE_DATA(nid) = memblock_alloc_node(sizeof(struct pglist_data), + SMP_CACHE_BYTES, nid); + if (!NODE_DATA(nid)) { prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); prom_halt(); } - NODE_DATA(nid) = __va(paddr); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); NODE_DATA(nid)->node_id = nid; #endif diff --git a/arch/unicore32/mm/mmu.c b/arch/unicore32/mm/mmu.c index 040a8c2..50d8c1a 100644 --- a/arch/unicore32/mm/mmu.c +++ b/arch/unicore32/mm/mmu.c @@ -143,9 +143,7 @@ static void __init build_mem_type_table(void) static void __init *early_alloc(unsigned long sz) { - void *ptr = __va(memblock_phys_alloc(sz, sz)); - memset(ptr, 0, sz); - return ptr; + return memblock_alloc(sz, sz); } static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr,