Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753880AbdCMSus (ORCPT ); Mon, 13 Mar 2017 14:50:48 -0400 Received: from mail.skyhub.de ([5.9.137.197]:53872 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753792AbdCMSuk (ORCPT ); Mon, 13 Mar 2017 14:50:40 -0400 Date: Mon, 13 Mar 2017 19:50:21 +0100 From: Borislav Petkov To: Wei Yang Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/mm: trivial code cleanup for memory_map_top_doown() Message-ID: <20170313185021.oxl3ybuiiuqnyg5e@pd.tnic> References: <20170217143033.95412-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170217143033.95412-1-richard.weiyang@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1785 Lines: 52 On Fri, Feb 17, 2017 at 10:30:33PM +0800, Wei Yang wrote: > In case (last_start <= step_size), start is for sure to be 0. So, it is Well, lemme see: [ 0.000000] memory_map_top_down: entry, [0x100000:0x7ffdf000) [ 0.000000] memory_map_top_down: addr: 0x7fc00000, real_end: 0x7fe00000 [ 0.000000] memory_map_top_down: last_start: 0x40000000 <= step_size: 0x2000000000, start: 0x40000000 ^^^^^^^^^^ It doesn't look like 0 to me. --- diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 2193799ca800..d3b02a416df3 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -506,10 +506,14 @@ static void __init memory_map_top_down(unsigned long map_start, unsigned long addr; unsigned long mapped_ram_size = 0; + pr_info("%s: entry, [0x%lx:0x%lx)\n", __func__, map_start, map_end); + /* xen has big range in reserved near end of ram, skip it at first.*/ addr = memblock_find_in_range(map_start, map_end, PMD_SIZE, PMD_SIZE); real_end = addr + PMD_SIZE; + pr_info("%s: addr: 0x%lx, real_end: 0x%lx\n", __func__, addr, real_end); + /* step_size need to be small so pgt_buf from BRK could cover it */ step_size = PMD_SIZE; max_pfn_mapped = 0; /* will get exact value next */ @@ -527,8 +531,13 @@ static void __init memory_map_top_down(unsigned long map_start, start = round_down(last_start - 1, step_size); if (start < map_start) start = map_start; - } else + } else { + pr_info("%s: last_start: 0x%lx <= step_size: 0x%lx, start: 0x%lx\n", + __func__, last_start, step_size, start); + start = map_start; + } + mapped_ram_size += init_range_memory_mapping(start, last_start); last_start = start; -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.