virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Zachary Amsden <zach@vmware.com>
To: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@muc.de>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Chris Wright <chrisw@sous-sol.org>, Ingo Molnar <mingo@elte.hu>,
	Petr Vandrovec <petr@vmware.com>,
	Pratap Subrahmanyam <pratap@vmware.com>,
	Dan Hecht <dhecht@vmware.com>, Dan Arai <arai@vmware.com>,
	Virtualization Mailing List <virtualization@lists.osdl.org>,
	Chaz Masden <zamsden@gmail.com>, Zachary Amsden <zach@vmware.com>
Subject: [RFC, PATCH 2/5] Paravirt_ops patch bugs.patch
Date: Thu, 19 Apr 2007 18:52:34 -0700 (PDT)	[thread overview]
Message-ID: <20070420015234.5D42EBFC@zach-dev2.vmware.com> (raw)

Failing to patch because not enough space is available for a call or jump
or because the site clobbers do not allow the target clobbers to fit is
a fatal error; it means the kernel can not be properly virtualized.

In patch_insns, we just keep a warning instead; it may not be fatal, as
they paravirt-ops backend may just be trying to insert a greedy but not
necessary inline function.

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

diff -r fcb59055d2b2 arch/i386/kernel/paravirt.c
--- a/arch/i386/kernel/paravirt.c	Thu Apr 19 12:36:06 2007 -0700
+++ b/arch/i386/kernel/paravirt.c	Thu Apr 19 15:42:02 2007 -0700
@@ -132,10 +140,8 @@ unsigned paravirt_patch_call(void *targe
 	unsigned char *call = site;
 	unsigned long delta = (unsigned long)target - (unsigned long)(call+5);
 
-	if (tgt_clobbers & ~site_clobbers)
-		return len;	/* target would clobber too much for this site */
-	if (len < 5)
-		return len;	/* call too long for patch site */
+	BUG_ON(tgt_clobbers & ~site_clobbers);
+	BUG_ON(len < 5);
 
 	*call++ = 0xe8;		/* call */
 	*(unsigned long *)call = delta;
@@ -148,8 +154,7 @@ unsigned paravirt_patch_jmp(void *target
 	unsigned char *jmp = site;
 	unsigned long delta = (unsigned long)target - (unsigned long)(jmp+5);
 
-	if (len < 5)
-		return len;	/* call too long for patch site */
+	BUG_ON(len < 5);
 
 	*jmp++ = 0xe9;		/* jmp */
 	*(unsigned long *)jmp = delta;
@@ -186,7 +191,10 @@ unsigned paravirt_patch_insns(void *site
 {
 	unsigned insn_len = end - start;
 
-	if (insn_len > len || start == NULL)
+	WARN_ON(insn_len > len);
+	BUG_ON(start == NULL);
+
+	if (insn_len > len)
 		insn_len = len;
 	else
 		memcpy(site, start, insn_len);

             reply	other threads:[~2007-04-20  1:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-20  1:52 Zachary Amsden [this message]
2007-04-20  4:39 ` [RFC, PATCH 2/5] Paravirt_ops patch bugs.patch Jeremy Fitzhardinge
2007-04-20  5:09   ` Zachary Amsden
2007-04-20  5:19     ` Jeremy Fitzhardinge
2007-04-20  5:28       ` Zachary Amsden

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=20070420015234.5D42EBFC@zach-dev2.vmware.com \
    --to=zach@vmware.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=arai@vmware.com \
    --cc=chrisw@sous-sol.org \
    --cc=dhecht@vmware.com \
    --cc=jeremy@goop.org \
    --cc=mingo@elte.hu \
    --cc=petr@vmware.com \
    --cc=pratap@vmware.com \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.osdl.org \
    --cc=zamsden@gmail.com \
    /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).