From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <andi@firstfloor.org>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: More breakage in native_rdtsc out of line in git-x86
Date: Wed, 9 Jan 2008 10:09:56 +0100 [thread overview]
Message-ID: <20080109090956.GA14274@elte.hu> (raw)
In-Reply-To: <20080109035534.GA30321@basil.nowhere.org>
* Andi Kleen <andi@firstfloor.org> wrote:
> Unfortunately simply adding __vsyscall_fn to native_read_tsc doesn't
> work -- causes early kernel faults like
>
> PANIC: early exception rip ffffffffff600105 error 10 cr2 ffffffffff600105
> Pid: 0, comm: swapper Not tainted 2.6.24-rc6 #58
>
> Call Trace:
> [<ffffffff80211dec>] native_sched_clock+0x9/0x3f
> [<ffffffff8022b758>] init_idle+0x33/0xd1
> [<ffffffff80825449>] sched_init+0x26d/0x283
> [<ffffffff80815899>] start_kernel+0x10b/0x2bd
> [<ffffffff80815114>] _sinittext+0x114/0x11b
>
> Not sure why that is -- in theory the vsyscall functions should be
> callable from the main kernel. Might be a binutils problem or another
> code regression.
nope, it's a 64-bit setup/dependency bug/problem: the vsyscall mappings
are installed via an __initcall, and that's too late for early use. The
combo patch below fixed the crash for me, does it work on your box too?
Ingo
Index: linux-x86.q/arch/x86/kernel/rtc.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/rtc.c
+++ linux-x86.q/arch/x86/kernel/rtc.c
@@ -195,7 +195,7 @@ int update_persistent_clock(struct times
return set_rtc_mmss(now.tv_sec);
}
-unsigned long long native_read_tsc(void)
+unsigned long long __vsyscall_fn native_read_tsc(void)
{
DECLARE_ARGS(val, low, high);
Index: linux-x86.q/arch/x86/kernel/setup_64.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/setup_64.c
+++ linux-x86.q/arch/x86/kernel/setup_64.c
@@ -46,6 +46,7 @@
#include <asm/mtrr.h>
#include <asm/uaccess.h>
#include <asm/system.h>
+#include <asm/vsyscall.h>
#include <asm/io.h>
#include <asm/smp.h>
#include <asm/msr.h>
@@ -464,6 +465,7 @@ void __init setup_arch(char **cmdline_p)
#endif
reserve_crashkernel();
paging_init();
+ map_vsyscall();
early_quirks();
Index: linux-x86.q/arch/x86/kernel/vsyscall_64.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/vsyscall_64.c
+++ linux-x86.q/arch/x86/kernel/vsyscall_64.c
@@ -319,7 +319,7 @@ cpu_vsyscall_notifier(struct notifier_bl
return NOTIFY_DONE;
}
-static void __init map_vsyscall(void)
+void __init map_vsyscall(void)
{
extern char __vsyscall_0;
unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0);
@@ -335,7 +335,6 @@ static int __init vsyscall_init(void)
BUG_ON((unsigned long) &vtime != VSYSCALL_ADDR(__NR_vtime));
BUG_ON((VSYSCALL_ADDR(0) != __fix_to_virt(VSYSCALL_FIRST_PAGE)));
BUG_ON((unsigned long) &vgetcpu != VSYSCALL_ADDR(__NR_vgetcpu));
- map_vsyscall();
#ifdef CONFIG_SYSCTL
register_sysctl_table(kernel_root_table2);
#endif
next prev parent reply other threads:[~2008-01-09 9:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-09 3:55 More breakage in native_rdtsc out of line in git-x86 Andi Kleen
2008-01-09 5:21 ` More breakage in native_rdtsc out of line in git-x86 II Andi Kleen
2008-01-09 9:09 ` Ingo Molnar [this message]
2008-01-09 14:19 ` More breakage in native_rdtsc out of line in git-x86 Andi Kleen
2008-01-09 15:22 ` Ingo Molnar
2008-01-09 15:51 ` Andi Kleen
2008-01-09 16:30 ` Ingo Molnar
2008-01-09 17:48 ` Andi Kleen
2008-01-09 20:25 ` Arjan van de Ven
2008-01-09 20:40 ` Andi Kleen
2008-01-09 20:57 ` H. Peter Anvin
2008-01-09 22:09 ` Björn Steinbrink
2008-01-09 22:28 ` Andi Kleen
2008-01-09 22:35 ` Harvey Harrison
2008-01-09 22:41 ` Andi Kleen
2008-01-09 23:21 ` Björn Steinbrink
2008-01-09 23:37 ` Paolo Ciarrocchi
2008-01-11 5:21 ` Cyrill Gorcunov
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=20080109090956.GA14274@elte.hu \
--to=mingo@elte.hu \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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