All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sanders <linux@sandersweb.net>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Jan Beulich <jbeulich@novell.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andi Kleen <andi-suse@firstfloor.org>
Subject: Re: [BUG] x86 kenel won't boot under Virtual PC
Date: Fri, 5 Sep 2008 11:38:19 -0400	[thread overview]
Message-ID: <200809051138.20615.linux@sandersweb.net> (raw)
In-Reply-To: <alpine.LFD.1.10.0808311237290.12958@nehalem.linux-foundation.org>

On Sun, 31 Aug 2008, David Sanders wrote:
> I recently discovered that x86 kernels won't boot under Virtual PC.On Sun, 
31 Aug 2008, David Sanders wrote:

On Sunday 31 August 2008 15:39, Linus Torvalds wrote:
> Well, it could be that Virtual PC raises a #UD exception in the virtual
> machine. In user space, that would just cause the kernel to kill the poor
> innocent victim. But when the kernel gets a #UD exception on what it
> expects to be a nop, it just won't work.

Sorry about the confusion. I was just learning git and applied a couple 
patches wrong that lead me to believe I had not found the answer, when in 
fact I had.  The problem is the multibyte NOP instructions introduced into 
the kernel in 2007.  For 2.6.24-rc1 reverting the patch (32c464f5) corrects 
the problem.  But then of course we cannot use these instructions as we would 
like.  I propose the following patch which adds a boot-time parameter to not 
use these multibyte NOPs in systems that are unprepared to deal with them.  
The patch disables a optimization used in one place by commenting out some 
lines in nop.h.  Please comment.

    x86: Fix to multibyte NOPs breaking Virtual PC (win)

    To be applied to linux-2.6.27-rc5.

    Signed-off-by: David Sanders <linux@sandersweb.net>

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 2763cb3..6a63e78 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -58,6 +58,15 @@ static int __init setup_noreplace_paravirt(char *str)
 __setup("noreplace-paravirt", setup_noreplace_paravirt);
 #endif
 
+static int intel_legacy_nops = 0;
+
+static int __init setup_intel_legacy_nops(char *str)
+{
+	intel_legacy_nops = 1;
+	return 1;
+}
+__setup("intel-legacy-nops", setup_intel_legacy_nops);
+
 #define DPRINTK(fmt, args...) if (debug_alternative) \
 	printk(KERN_DEBUG fmt, args)
 
@@ -165,13 +174,14 @@ static const struct nop {
 const unsigned char *const *find_nop_table(void)
 {
 	const unsigned char *const *noptable = intel_nops;
-	int i;
+	int i = 0;
 
-	for (i = 0; noptypes[i].cpuid >= 0; i++) {
+	while (noptypes[i].cpuid >= 0 && !intel_legacy_nops) {
 		if (boot_cpu_has(noptypes[i].cpuid)) {
 			noptable = noptypes[i].noptable;
 			break;
 		}
+		i++;
 	}
 	return noptable;
 }
diff --git a/include/asm-x86/nops.h b/include/asm-x86/nops.h
index ad0bedd..a6f0571 100644
--- a/include/asm-x86/nops.h
+++ b/include/asm-x86/nops.h
@@ -84,7 +84,7 @@
 #define ASM_NOP6 K7_NOP6
 #define ASM_NOP7 K7_NOP7
 #define ASM_NOP8 K7_NOP8
-#elif defined(CONFIG_X86_P6_NOP)
+/* #elif defined(CONFIG_X86_P6_NOP)
 #define ASM_NOP1 P6_NOP1
 #define ASM_NOP2 P6_NOP2
 #define ASM_NOP3 P6_NOP3
@@ -93,6 +93,7 @@
 #define ASM_NOP6 P6_NOP6
 #define ASM_NOP7 P6_NOP7
 #define ASM_NOP8 P6_NOP8
+*/
 #elif defined(CONFIG_X86_64)
 #define ASM_NOP1 K8_NOP1
 #define ASM_NOP2 K8_NOP2

  reply	other threads:[~2008-09-05 15:38 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-31 18:22 [BUG] x86 kenel won't boot under Virtual PC David Sanders
2008-08-31 18:47 ` Linus Torvalds
2008-08-31 19:27   ` Arjan van de Ven
2008-08-31 19:39     ` Linus Torvalds
2008-09-05 15:38       ` David Sanders [this message]
2008-09-05 16:15         ` Jan Beulich
2008-09-05 16:39           ` Linus Torvalds
2008-09-05 18:43             ` Ingo Molnar
2008-09-05 20:06               ` H. Peter Anvin
2008-09-05 19:08             ` Jeremy Fitzhardinge
2008-09-05 20:12           ` H. Peter Anvin
2008-09-05 16:30         ` Linus Torvalds
2008-09-05 17:55           ` Andi Kleen
2008-08-31 20:03   ` David Sanders
2008-09-01 20:23     ` David Sanders
2008-09-01 22:22       ` Linus Torvalds
2008-09-02 12:08         ` David Sanders
2008-09-02 18:12           ` Linus Torvalds
2008-09-02 18:44             ` David Sanders
2008-09-03 11:09               ` Peter Zijlstra
2008-09-03 11:20                 ` David Sanders
     [not found] ` <48C1C156.9080003@zytor.com>
2008-09-07 20:07   ` David Sanders
2008-09-07 23:22     ` David Sanders
2008-09-08  1:48       ` H. Peter Anvin
2008-09-08  2:49         ` David Sanders
2008-09-08  4:04           ` H. Peter Anvin
2008-09-08  9:42             ` Andi Kleen
2008-09-08 13:25             ` David Sanders
2008-09-08 15:09             ` Linus Torvalds
2008-09-08 15:23               ` Ingo Molnar
2008-09-08 15:36                 ` H. Peter Anvin
2008-09-08 15:38                 ` David Sanders
2008-09-08 15:38                 ` H. Peter Anvin
2008-09-08 15:45               ` Andi Kleen
2008-09-08 15:43                 ` H. Peter Anvin
2008-09-08 15:50                   ` H. Peter Anvin
2008-09-08 15:50                   ` Andi Kleen
2008-09-08 15:50                     ` H. Peter Anvin
2008-09-08 15:57                       ` Andi Kleen
2008-09-08 15:54                         ` H. Peter Anvin
2008-09-08 16:07                   ` Linus Torvalds
2008-09-08 16:13                     ` H. Peter Anvin
2008-09-08 16:15                       ` H. Peter Anvin
2008-09-08 16:26                         ` David Sanders
2008-09-08 16:20                       ` Linus Torvalds
2008-09-08 16:32                         ` H. Peter Anvin
2008-09-08 17:02                           ` Ingo Molnar
2008-09-08 16:34                         ` david
2008-09-08 16:42                           ` H. Peter Anvin
2008-09-08 18:51                             ` david
2008-09-08 16:59                           ` Linus Torvalds
2008-09-08 17:00                         ` Andi Kleen
2008-09-08 17:04                           ` Linus Torvalds
2008-09-08 17:08                             ` H. Peter Anvin
2008-09-08 17:12                               ` H. Peter Anvin
2008-09-08 17:41                                 ` Linus Torvalds
2008-09-08 17:38                               ` Linus Torvalds
2008-09-08 17:59                                 ` H. Peter Anvin
2008-09-08 19:09                                 ` H. Peter Anvin
2008-09-08 22:42                                   ` Linus Torvalds
2008-09-08 17:18                             ` Andi Kleen

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=200809051138.20615.linux@sandersweb.net \
    --to=linux@sandersweb.net \
    --cc=andi-suse@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.