[PATCH] kvm: fix MSR_COUNT for kvm_arch_save_regs()

2009-10-14 Thread Eduardo Habkost
) MSR_IA32_SYSENTER_ESP 3) MSR_IA32_SYSENTER_EIP 4) MSR_STAR 5) MSR_IA32_TSC 6) MSR_VM_HSAVE_PA 7) MSR_CSTAR (x86_64 only) 8) MSR_KERNELGSBASE (x86_64 only) 9) MSR_FMASK (x86_64 only) 10) MSR_LSTAR (x86_64 only) Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- qemu-kvm-x86.c |6 -- 1 files

[PATCH 3/3] kvm: svm: init_vmcb(): remove redundant save-cr0 initialization

2009-10-23 Thread Eduardo Habkost
The svm_set_cr0() call will initialize save-cr0 properly even when npt is enabled, clearing the NW and CD bits as expected, so we don't need to initialize it manually for npt_enabled anymore. Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- arch/x86/kvm/svm.c |2 -- 1 files changed, 0

[PATCH 2/3] kvm: svm: reset cr0 properly on vcpu reset

2009-10-23 Thread Eduardo Habkost
svm_set_cr0() directly to make sure kvm_mmu_reset_context() is called to reset the mmu to nonpaging mode. Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- arch/x86/kvm/svm.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c

[PATCH 0/3] kvm: fix cr0 initialization on SIPI reset

2009-10-23 Thread Eduardo Habkost
Hi, The following patches fix a bug on the SIPI reset code for SVM. cr0 was not being reset properly, making KVM keep the vcpu on paging mode, thus not being able to run the real-mode boostrap code. This bug was reported at: https://bugzilla.redhat.com/show_bug.cgi?id=525699 The first patch is

[PATCH 1/3] kvm: vmx: use macros instead of hex value on cr0 initialization

2009-10-23 Thread Eduardo Habkost
This should have no effect, it is just to make the code clearer. Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- arch/x86/kvm/vmx.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 364263a..42409cc 100644 --- a/arch

[PATCH] Use .fixup instead of .text.fixup on __kvm_handle_fault_on_reboot

2008-08-19 Thread Eduardo Habkost
. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- include/asm-x86/kvm_host.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 1e28880..982b6b2 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86

Re: [Qemu-devel] Re: [PATCH] Make page_find() return 0 for too-large addresses

2008-09-12 Thread Eduardo Habkost
On Fri, Sep 12, 2008 at 05:14:06PM -0300, Eduardo Habkost wrote: On Fri, Sep 12, 2008 at 02:50:33PM -0500, Anthony Liguori wrote: Eduardo Habkost wrote: On some cases, such as under KVM, tb_invalidate_phys_page_range() may be called for large addresses, when qemu is configured to more than

Re: [Qemu-devel] Re: [PATCH] Make page_find() return 0 for too-large addresses

2008-09-12 Thread Eduardo Habkost
On Fri, Sep 12, 2008 at 04:27:30PM -0500, Anthony Liguori wrote: Eduardo Habkost wrote: On Fri, Sep 12, 2008 at 05:14:06PM -0300, Eduardo Habkost wrote: On Fri, Sep 12, 2008 at 02:50:33PM -0500, Anthony Liguori wrote: Eduardo Habkost wrote: On some cases, such as under KVM

Re: [Qemu-devel] Re: [PATCH] Make page_find() return 0 for too-large addresses

2008-09-15 Thread Eduardo Habkost
On Mon, Sep 15, 2008 at 10:29:14AM -0500, Anthony Liguori wrote: Eduardo Habkost wrote: snip New patch, reusing the range check from page_find_alloc() on page_find(). Untested. Have you tested this patch yet? I like to avoid being the first one to test something when it's not my code

[PATCH 4/4] Add --with-kvm-trace arg to configure

2008-09-22 Thread Eduardo Habkost
./configure --with-kvm-trace will set a CONFIG_KVM_TRACE option on a kernel/config.kbuild file. This file can be included from the Kbuild files to get kvm-specific CONFIG_* definitions. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- .gitignore|1 + configure | 11

[PATCH 3/4] relay_open() compat

