Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753116AbdCND4p (ORCPT ); Mon, 13 Mar 2017 23:56:45 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:33168 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751934AbdCND4n (ORCPT ); Mon, 13 Mar 2017 23:56:43 -0400 Date: Tue, 14 Mar 2017 11:56:39 +0800 From: Wei Yang To: Borislav Petkov Cc: Wei Yang , 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: <20170314035639.GA30208@WeideMacBook-Pro.local> Reply-To: Wei Yang References: <20170217143033.95412-1-richard.weiyang@gmail.com> <20170313185021.oxl3ybuiiuqnyg5e@pd.tnic> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="d6Gm4EdcadzBjdND" Content-Disposition: inline In-Reply-To: <20170313185021.oxl3ybuiiuqnyg5e@pd.tnic> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2528 Lines: 76 --d6Gm4EdcadzBjdND Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 <=3D 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_siz= e). >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 <=3D 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 =3D round_down(last_start - 1, step_size); > if (start < map_start) > start =3D map_start; >- } else >+ } else { >+ pr_info("%s: last_start: 0x%lx <=3D 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 <=3D 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 <=3D step_size= ). --=20 Wei Yang Help you, Help me --d6Gm4EdcadzBjdND Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYx2n3AAoJEKcLNpZP5cTdNMAP/04X05rWoCxnZHh5oxhRaSTk g5AwnSdjnVn9pEikIm+k0w/ZftxAqIr2+JS+ak30MDRr60gyifS9URK6tgREwD/x ewF7IXuQX8+Q0p0pTDr9XseBZR+AOCEg6N0q/QzLksjwTksP2SBzxmVJoIGh5jZ8 QDqKw5ZnDkQnDs+L9SEuk2VC4pPo8ps+toMkoBDxg6SMXGq/VORwg41oRGdsUs7I tS0SyBfipFG995+E0Cw1O/5ubXbMSFt5W3ZtuhuZIlYuFJqolWU2FG3C6TlXx9Xx EdszmbCYtAqgsstqWUMg9kj+mGgMytemzcML0SlMWpjmQUwT5UP5OI+/ZM7MCKxV a1h80ONizOwT7vCA3l8Fs7xsiplSbTmb4Amzaqc3LkOjrcuu0COqtdw7YLu7ohgy EDiw2GvSrh0Tzxl/77zD0SMFF2PoBDLM+NuAVa7T5cZGkKIaJt7xD+HRyKHS5q+J L8hFPgH5fYK2UsBlAygzb/KwdlNz8qGJUKQ8hoF2ugrp/tIKyMJGaMrlPH0CFJQe mMX/Wzc6GmmRVYHcg0d1D9bBgiWitldMxED/aFcGMnbBh26RwK72lYLIZEWAdqHw cNe0xXdbNxHut6V1mNo0By4enWma5Z/wjIFn7+9vdHlK3Q+m0r4oB3AOwdks/7Kf uUVl/sIyQ82mHzgu02/t =avI/ -----END PGP SIGNATURE----- --d6Gm4EdcadzBjdND--