From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andi Kleen <ak@suse.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Pavel Machek <pavel@ucw.cz>,
"Michal Piotrowski" <michal.k.k.piotrowski@gmail.com>
Subject: [2.6.23-rc1 REGRESSION] CPU hotplug totally broken on HPC nx6325 (x86_64)
Date: Thu, 26 Jul 2007 14:40:49 +0200 [thread overview]
Message-ID: <200707261440.50649.rjw@sisk.pl> (raw)
Hi,
On my Turion64-based HPC nx6325 with the 2.6.23-rc1 x86_64 kernel doing
# echo 0 > /sys/devices/system/cpu/cpu1/online
causes the system to crash in a spectacular fashion (call traces going
continuously on the console, no reaction to anything except for the power
button). For this reason, suspend and hibernation don't work as well.
Bisection has shown that your commit 19d36ccdc34f5ed444f8a6af0cbfdb6790eb1177
"x86: Fix alternatives and kprobes to remap write-protected kernel text" causes
that to happen and indeed after applying the appended patch the problem doesn't
show up any more.
[In the first version of the appended patch I forgot to add the chunk in
mark_rodata_ro() and thus I got an oops from the line added to nop_out().
I wonder if that might be related to the $subject problem.]
Strangely enough, everything works fine on my second test box based on a
dual-core Athlon 64.
Unfortunately, I can't get any debugging information from the box after the
failure. I can try to set up netconsole, but I don't really expect it to work.
Greetings,
Rafael
---
arch/i386/kernel/alternative.c | 8 ++++++--
arch/i386/kernel/kprobes.c | 8 ++++++--
arch/x86_64/kernel/kprobes.c | 9 +++++++--
arch/x86_64/mm/init.c | 10 ++++++++++
4 files changed, 29 insertions(+), 6 deletions(-)
Index: linux-2.6.23-rc1/arch/i386/kernel/alternative.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/kernel/alternative.c
+++ linux-2.6.23-rc1/arch/i386/kernel/alternative.c
@@ -156,7 +156,7 @@ static void nop_out(void *insns, unsigne
unsigned int noplen = len;
if (noplen > ASM_NOP_MAX)
noplen = ASM_NOP_MAX;
- text_poke(insns, noptable[noplen], noplen);
+ memcpy(insns, noptable[noplen], noplen);
insns += noplen;
len -= noplen;
}
@@ -208,7 +208,7 @@ static void alternatives_smp_lock(u8 **s
continue;
if (*ptr > text_end)
continue;
- text_poke(*ptr, ((unsigned char []){0xf0}), 1); /* add lock prefix */
+ **ptr = 0xf0; /* lock prefix */
};
}
@@ -366,6 +366,10 @@ void apply_paravirt(struct paravirt_patc
/* Pad the rest with nops */
nop_out(p->instr + used, p->len - used);
}
+
+ /* Sync to be conservative, in case we patched following
+ * instructions */
+ sync_core();
}
extern struct paravirt_patch_site __start_parainstructions[],
__stop_parainstructions[];
Index: linux-2.6.23-rc1/arch/i386/kernel/kprobes.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/i386/kernel/kprobes.c
+++ linux-2.6.23-rc1/arch/i386/kernel/kprobes.c
@@ -170,12 +170,16 @@ int __kprobes arch_prepare_kprobe(struct
void __kprobes arch_arm_kprobe(struct kprobe *p)
{
- text_poke(p->addr, ((unsigned char []){BREAKPOINT_INSTRUCTION}), 1);
+ *p->addr = BREAKPOINT_INSTRUCTION;
+ flush_icache_range((unsigned long) p->addr,
+ (unsigned long) p->addr + sizeof(kprobe_opcode_t));
}
void __kprobes arch_disarm_kprobe(struct kprobe *p)
{
- text_poke(p->addr, &p->opcode, 1);
+ *p->addr = p->opcode;
+ flush_icache_range((unsigned long) p->addr,
+ (unsigned long) p->addr + sizeof(kprobe_opcode_t));
}
void __kprobes arch_remove_kprobe(struct kprobe *p)
Index: linux-2.6.23-rc1/arch/x86_64/kernel/kprobes.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/kernel/kprobes.c
+++ linux-2.6.23-rc1/arch/x86_64/kernel/kprobes.c
@@ -39,6 +39,7 @@
#include <linux/module.h>
#include <linux/kdebug.h>
+#include <asm/cacheflush.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/alternative.h>
@@ -209,12 +210,16 @@ static void __kprobes arch_copy_kprobe(s
void __kprobes arch_arm_kprobe(struct kprobe *p)
{
- text_poke(p->addr, ((unsigned char []){BREAKPOINT_INSTRUCTION}), 1);
+ *p->addr = BREAKPOINT_INSTRUCTION;
+ flush_icache_range((unsigned long) p->addr,
+ (unsigned long) p->addr + sizeof(kprobe_opcode_t));
}
void __kprobes arch_disarm_kprobe(struct kprobe *p)
{
- text_poke(p->addr, &p->opcode, 1);
+ *p->addr = p->opcode;
+ flush_icache_range((unsigned long) p->addr,
+ (unsigned long) p->addr + sizeof(kprobe_opcode_t));
}
void __kprobes arch_remove_kprobe(struct kprobe *p)
Index: linux-2.6.23-rc1/arch/x86_64/mm/init.c
===================================================================
--- linux-2.6.23-rc1.orig/arch/x86_64/mm/init.c
+++ linux-2.6.23-rc1/arch/x86_64/mm/init.c
@@ -600,6 +600,16 @@ void mark_rodata_ro(void)
{
unsigned long start = (unsigned long)_stext, end;
+#ifdef CONFIG_HOTPLUG_CPU
+ /* It must still be possible to apply SMP alternatives. */
+ if (num_possible_cpus() > 1)
+ start = (unsigned long)_etext;
+#endif
+
+#ifdef CONFIG_KPROBES
+ start = (unsigned long)__start_rodata;
+#endif
+
end = (unsigned long)__end_rodata;
start = (start + PAGE_SIZE - 1) & PAGE_MASK;
end &= PAGE_MASK;
next reply other threads:[~2007-07-26 12:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 12:40 Rafael J. Wysocki [this message]
2007-07-26 16:43 ` Linus Torvalds
2007-07-26 19:22 ` Rafael J. Wysocki
2007-07-26 19:59 ` Linus Torvalds
2007-07-31 1:23 ` Chris Wright
2007-07-31 1:50 ` Linus Torvalds
2007-07-31 2:16 ` Chris Wright
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=200707261440.50649.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=pavel@ucw.cz \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®