mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anders H Kaseorg <andersk@MIT.EDU>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] x86_64: Patch paravirt inline replacements when loading modules
Date: Sat, 28 Jun 2008 18:25:41 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.1.10.0806280431510.31023@vinegar-pot.mit.edu> (raw)

Paravirt replacements were added to the i386 module loader by commit
139ec7c416248b9ea227d21839235344edfee1e0.  This adds the same code to
the x86_64 module loader.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
  arch/x86/kernel/module_64.c |   10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/module_64.c b/arch/x86/kernel/module_64.c
index a888e67..0e86767 100644
--- a/arch/x86/kernel/module_64.c
+++ b/arch/x86/kernel/module_64.c
@@ -150,7 +150,8 @@ int module_finalize(const Elf_Ehdr *hdr,
                      const Elf_Shdr *sechdrs,
                      struct module *me)
  {
-	const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL;
+	const Elf_Shdr *s, *text = NULL, *alt = NULL, *locks = NULL,
+		*para = NULL;
  	char *secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;

  	for (s = sechdrs; s < sechdrs + hdr->e_shnum; s++) {
@@ -160,6 +161,8 @@ int module_finalize(const Elf_Ehdr *hdr,
  			alt = s;
  		if (!strcmp(".smp_locks", secstrings + s->sh_name))
  			locks= s;
+		if (!strcmp(".parainstructions", secstrings + s->sh_name))
+			para = s;
  	}

  	if (alt) {
@@ -175,6 +178,11 @@ int module_finalize(const Elf_Ehdr *hdr,
  					    tseg, tseg + text->sh_size);
  	}

+	if (para) {
+		void *pseg = (void *)para->sh_addr;
+		apply_paravirt(pseg, pseg + para->sh_size);
+	}
+
  	return module_bug_finalize(hdr, sechdrs, me);
  }

-- 
1.5.4.3


             reply	other threads:[~2008-06-28 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-28 22:25 Anders H Kaseorg [this message]
2008-06-28 22:31 ` H. Peter Anvin
2008-06-28 22:45   ` Anders H Kaseorg
2008-06-28 23:15     ` H. Peter Anvin
2008-06-30 10:15       ` Ingo Molnar

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=alpine.DEB.1.10.0806280431510.31023@vinegar-pot.mit.edu \
    --to=andersk@mit.edu \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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®