virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Andi Kleen <ak@suse.de>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	Anthony Liguori <aliguori@us.ibm.com>
Subject: [PATCH] 2.6.21 - VMI logic error
Date: Thu, 12 Apr 2007 19:28:46 -0700	[thread overview]
Message-ID: <461EEADE.8060400@vmware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

So there is a logic error that would prevent us from ever using NOP 
relocations, thus stopping any unnecessary callouts into a VMI ROM.  It 
doesn't affect us so much, but could conceivably affect open source 
implementations of a VMI ROM in the future.  It is not absolutely 
critical, but it would be extremely nice to get it fixed in 2.6.21 so 
there are no broken older kernels floating around that mandate having a 
workaround for this or else breaking compatibility with these kernels.

Thanks,

Zach

[-- Attachment #2: vmi-logic-error.patch --]
[-- Type: text/plain, Size: 1255 bytes --]

Fix logic error in VMI relocation processing.  NOPs would always cause
a BUG_ON to fire because the != RELOCATION_NONE in the first if clause
precluding the == VMI_RELOCATION_NOP in the second clause.  Make these
direct equality tests and just warn for unsupported relocation types
(which should never happen), falling back to native in that case.

Thanks to Anthony Liguori for noting this!

Signed-off-by: Zachary Amsden <zach@vmware.com>

diff -r 99800d11a3ec arch/i386/kernel/vmi.c
--- a/arch/i386/kernel/vmi.c	Thu Apr 12 16:37:29 2007 -0700
+++ b/arch/i386/kernel/vmi.c	Thu Apr 12 19:00:46 2007 -0700
@@ -685,11 +685,14 @@ do {								\
 do {								\
 	reloc = call_vrom_long_func(vmi_rom, get_reloc,		\
 				    VMI_CALL_##vmicall);	\
-	if (rel->type != VMI_RELOCATION_NONE) {			\
-		BUG_ON(rel->type != VMI_RELOCATION_CALL_REL);	\
+	if (rel->type == VMI_RELOCATION_CALL_REL) 		\
 		paravirt_ops.opname = (void *)rel->eip;		\
-	} else if (rel->type == VMI_RELOCATION_NOP) 		\
+	else if (rel->type == VMI_RELOCATION_NOP) 		\
 		paravirt_ops.opname = (void *)vmi_nop;		\
+	else if (rel->type != VMI_RELOCATION_NONE)		\
+		printk(KERN_WARNING "VMI: Unknown relocation "	\
+				    "type %d for " #vmicall"\n",\
+					rel->type);		\
 } while (0)
 
 /*

[-- Attachment #3: Type: text/plain, Size: 189 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization

             reply	other threads:[~2007-04-13  2:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13  2:28 Zachary Amsden [this message]
2007-04-13 14:32 ` [PATCH] 2.6.21 - VMI logic error 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=461EEADE.8060400@vmware.com \
    --to=zach@vmware.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=aliguori@us.ibm.com \
    --cc=torvalds@osdl.org \
    --cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).