LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix kexec asm
@ 2006-03-08  2:35 Chris Mason
  2006-03-08  4:16 ` Eric W. Biederman
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Mason @ 2006-03-08  2:35 UTC (permalink / raw
  To: linux-kernel, akpm, mmlnx, Eric W. Biederman

From: Michael Matz <matz@suse.de>

While testing kexec and kdump we hit problems where the new kernel would
freeze or instantly reboot.  The easiest way to trigger it was to kexec a
kernel compiled for CONFIG_M586 on an athlon cpu.  Compiling
for CONFIG_MK7 instead would work fine.

The patch below fixes a few problems with the kexec inline asm.

Signed-off-by: Chris Mason <mason@suse.com>

---

diff -urp linux-2.6.15.suse/arch/i386/kernel/machine_kexec.c linux-2.6.15/arch/i386/kernel/machine_kexec.c
--- linux-2.6.15.suse/arch/i386/kernel/machine_kexec.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15/arch/i386/kernel/machine_kexec.c	2006-02-08 04:19:13.000000000 +0100
@@ -116,13 +116,13 @@ static void load_segments(void)
 	__asm__ __volatile__ (
 		"\tljmp $"STR(__KERNEL_CS)",$1f\n"
 		"\t1:\n"
-		"\tmovl $"STR(__KERNEL_DS)",%eax\n"
-		"\tmovl %eax,%ds\n"
-		"\tmovl %eax,%es\n"
-		"\tmovl %eax,%fs\n"
-		"\tmovl %eax,%gs\n"
-		"\tmovl %eax,%ss\n"
-		);
+		"\tmovl $"STR(__KERNEL_DS)",%%eax\n"
+		"\tmovl %%eax,%%ds\n"
+		"\tmovl %%eax,%%es\n"
+		"\tmovl %%eax,%%fs\n"
+		"\tmovl %%eax,%%gs\n"
+		"\tmovl %%eax,%%ss\n"
+		::: "eax", "memory");
 #undef STR
 #undef __STR
 }
diff -urp linux-2.6.15.suse/arch/x86_64/kernel/machine_kexec.c linux-2.6.15/arch/x86_64/kernel/machine_kexec.c
--- linux-2.6.15.suse/arch/x86_64/kernel/machine_kexec.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.15/arch/x86_64/kernel/machine_kexec.c	2006-02-08 04:21:13.000000000 +0100
@@ -140,7 +140,7 @@ static void load_segments(void)
 		"\tmovl %0,%%ss\n"
 		"\tmovl %0,%%fs\n"
 		"\tmovl %0,%%gs\n"
-		: : "a" (__KERNEL_DS)
+		: : "a" (__KERNEL_DS) : "memory"
 		);
 }
 
diff -urp linux-2.6.15.suse/include/asm-powerpc/kexec.h linux-2.6.15/include/asm-powerpc/kexec.h
--- linux-2.6.15.suse/include/asm-powerpc/kexec.h	2006-02-08 04:10:24.000000000 +0100
+++ linux-2.6.15/include/asm-powerpc/kexec.h	2006-02-08 04:31:15.000000000 +0100
@@ -93,7 +93,8 @@ static inline void crash_setup_regs(stru
 			"mfxer  %0\n"
 			"std    %0, 296(%2)\n"
 			: "=&r" (tmp1), "=&r" (tmp2)
-			: "b" (newregs));
+			: "b" (newregs)
+			: "memory");
 	}
 }
 #else

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix kexec asm
  2006-03-08  2:35 [PATCH] fix kexec asm Chris Mason
@ 2006-03-08  4:16 ` Eric W. Biederman
  2006-03-09  9:35   ` Pavel Machek
  0 siblings, 1 reply; 3+ messages in thread
From: Eric W. Biederman @ 2006-03-08  4:16 UTC (permalink / raw
  To: Chris Mason; +Cc: linux-kernel, akpm, mmlnx

Chris Mason <mason@suse.com> writes:

> From: Michael Matz <matz@suse.de>
>
> While testing kexec and kdump we hit problems where the new kernel would
> freeze or instantly reboot.  The easiest way to trigger it was to kexec a
> kernel compiled for CONFIG_M586 on an athlon cpu.  Compiling
> for CONFIG_MK7 instead would work fine.
>
> The patch below fixes a few problems with the kexec inline asm.

Thanks.  Specifying the stomp of %eax in load_segments is definitely
good.  The memory stomp looks excessive and if this was a fast path
I would worry about it.  As it is better safe than sorry.

Acked-By: Eric Biederman <ebiederm@xmission.com>

Eric

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix kexec asm
  2006-03-08  4:16 ` Eric W. Biederman
@ 2006-03-09  9:35   ` Pavel Machek
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2006-03-09  9:35 UTC (permalink / raw
  To: Eric W. Biederman; +Cc: Chris Mason, linux-kernel, akpm, mmlnx

On Út 07-03-06 21:16:34, Eric W. Biederman wrote:
> Chris Mason <mason@suse.com> writes:
> 
> > From: Michael Matz <matz@suse.de>
> >
> > While testing kexec and kdump we hit problems where the new kernel would
> > freeze or instantly reboot.  The easiest way to trigger it was to kexec a
> > kernel compiled for CONFIG_M586 on an athlon cpu.  Compiling
> > for CONFIG_MK7 instead would work fine.
> >
> > The patch below fixes a few problems with the kexec inline asm.
> 
> Thanks.  Specifying the stomp of %eax in load_segments is definitely
> good.  The memory stomp looks excessive and if this was a fast path
> I would worry about it.  As it is better safe than sorry.

Why excessive? It reloads %ss, AFAICS; at that point, all the stack
potentially changes from gcc's POV.
								Pavel
-- 
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-09  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08  2:35 [PATCH] fix kexec asm Chris Mason
2006-03-08  4:16 ` Eric W. Biederman
2006-03-09  9:35   ` Pavel Machek

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 read-only IMAP folder(s) and NNTP newsgroup(s).