From: Glauber de Oliveira Costa <gcosta@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, rusty@rustcorp.com.au, ak@suse.de,
mingo@elte.hu, chrisw@sous-sol.org, jeremy@goop.org,
avi@qumranet.com, anthony@codemonkey.ws,
virtualization@lists.linux-foundation.org, lguest@ozlabs.org,
glommer@gmail.com, Glauber de Oliveira Costa <gcosta@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH 25/25 -v2] add paravirtualization support for x86_64
Date: Fri, 10 Aug 2007 16:12:37 -0300 [thread overview]
Message-ID: <11867732811935-git-send-email-gcosta@redhat.com> (raw)
In-Reply-To: <11867732763070-git-send-email-gcosta@redhat.com>
This is finally, the patch we were all looking for. This
patch adds a paravirt.h header with the definition of paravirt_ops
struct. Also, it defines a bunch of inline functions that will
replace, or hook, the other calls. Every one of those functions
adds an entry in the parainstructions section (see vmlinux.lds.S).
Those entries can then be used to runtime-patch the paravirt_ops
functions.
paravirt.c contains implementations of paravirt functions that
are used natively, such as the native_patch. It also fill the
paravirt_ops structure with the whole lot of functions that
were (re)defined throughout this patch set.
There are also changes in asm-offsets.c. paravirt.h needs it
to find out the offsets into the structure of functions
such as irq_enable, used in assembly files.
[ updates from v1
* make PARAVIRT hidden in Kconfig (Andi Kleen)
* cleanups in paravirt.h (Andi Kleen)
* modifications needed to accomodate other parts of the
patch that changed, such as getting rid of ebda_info
* put the integers at struct paravirt_ops at the end
(Jeremy)
]
Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
arch/x86_64/Kconfig | 11 +++++++++++
arch/x86_64/kernel/Makefile | 1 +
arch/x86_64/kernel/asm-offsets.c | 14 ++++++++++++++
arch/x86_64/kernel/vmlinux.lds.S | 6 ++++++
include/asm-x86_64/smp.h | 2 +-
5 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index ffa0364..00b2fc9 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -373,6 +373,17 @@ config NODES_SHIFT
# Dummy CONFIG option to select ACPI_NUMA from drivers/acpi/Kconfig.
+config PARAVIRT
+ bool
+ depends on EXPERIMENTAL
+ help
+ Paravirtualization is a way of running multiple instances of
+ Linux on the same machine, under a hypervisor. This option
+ changes the kernel so it can modify itself when it is run
+ under a hypervisor, improving performance significantly.
+ However, when run without a hypervisor the kernel is
+ theoretically slower. If in doubt, say N.
+
config X86_64_ACPI_NUMA
bool "ACPI NUMA detection"
depends on NUMA
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index ff5d8c9..120467f 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_X86_VSMP) += vsmp.o
obj-$(CONFIG_K8_NB) += k8.o
obj-$(CONFIG_AUDIT) += audit.o
+obj-$(CONFIG_PARAVIRT) += paravirt.o
obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_PCI) += early-quirks.o
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
index 778953b..f5eff70 100644
--- a/arch/x86_64/kernel/asm-offsets.c
+++ b/arch/x86_64/kernel/asm-offsets.c
@@ -15,6 +15,9 @@
#include <asm/segment.h>
#include <asm/thread_info.h>
#include <asm/ia32.h>
+#ifdef CONFIG_PARAVIRT
+#include <asm/paravirt.h>
+#endif
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -72,6 +75,17 @@ int main(void)
offsetof (struct rt_sigframe32, uc.uc_mcontext));
BLANK();
#endif
+#ifdef CONFIG_PARAVIRT
+#define ENTRY(entry) DEFINE(PARAVIRT_ ## entry, offsetof(struct paravirt_ops, entry))
+ ENTRY(paravirt_enabled);
+ ENTRY(irq_disable);
+ ENTRY(irq_enable);
+ ENTRY(syscall_return);
+ ENTRY(iret);
+ ENTRY(read_cr2);
+ ENTRY(swapgs);
+ BLANK();
+#endif
DEFINE(pbe_address, offsetof(struct pbe, address));
DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
DEFINE(pbe_next, offsetof(struct pbe, next));
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index ba8ea97..c3fce85 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -185,6 +185,12 @@ SECTIONS
.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
*(.altinstr_replacement)
}
+ . = ALIGN(8);
+ .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
+ __parainstructions = .;
+ *(.parainstructions)
+ __parainstructions_end = .;
+ }
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index 6b11114..403901b 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -22,7 +22,7 @@ extern int disable_apic;
#ifdef CONFIG_PARAVIRT
#include <asm/paravirt.h>
void native_flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
- unsigned long va);
+ unsigned long va);
#else
#define startup_ipi_hook(apicid, rip, rsp) do { } while (0)
#endif
--
1.4.4.2
prev parent reply other threads:[~2007-08-10 22:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-10 19:12 [PATCH 0/25 -v2] paravirt_ops for x86_64, second round Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 1/25 -v2] header file move Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 2/25 -v2] tlb flushing routines Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 3/25 -v2] irq_flags / halt routines Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 4/25 -v2] Add debugreg/load_rsp native hooks Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 5/25 -v2] native versions for system.h functions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 6/25 -v2] add native_apic read and write functions, as well as boot clocks ones Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 7/25 -v2] interrupt related native paravirt functions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 8/25 -v2] use macro for sti/cli in spinlock definitions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 9/25 -v2] report ring kernel is running without paravirt Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 10/25 -v2] export math_state_restore Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 11/25 -v2] native versions for set pagetables Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 12/25 -v2] turn msr.h functions into native versions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 13/25 -v2] add native functions for descriptors handling Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 14/25 -v2] get rid of inline asm for load_cr3 Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 15/25 -v2] introducing paravirt_activate_mm Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 16/25 -v2] turn page operations into native versions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 17/25 -v2] introduce paravirt_release_pgd() Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 18/25 -v2] turn priviled operations into macros in entry.S Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 19/25 -v2] time-related functions paravirt provisions Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 20/25 -v2] replace syscall_init Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 21/25 -v2] export cpu_gdt_descr Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 22/25 -v2] turn priviled operation into a macro Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 23/25 -v2] provide paravirt patching function Glauber de Oliveira Costa
2007-08-10 19:12 ` [PATCH 24/25 -v2] paravirt hooks for arch initialization Glauber de Oliveira Costa
2007-08-10 19:12 ` Glauber de Oliveira Costa [this message]
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=11867732811935-git-send-email-gcosta@redhat.com \
--to=gcosta@redhat.com \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=anthony@codemonkey.ws \
--cc=avi@qumranet.com \
--cc=chrisw@sous-sol.org \
--cc=glommer@gmail.com \
--cc=jeremy@goop.org \
--cc=lguest@ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox