Skip to content

Commit

Permalink
x86, 64-bit: patch paravirt inline replacements when loading modules
Browse files Browse the repository at this point in the history
small speedup.

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

Signed-off-by: Anders Kaseorg <[email protected]>
Acked-by: "H. Peter Anvin" <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
andersk authored and Ingo Molnar committed Jun 30, 2008
1 parent 543cf4c commit 5e5a29b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/x86/kernel/module_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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) {
Expand All @@ -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);
}

Expand Down

0 comments on commit 5e5a29b

Please sign in to comment.