2008-09-22 Thread Eduardo Habkost
On 2.6.21 a new parameter was added to relay_open(). Handle this parameter on kvm_relay_open() if needed. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- kernel/external-module-compat-comm.h | 19 +++ kernel/external-module-compat.c | 22

[PATCH 0/4] Allow enabling kvm_trace on external module

2008-09-22 Thread Eduardo Habkost
This series adds compat code to allow enabling kvm_trace when building KVM as an external module on older kernels. The most hackish part is the last patch, that adds --with-kvm-trace to configure and adds an include to a generated file on kernel/x86/Kbuild. It doesn't look pretty, so suggestions

[PATCH 2/4] Hack DEFINE_SIMPLE_ATTRIBUTE for lost_records_get() also

2008-09-22 Thread Eduardo Habkost
Change the DEFINE_SIMPLE_ATTRIBUTE pattern to match the lost_records_get() definition also, so kvm_trace can compile on older kernels. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- kernel/x86/hack-module.awk |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 0/4] Allow enabling kvm_trace on external module

2008-09-24 Thread Eduardo Habkost
On Wed, Sep 24, 2008 at 04:48:35PM +0300, Avi Kivity wrote: Eduardo Habkost wrote: This series adds compat code to allow enabling kvm_trace when building KVM as an external module on older kernels. The most hackish part is the last patch, that adds --with-kvm-trace to configure and adds

[PATCH 2/2] kvm: disable virtualization when halting CPUs on crash

