Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751206AbdHCHNW (ORCPT ); Thu, 3 Aug 2017 03:13:22 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:34381 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750937AbdHCHNU (ORCPT ); Thu, 3 Aug 2017 03:13:20 -0400 MIME-Version: 1.0 In-Reply-To: <20170502132631.GA7654@WeideMacBook-Pro.local> References: <20170217143033.95412-1-richard.weiyang@gmail.com> <20170313185021.oxl3ybuiiuqnyg5e@pd.tnic> <20170314035639.GA30208@WeideMacBook-Pro.local> <20170502132631.GA7654@WeideMacBook-Pro.local> From: Wei Yang Date: Thu, 3 Aug 2017 15:12:59 +0800 Message-ID: Subject: Re: [PATCH] x86/mm: trivial code cleanup for memory_map_top_doown() To: Wei Yang Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2086 Lines: 57 Hmm.... ping... On Tue, May 2, 2017 at 9:26 PM, Wei Yang wrote: > Hi, Borislav and all > > Do you agree with my analysis or you have other comments? > > On Tue, Mar 14, 2017 at 11:56:39AM +0800, Wei Yang wrote: >>On Mon, Mar 13, 2017 at 07:50:21PM +0100, Borislav Petkov wrote: >>>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 >>> >> >>Hmm, I may write it more specific: >> >>"start" is for sure to be set to 0 with round_down(last_start - 1, step_size). >> >>>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 >>>@@ -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); >>>+ >> >>If you change this log with the following >> >> pr_err("%s: last_start: 0x%lx <= step_size: 0x%lx, start: 0x%lx\n", >> __func__, last_start, step_size, >> round_down(last_start - 1, step_size)); >> >>You could see after calculation, start is 0 when (last_start <= step_size). >> >>-- >>Wei Yang >>Help you, Help me > > > > -- > Wei Yang > Help you, Help me