mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Herrmann <andreas.herrmann3@amd.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	linux-kernel@vger.kernel.org, xiyou.wangcong@gmail.com,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] x86: memtest: remove 64-bit division
Date: Mon, 8 Jun 2009 19:09:39 +0200	[thread overview]
Message-ID: <20090608170939.GB12431@alberich.amd.com> (raw)
In-Reply-To: <20090605102440.58a6e443.akpm@linux-foundation.org>

Using gcc 3.3.5 a "make allmodconfig" + "CONFIG_KVM=n"
triggers a build error:

 arch/x86/mm/built-in.o(.init.text+0x43f7): In function `__change_page_attr':
 arch/x86/mm/pageattr.c:114: undefined reference to `__udivdi3'
 make: *** [.tmp_vmlinux1] Error 1

The culprit turned out to be a division in arch/x86/mm/memtest.c
For more info see this thread
http://marc.info/?l=linux-kernel&m=124416232620683

The patch entirely removes the division that caused the build
error.

Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/mm/memtest.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index 605c8be..c0bedcd 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -40,23 +40,23 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
 
 static void __init memtest(u64 pattern, u64 start_phys, u64 size)
 {
-	u64 i, count;
-	u64 *start;
+	u64 *p;
+	void *start, *end;
 	u64 start_bad, last_bad;
 	u64 start_phys_aligned;
 	size_t incr;
 
 	incr = sizeof(pattern);
 	start_phys_aligned = ALIGN(start_phys, incr);
-	count = (size - (start_phys_aligned - start_phys))/incr;
 	start = __va(start_phys_aligned);
+	end = start + size - (start_phys_aligned - start_phys);
 	start_bad = 0;
 	last_bad = 0;
 
-	for (i = 0; i < count; i++)
-		start[i] = pattern;
-	for (i = 0; i < count; i++, start++, start_phys_aligned += incr) {
-		if (*start == pattern)
+	for (p = start; p < end; p++)
+		*p = pattern;
+	for (p = start; p < end; p++, start_phys_aligned += incr) {
+		if (*p == pattern)
 			continue;
 		if (start_phys_aligned == last_bad + incr) {
 			last_bad += incr;
-- 
1.6.3.1




  reply	other threads:[~2009-06-08 17:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05  0:38 [2.6.30-rc8] gcc 3.3 : __udivdi3 undefined Tetsuo Handa
2009-06-05  2:38 ` Amerigo Wang
2009-06-05  3:17   ` Andrew Morton
2009-06-05  3:39     ` Tetsuo Handa
2009-06-05  3:51       ` Andrew Morton
2009-06-05  4:00         ` Tetsuo Handa
2009-06-05  4:20           ` Andrew Morton
2009-06-05  6:26             ` Amerigo Wang
2009-06-05  6:51             ` Tetsuo Handa
2009-06-05  7:03               ` Andrew Morton
2009-06-05  9:37                 ` Andreas Herrmann
2009-06-05 12:58                   ` Tetsuo Handa
2009-06-05 17:24                   ` Andrew Morton
2009-06-08 17:09                     ` Andreas Herrmann [this message]
2009-06-08 20:36                       ` [tip:x86/urgent] x86: memtest: remove 64-bit division tip-bot for Andreas Herrmann
2009-06-05  3:24   ` [2.6.30-rc8] gcc 3.3 : __udivdi3 undefined Tetsuo Handa

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=20090608170939.GB12431@alberich.amd.com \
    --to=andreas.herrmann3@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=xiyou.wangcong@gmail.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

all inboxes | Powered by JetHome®