2008-10-20 Thread Eduardo Habkost
Use the emergency_halt_notifier interface to disable virtualization on all the CPUs on machine_crash_shutdown(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/x86.c | 22 +- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86

[PATCH 0/2] kvmtrace: Allow user to clean up stale trace setup

2008-10-22 Thread Eduardo Habkost
If kvmtrace crashes or gets killed while collecting trace data, stale trace setup information may be enabled on the kernel, and currently there is no way to force the previous trace setup to be overwritten or disabled. The following two patches against kvm-userspace will add a new command-line

[PATCH 1/2] Extract disable_trace() from cleanup_trace()

2008-10-22 Thread Eduardo Habkost
Extract the KVM_TRACE_DISABLE ioctl() call from cleanup_trace(), as other parts of the code will use it. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- user/kvmtrace.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/user/kvmtrace.c b/user/kvmtrace.c index

Re: [PATCH 0/2] kvmtrace: Allow user to clean up stale trace setup

2008-10-22 Thread Eduardo Habkost
On Wed, Oct 22, 2008 at 03:42:27PM -0200, Glauber Costa wrote: On Wed, Oct 22, 2008 at 3:35 PM, Eduardo Habkost [EMAIL PROTECTED] wrote: If kvmtrace crashes or gets killed while collecting trace data, stale trace setup information may be enabled on the kernel, and currently there is no way

[PATCH 2/2] kvmtrace: Add -f option to clean up existing trace setup

2008-10-22 Thread Eduardo Habkost
enabling trace, on those cases. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- user/kvmtrace.c | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/user/kvmtrace.c b/user/kvmtrace.c index 5d154c1..f06574f 100644 --- a/user/kvmtrace.c +++ b/user/kvmtrace.c @@ -54,7

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-23 Thread Eduardo Habkost
On Thu, Oct 23, 2008 at 10:28:24AM +1100, Simon Horman wrote: On Mon, Oct 20, 2008 at 01:01:32PM -0200, Eduardo Habkost wrote: The following two patches should make kdump work when the kvm-intel module is loaded. We need to disable vmx mode before booting the kdump kernel, so I've

[PATCH] kvm: external module: test for EXT_CONFIG_KVM_TRACE instead of CONFIG_KVM_TRACE

2008-10-24 Thread Eduardo Habkost
was not changed to the new name, making the build system try to compile kvm_trace.c without -DEXT_CONFIG_KVM_TRACE=y, if building using --with-kvm-trace. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- kernel/Makefile |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/Makefile

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-26 Thread Eduardo Habkost
On Sun, Oct 26, 2008 at 05:07:45PM +0200, Avi Kivity wrote: Eric W. Biederman wrote: snip Is it possible to disable vmx mode before we enable interrrupts in the kdump kernel? You need IPIs to disable vmx on smp. Thank you. Reading your description and taking a quick look at

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-27 Thread Eduardo Habkost
On Mon, Oct 27, 2008 at 11:13:41AM +0200, Avi Kivity wrote: Eric W. Biederman wrote: NMI IPIs are already used on x86 native_machine_crash_shutdown(), so it wouldn't get more messy that it is currently. We just need to add another bit of code to the code that already runs on an NMI handler.

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-27 Thread Eduardo Habkost
On Mon, Oct 27, 2008 at 08:02:31AM -0700, Eric W. Biederman wrote: Avi Kivity [EMAIL PROTECTED] writes: Eric W. Biederman wrote: We've observed on some machines that keyboard controller reset didn't work, and that the fallback to triple-fault asserted INIT and not RESET (and that

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-28 Thread Eduardo Habkost
On Mon, Oct 27, 2008 at 10:32:43AM -0700, Eric W. Biederman wrote: Avi Kivity [EMAIL PROTECTED] writes: snip I wouldn't mind notifiers (with a nice comment explaining that you must know what you're doing, though that's the case with most kernel APIs). I'm fine with either approach.

Re: [PATCH 0/2] kvm: disable virtualization on kdump

2008-10-29 Thread Eduardo Habkost
On Mon, Oct 27, 2008 at 09:09:37AM -0400, Vivek Goyal wrote: On Mon, Oct 27, 2008 at 10:54:01AM +0200, Avi Kivity wrote: snip The hang was likely caused by vmx blocking INIT. Sigh. Avi, We boot kdump kernel with maxcpus=1. IIUC, in that code path we will not be using INIT. So did you

[PATCH 4/6] kvm: vmx: crash_hardware_disable function

2008-10-30 Thread Eduardo Habkost
We need to first check if virtualization was enabled. We do this by checking CR4.VMXE. If it is set, run vmxoff and clear CR4.VMXE. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/vmx.c | 16 ++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git

[PATCH 2/6] kvm_x86_ops: crash_hardware_disable() operation

2008-10-30 Thread Eduardo Habkost
The vmx hardware_disable() function does too much for the virt_disable crash handler, so we will have a new operation for the crash-time virt_disable case. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/kvm_host.h |1 + 1 files changed, 1 insertions(+), 0 deletions

[PATCH 0/6] kdump: disable virtualization extensions on crash (v2)

2008-10-30 Thread Eduardo Habkost
Hi, After some discussion, this is my second try to fix properly the kdump hang when the kvm-intel module is loaded. I've kept the virtualization code inside the KVM, and just used a function pointer that can be registered by KVM to be called at crash time. This series is for one of the

[PATCH 6/6] kvm: x86: set kdump virt_disable function on initialization

2008-10-30 Thread Eduardo Habkost
Finally implement the virt_disable function for kdump. It will call kvm_x86_ops-crash_hardware_disable(), that will disable virtualization extensions on the CPU if it is not disabled yet. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/x86.c | 19 ++- 1 files

[PATCH 1/6] kdump: crash-time virt disable function

2008-10-30 Thread Eduardo Habkost
. The crash shutdown code use NMIs to tell the other CPUs to be halted, so the notifier call is hooked into the CPU halting code that is on the crash shutdown NMI handler. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 24 + arch/x86/kernel

[PATCH 5/6] kvmx: x86: set kvm_x86_ops earlier on kvm_arch_init()

2008-10-30 Thread Eduardo Habkost
Small change that will be needed when we use set_virt_disable_func() on kvm_arch_init(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/x86.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 38f79b6

Re: [PATCH 1/6] kdump: crash-time virt disable function

2008-10-30 Thread Eduardo Habkost
On Thu, Oct 30, 2008 at 03:50:31PM +0200, Avi Kivity wrote: snip +static void (*virt_disable_fn)(unsigned int cpu); Since you never use the cpu argument, I suggest dropping it. It is a leftover from when I was using cpus_hardware_enabled to check if vmx was enabled, before I've noticed I

[PATCH 11/16] kvm_x86_ops: crash_hardware_disable() operation

2008-11-04 Thread Eduardo Habkost
The vmx hardware_disable() function does too much for the virt_disable crash handler, so we will have a new operation for the crash-time virt_disable case. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/kvm_host.h |1 + 1 files changed, 1 insertions(+), 0 deletions

[PATCH 10/16] x86: disable virtualization on all CPUs if needed, on emergency_restart

2008-11-04 Thread Eduardo Habkost
-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 48 - 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 80d5e9c..932763f 100644 --- a/arch/x86/kernel

[PATCH 01/16] x86 kdump: Extract kdump-specific code from crash_nmi_callback()

2008-11-04 Thread Eduardo Habkost
The NMI CPU-halting code will be used on non-kdump cases, also (e.g. emergency_reboot when virtualization is enabled). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 31 --- 1 files changed, 20 insertions(+), 11 deletions(-) diff

[PATCH 06/16] x86: Move nmi_shootdown_cpus() to reboot.c

2008-11-04 Thread Eduardo Habkost
Now nmi_shootdown_cpus() is ready to be used by non-kdump code also. Move it to reboot.c. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 73 -- arch/x86/kernel/reboot.c | 79

[PATCH 03/16] x86 kdump: Create kdump_nmi_shootdown_cpus()

2008-11-04 Thread Eduardo Habkost
For the kdump-specific code that was living on nmi_shootdown_cpus(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 0e77fe9

[PATCH 16/16] Revert x86: default to reboot via ACPI

2008-11-04 Thread Eduardo Habkost
This reverts commit c7ffa6c26277b403920e2255d10df849bd613380. Now that we have the hooks to disable virtualization on emergency_restart(), we can get back to the BOOT_KBD reboot_type default. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c |6 +- 1 files

[PATCH 09/16] kdump: Hook emergency_virt_disable() on crash shutdown code

2008-11-04 Thread Eduardo Habkost
Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index d84a852..87780ba 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c

[PATCH 08/16] x86: Emergency virtualization disable function

2008-11-04 Thread Eduardo Habkost
] [v3: make emergency_virt_disable() non-static] [v4: add a config option for it: CPU_VIRT_EXTENSIONS] [v5: add has_virt_extensions() function] [v6: don't define the registering functions if CPU_VIRT_EXTENSIONS is not enabled] Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm

[PATCH 15/16] kvm: x86: set kdump virt_disable function on initialization

2008-11-04 Thread Eduardo Habkost
Finally implement the virt_disable function for kdump. It will call kvm_x86_ops-crash_hardware_disable(), that will disable virtualization extensions on the CPU if it is not disabled yet. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/x86.c | 19 ++- 1 files

[PATCH 07/16] x86: Make nmi_shootdown_cpus() available on !SMP and !X86_LOCAL_APIC

2008-11-04 Thread Eduardo Habkost
The X86_LOCAL_APIC #ifdef was for kdump. For !SMP, the function simply does nothing. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 12/16] kvm: svm: set crash_hardware_disable to svm_hardware_disable

2008-11-04 Thread Eduardo Habkost
We can use it as is, as it is a simple function. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/svm.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index f0ad4d4..6b3a660 100644 --- a/arch/x86/kvm/svm.c +++ b

[PATCH 14/16] kvmx: x86: set kvm_x86_ops earlier on kvm_arch_init()

2008-11-04 Thread Eduardo Habkost
Small change that will be needed when we use set_virt_disable_func() on kvm_arch_init(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/x86.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9a4a39c

[PATCH 04/16] x86 kdump: Make kdump_nmi_callback() a function ptr on crash_nmi_callback()

2008-11-04 Thread Eduardo Habkost
The reboot code will use a different function on crash_nmi_callback(). Adding a function pointer parameter to nmi_shootdown_cpus() for that. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff

[PATCH 05/16] x86 kdump: Make nmi_shootdown_cpus() non-static

2008-11-04 Thread Eduardo Habkost
Add prototype to asm/reboot.h. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/reboot.h |5 + arch/x86/kernel/crash.c |3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h

[PATCH 02/16] x86 kdump: Move crashing_cpu assignment to nmi_shootdown_cpus()

2008-11-04 Thread Eduardo Habkost
This variable will be moved to non-kdump-specific code. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index e8c58aa..0e77fe9 100644

[PATCH 13/16] kvm: vmx: crash_hardware_disable function

2008-11-04 Thread Eduardo Habkost
We need to first check if virtualization was enabled. We do this by checking CR4.VMXE. If it is set, run vmxoff and clear CR4.VMXE. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/vmx.c | 16 ++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 07/16] x86: Make nmi_shootdown_cpus() available on !SMP and !X86_LOCAL_APIC

2008-11-04 Thread Eduardo Habkost
On Tue, Nov 04, 2008 at 12:52:35PM -0200, Eduardo Habkost wrote: The X86_LOCAL_APIC #ifdef was for kdump. For !SMP, the function simply does nothing. The bit below is also needed. It can be added to the series right before patch 07/16. After getting some review, I will resubmit the series

Re: [PATCH 00/14] x86: disable virt on kdump and emergency_restart

2008-11-05 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 09:44:12AM -0500, Vivek Goyal wrote: On Tue, Nov 04, 2008 at 06:54:04PM +0200, Avi Kivity wrote: Eduardo Habkost wrote: Hi, This is a new version of the series to disabling virtualization on kdump, now extended to do the same tricks on emergency_restart

Re: [PATCH 09/16] kdump: Hook emergency_virt_disable() on crash shutdown code

2008-11-05 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 09:41:44AM -0500, Vivek Goyal wrote: On Tue, Nov 04, 2008 at 12:52:37PM -0200, Eduardo Habkost wrote: Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch

Re: [PATCH 15/16] kvm: x86: set kdump virt_disable function on initialization

2008-11-05 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 09:26:53AM -0800, Eric W. Biederman wrote: Eduardo Habkost [EMAIL PROTECTED] writes: Finally implement the virt_disable function for kdump. It will call kvm_x86_ops-crash_hardware_disable(), that will disable virtualization extensions on the CPU

Re: [PATCH 08/16] x86: Emergency virtualization disable function

2008-11-05 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 09:33:06AM -0800, Eric W. Biederman wrote: Eduardo Habkost [EMAIL PROTECTED] writes: +int set_virt_disable_func(void (*fn)(void)) +{ + int r = 0; + + spin_lock(virt_disable_lock); + if (!virt_disable_fn) + rcu_assign_pointer(virt_disable_fn

[PATCH 03/15] x86 kdump: Create kdump_nmi_shootdown_cpus()

2008-11-05 Thread Eduardo Habkost
For the kdump-specific code that was living on nmi_shootdown_cpus(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index a70c1c6

[PATCH 01/15] x86 kdump: Extract kdump-specific code from crash_nmi_callback()

2008-11-05 Thread Eduardo Habkost
The NMI CPU-halting code will be used on non-kdump cases, also (e.g. emergency_reboot when virtualization is enabled). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 31 --- 1 files changed, 20 insertions(+), 11 deletions(-) diff

[PATCH 09/15] x86: Emergency virtualization disable function

2008-11-05 Thread Eduardo Habkost
] [v3: make emergency_virt_disable() non-static] [v4: add a config option for it: CPU_VIRT_EXTENSIONS] [v5: add has_virt_extensions() function] [v6: don't define the registering functions if CPU_VIRT_EXTENSIONS is not enabled] [v7: use EXPORT_SYMBOL_GPL] Signed-off-by: Eduardo Habkost [EMAIL PROTECTED

[PATCH 15/15] Revert x86: default to reboot via ACPI

2008-11-05 Thread Eduardo Habkost
This reverts commit c7ffa6c26277b403920e2255d10df849bd613380. Now that we have the hooks to disable virtualization on emergency_restart(), we can get back to the BOOT_KBD reboot_type default. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c |6 +- 1 files

[PATCH 07/15] x86: Make nmi_shootdown_cpus() available on !SMP and !X86_LOCAL_APIC

2008-11-05 Thread Eduardo Habkost
The X86_LOCAL_APIC #ifdef was for kdump. For !SMP, the function simply does nothing. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 11/15] x86: disable virtualization on all CPUs if needed, on emergency_restart

2008-11-05 Thread Eduardo Habkost
: additional source code comments explaining why we do that] Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 55 - 1 files changed, 53 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 10/15] kdump: Hook emergency_virt_disable() on crash shutdown code

2008-11-05 Thread Eduardo Habkost
[v2: add comments on source code, explaining why it is needed] Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index d84a852

[PATCH 06/15] x86: Move nmi_shootdown_cpus() to reboot.c

2008-11-05 Thread Eduardo Habkost
Now nmi_shootdown_cpus() is ready to be used by non-kdump code also. Move it to reboot.c. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 73 -- arch/x86/kernel/reboot.c | 79

[PATCH 08/15] x86: Disable IRQs before doing anything on nmi_shootdown_cpus()

2008-11-05 Thread Eduardo Habkost
We need to know on which CPU we are running on, and we don't want to be preempted while doing this. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 04/15] x86 kdump: Make kdump_nmi_callback() a function ptr on crash_nmi_callback()

2008-11-05 Thread Eduardo Habkost
The reboot code will use a different function on crash_nmi_callback(). Adding a function pointer parameter to nmi_shootdown_cpus() for that. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff

[PATCH 14/15] kvm: vmx: crash_hardware_disable function

2008-11-05 Thread Eduardo Habkost
We need to first check if virtualization was enabled. We do this by checking CR4.VMXE. If it is set, run vmxoff and clear CR4.VMXE. Register it using set_virt_disable_func() on hardware_setup, and unregister it on hardware_unsetup. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86

[PATCH 05/15] x86 kdump: Make nmi_shootdown_cpus() non-static

2008-11-05 Thread Eduardo Habkost
Add prototype to asm/reboot.h. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/reboot.h |5 + arch/x86/kernel/crash.c |3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h

[PATCH 00/15] x86: disable virt on kdump and emergency_restart (v2)

2008-11-05 Thread Eduardo Habkost
Hi, This is an updated version of the reboot/kdump virtualization disable series that I've sent previously. In short, the x86 and kdump changes are the same as before, except for EXPORT_SYMBOL_GPL, and the KVM parts are completely different. Details of changes since the previous series: -

[PATCH 12/15] kvm: svm: no-parameters version of svm_hardware_disable()

2008-11-05 Thread Eduardo Habkost
Create __svm_hardware_disable(), a function we can use for set_virt_disable_func(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/svm.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index f0ad4d4

Re: [PATCH] Activate Virtualization On Demand v3

2008-11-05 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 11:41:04AM +0100, Alexander Graf wrote: X86 CPUs need to have some magic happening to enable the virtualization extensions on them. This magic can result in unpleasant results for users, like blocking other VMMs from working (vmx) or using invalid TLB entries (svm).

Re: [PATCH 00/14] x86: disable virt on kdump and emergency_restart

2008-11-06 Thread Eduardo Habkost
On Thu, Nov 06, 2008 at 11:49:57AM +0200, Avi Kivity wrote: Ingo Molnar wrote: general ack for the x86 bits, but i'm not sure whether we should be pushing this upstream so late in the cycle. If we do it in the next cycle then it's best we do it in the x86 tree, the KVM impact seems much

Re: [PATCH 15/15] Revert x86: default to reboot via ACPI

2008-11-06 Thread Eduardo Habkost
On Thu, Nov 06, 2008 at 08:14:45AM +0100, Ingo Molnar wrote: * Eduardo Habkost [EMAIL PROTECTED] wrote: This reverts commit c7ffa6c26277b403920e2255d10df849bd613380. Now that we have the hooks to disable virtualization on emergency_restart(), we can get back to the BOOT_KBD

Re: [PATCH 09/15] x86: Emergency virtualization disable function

2008-11-06 Thread Eduardo Habkost
On Wed, Nov 05, 2008 at 11:27:32PM +0100, Pavel Machek wrote: On Wed 2008-11-05 17:56:52, Eduardo Habkost wrote: This patch adds an interface to set a function that can be used to disable virtualization extensions on the CPU on emergency cases, such as on kdump or emergency reboot

Re: [PATCH 08/16] x86: Emergency virtualization disable function

2008-11-06 Thread Eduardo Habkost
On Thu, Nov 06, 2008 at 12:30:51PM +0200, Avi Kivity wrote: Eric W. Biederman wrote: If you want to be extra simple and safe, remove kvm from the equation. Make the disabling code part of kdump/emergency_restart and only rely on the convention that cr3.vmxe == vmxon. Convention?

[PATCH 2/8] x86 kdump: Move crashing_cpu assignment to nmi_shootdown_cpus()

2008-11-12 Thread Eduardo Habkost
This variable will be moved to non-kdump-specific code. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 6047542..ed2f0f9 100644

[PATCH 7/8] x86: Make nmi_shootdown_cpus() available on !SMP and !X86_LOCAL_APIC

2008-11-12 Thread Eduardo Habkost
The X86_LOCAL_APIC #ifdef was for kdump. For !SMP, the function simply does nothing. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 13 - 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 3/8] x86 kdump: Create kdump_nmi_shootdown_cpus()

2008-11-12 Thread Eduardo Habkost
For the kdump-specific code that was living on nmi_shootdown_cpus(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index ed2f0f9

[PATCH 5/8] x86 kdump: Make nmi_shootdown_cpus() non-static

2008-11-12 Thread Eduardo Habkost
Add prototype to asm/reboot.h. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/reboot.h |5 + arch/x86/kernel/crash.c |3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h

[PATCH 8/8] x86: Disable IRQs before doing anything on nmi_shootdown_cpus()

2008-11-12 Thread Eduardo Habkost
We need to know on which CPU we are running on, and we don't want to be preempted while doing this. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel

[PATCH 6/8] x86: Move nmi_shootdown_cpus() to reboot.c

2008-11-12 Thread Eduardo Habkost
Now nmi_shootdown_cpus() is ready to be used by non-kdump code also. Move it to reboot.c. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 76 -- arch/x86/kernel/reboot.c | 83

[PATCH 1/8] x86 kdump: Extract kdump-specific code from crash_nmi_callback()

2008-11-12 Thread Eduardo Habkost
The NMI CPU-halting code will be used on non-kdump cases, also (e.g. emergency_reboot when virtualization is enabled). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 31 --- 1 files changed, 20 insertions(+), 11 deletions(-) diff

[PATCH 0/8] Make nmi_shootdown_cpus() usable by non-kdump code

2008-11-12 Thread Eduardo Habkost
Hi, Ingo, As tip/master is a moving target, I am splitting the previous kdump/reboot virtualization-disable code series[1] into smaller series so the simpler parts can be included sooner. This first series is just for making nmi_shootdown_cpus() usable by non-kdump code, by moving their generic

[PATCH 4/8] x86 kdump: Make kdump_nmi_callback() a function ptr on crash_nmi_callback()

2008-11-12 Thread Eduardo Habkost
The reboot code will use a different function on crash_nmi_callback(). Adding a function pointer parameter to nmi_shootdown_cpus() for that. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff

[PATCH 00/11] x86: disable virt on kdump and emergency_restart (v3)

2008-11-13 Thread Eduardo Habkost
Hi, This is a new spin of the series to disable vmx on kdump and on emergency_restart. Now we avoid doing the function pointer stuff by moving 4 small KVM functions to a header, as inline functions. The code looks much simpler now, but we have to be more careful because some additional code will

[PATCH 07/11] kvm: svm: move has_svm() code to asm/virtext.h

2008-11-13 Thread Eduardo Habkost
Use a trick to keep the printk()s on has_svm() working as before. gcc will take care of not generating code for the 'msg' stuff when the function is called with a NULL msg argument. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 33

[PATCH 01/11] kvm: vmx: move cpu_has_kvm_support() to an inline on asm/virtext.h

2008-11-13 Thread Eduardo Habkost
It will be used by core code on kdump and reboot, to disable vmx if needed. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 31 +++ arch/x86/kvm/vmx.c |4 ++-- 2 files changed, 33 insertions(+), 2 deletions

[PATCH 06/11] kvm: svm: move some SVM_* #defines to asm/virtext.h

2008-11-13 Thread Eduardo Habkost
Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 14 ++ arch/x86/kvm/svm.h | 12 +++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h index

[PATCH 11/11] x86: disable VMX on all CPUs on reboot

2008-11-13 Thread Eduardo Habkost
) uses machine_emergency_restart() directly. The solution to make this work without adding a new function or argument to machine_ops was setting a 'reboot_emergency' flag that tells if native_machine_emergency_restart() needs to do the virt cleanup or not. Signed-off-by: Eduardo Habkost [EMAIL

[PATCH 08/11] kvm: svm: move svm_hardware_disable() code to asm/virtext.h

2008-11-13 Thread Eduardo Habkost
Create cpu_svm_disable() function. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 14 ++ arch/x86/kvm/svm.c |6 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/virtext.h b/arch/x86

[PATCH 04/11] kvm: vmx: extract kvm_cpu_vmxoff() from hardware_disable()

2008-11-13 Thread Eduardo Habkost
Along with some comments on why it is different from the core cpu_vmxoff() function. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kvm/vmx.c | 13 +++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 5cde1e3

[PATCH 02/11] kvm: vmx: move ASM_VMX_* definitions to asm/virtext.h

2008-11-13 Thread Eduardo Habkost
Move the definitions so they can be used by non-kvm code. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/kvm_host.h | 14 ++ arch/x86/include/asm/virtext.h | 17 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/arch

[PATCH 09/11] x86: asm/virtext.h: create cpu_emergency_svm_disable()

2008-11-13 Thread Eduardo Habkost
This function can be used by the reboot or kdump code to forcibly disable SVM on the CPU. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/virtext.h b/arch/x86

[PATCH 10/11] kdump: forcibly disable VMX and SVM on machine_crash_shutdown()

2008-11-13 Thread Eduardo Habkost
, because those functions check if the CPUs support SVM or VMX before doing their tasks. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/crash.c | 18 ++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel

[PATCH 03/11] x86: asm/virtext.h: add cpu_vmxoff() inline function

2008-11-13 Thread Eduardo Habkost
Unfortunately we can't use exactly the same code from vmx hardware_disable(), because the KVM function uses the __kvm_handle_fault_on_reboot() tricks. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 13 + 1 files changed, 13 insertions(+), 0

Re: [PATCH 00/11] x86: disable virt on kdump and emergency_restart (v3)

2008-11-17 Thread Eduardo Habkost
On Sun, Nov 16, 2008 at 09:57:55AM +0200, Avi Kivity wrote: Eduardo Habkost wrote: Hi, This is a new spin of the series to disable vmx on kdump and on emergency_restart. Now we avoid doing the function pointer stuff by moving 4 small KVM functions to a header, as inline functions. The code

[PATCH 10/12] x86: cpu_emergency_svm_disable() function

2008-11-17 Thread Eduardo Habkost
This function can be used by the reboot or kdump code to forcibly disable SVM on the CPU. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/virtext.h b/arch/x86

[PATCH 05/12] x86: asm/virtext.h: add cpu_vmxoff() inline function

2008-11-17 Thread Eduardo Habkost
Unfortunately we can't use exactly the same code from vmx hardware_disable(), because the KVM function uses the __kvm_handle_fault_on_reboot() tricks. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 15 +++ 1 files changed, 15 insertions(+), 0

[PATCH 02/12] kvm: svm: move svm.h to include/asm

2008-11-17 Thread Eduardo Habkost
svm.h will be used by core code that is independent of KVM, so I am moving it outside the arch/x86/kvm directory. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/svm.h | 328 arch/x86/kvm/kvm_svm.h |2 +- arch/x86

[PATCH 12/12] x86: disable VMX on all CPUs on reboot

2008-11-17 Thread Eduardo Habkost
a 'reboot_emergency' flag that tells if native_machine_emergency_restart() needs to do the virt cleanup or not. Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/kernel/reboot.c | 63 - 1 files changed, 61 insertions(+), 2 deletions(-) diff --git

[PATCH 00/12] x86: disable virt on kdump and emergency_restart (v4)

2008-11-17 Thread Eduardo Habkost
Hi, Ingo, This is yet another spin of the series to disable vmx on kdump and on emergency_restart, after some feedback from Avi. The only change from v3 is that vmx.h and svm.h were moved from arch/x86/kvm to arch/x86/include/asm, instead of moving code from those headers to asm/virtext.h. I

[PATCH 07/12] x86: cpu_emergency_vmxoff() function

2008-11-17 Thread Eduardo Habkost
Add cpu_emergency_vmxoff() and its friends: cpu_vmx_enabled() and __cpu_emergency_vmxoff(). Signed-off-by: Eduardo Habkost [EMAIL PROTECTED] --- arch/x86/include/asm/virtext.h | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm

  1   2   3   4   5   6   7   >