From: tip-bot for Yinghai Lu <yinghai@kernel.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
yinghai@kernel.org, lizf@cn.fujitsu.com, vegard.nossum@gmail.com,
zhaolei@cn.fujitsu.com, yinghai@kerne.org, jeremy@goop.org,
fweisbec@gmail.com, akpm@linux-foundation.org,
rostedt@goodmis.org, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:x86/urgent] x86: mtrr: Fix high_width computation when phys-addr is >= 44bit
Date: Mon, 11 May 2009 09:54:26 GMT [thread overview]
Message-ID: <tip-917a0153621572e88aeb2d5df025ad2e81027287@git.kernel.org> (raw)
In-Reply-To: <4A026540.8060504@kernel.org>
Commit-ID: 917a0153621572e88aeb2d5df025ad2e81027287
Gitweb: http://git.kernel.org/tip/917a0153621572e88aeb2d5df025ad2e81027287
Author: Yinghai Lu <yinghai@kernel.org>
AuthorDate: Wed, 6 May 2009 21:36:16 -0700
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 11 May 2009 11:40:43 +0200
x86: mtrr: Fix high_width computation when phys-addr is >= 44bit
found one system where cpu address line is 44bits, mtrr printout
is not right:
[ 0.000000] MTRR variable ranges enabled:
[ 0.000000] 0 base 0 00000000 mask FF0 00000000 write-back
[ 0.000000] 1 base 10 00000000 mask FFF 80000000 write-back
[ 0.000000] 2 base 0 80000000 mask FFF 80000000 uncachable
[ 0.000000] 3 base 0 7F800000 mask FFF FF800000 uncachable
Li Zefan and Frederic pointed out the high_width could be -4 some how.
It turns out when phys_addr is 44bit, size_or_mask will be
ffffffff,00000000 so ffs(size_or_mask) will be 0.
Try to check low 32 bit, to get correct high_width.
Signed-off-by: Yinghai Lu <yinghai@kerne.org>
Also-analyzed-by: Frederic Weisbecker <fweisbec@gmail.com>
Also-analyzed-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Zhaolei <zhaolei@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <4A026540.8060504@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/kernel/cpu/mtrr/generic.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 0b776c0..d21d4fb 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -275,7 +275,11 @@ static void __init print_mtrr_state(void)
}
printk(KERN_DEBUG "MTRR variable ranges %sabled:\n",
mtrr_state.enabled & 2 ? "en" : "dis");
- high_width = ((size_or_mask ? ffs(size_or_mask) - 1 : 32) - (32 - PAGE_SHIFT) + 3) / 4;
+ if (size_or_mask & 0xffffffffUL)
+ high_width = ffs(size_or_mask & 0xffffffffUL) - 1;
+ else
+ high_width = ffs(size_or_mask>>32) + 32 - 1;
+ high_width = (high_width - (32 - PAGE_SHIFT) + 3) / 4;
for (i = 0; i < num_var_ranges; ++i) {
if (mtrr_state.var_ranges[i].mask_lo & (1 << 11))
printk(KERN_DEBUG " %u base %0*X%05X000 mask %0*X%05X000 %s\n",
next prev parent reply other threads:[~2009-05-11 9:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 7:06 printk %0*X is broken Yinghai Lu
2009-05-06 7:18 ` Ingo Molnar
2009-05-06 8:00 ` Li Zefan
2009-05-06 8:12 ` Vegard Nossum
2009-05-06 8:27 ` Lai Jiangshan
2009-05-06 8:34 ` Li Zefan
2009-05-06 9:20 ` Vegard Nossum
2009-05-06 8:30 ` Li Zefan
2009-05-06 16:11 ` Frederic Weisbecker
2009-05-07 4:36 ` [PATCH] x86: fix compute high_width with phys-addr is 44bit and more Yinghai Lu
2009-05-11 9:54 ` tip-bot for Yinghai Lu [this message]
2009-05-06 10:25 ` printk %0*X is broken Frédéric Weisbecker
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=tip-917a0153621572e88aeb2d5df025ad2e81027287@git.kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=vegard.nossum@gmail.com \
--cc=yinghai@kerne.org \
--cc=zhaolei@cn.fujitsu.com \
/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