From: Wei Yang <richard.weiyang@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Wei Yang <richard.weiyang@gmail.com>,
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()
Date: Tue, 14 Mar 2017 11:56:39 +0800 [thread overview]
Message-ID: <20170314035639.GA30208@WeideMacBook-Pro.local> (raw)
In-Reply-To: <20170313185021.oxl3ybuiiuqnyg5e@pd.tnic>
[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-03-14 3:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 14:30 [PATCH] x86/mm: trivial code cleanup for memory_map_top_doown() Wei Yang
2017-03-13 18:50 ` Borislav Petkov
2017-03-14 3:56 ` Wei Yang [this message]
2017-03-20 2:26 ` Wei Yang
2017-05-02 13:26 ` Wei Yang
2017-08-03 7:12 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314035639.GA30208@WeideMacBook-Pro.local \
--to=richard.weiyang@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).