Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Avi Kivity
Richard Hughes wrote: On Sat, 2007-06-16 at 15:30 +0300, Muli Ben-Yehuda wrote: Is there any easy way we can detect if virtual machines are running? The module use counts will be elevanted and they'll refuse to unload (or there's a nasty bug somewhere). Nahh, that's too

Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Richard Hughes
On Sun, 2007-06-17 at 10:02 +0300, Avi Kivity wrote: Are you sure you want to suspend your computer with a running virtual machine? Why invest in workarounds when a fix is available? Totally agree. I was really looking for a proper fix, e.g. use libvirt to suspend the virtual

Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Avi Kivity
Richard Hughes wrote: On Sun, 2007-06-17 at 10:02 +0300, Avi Kivity wrote: Are you sure you want to suspend your computer with a running virtual machine? Why invest in workarounds when a fix is available? Totally agree. I was really looking for a proper

Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Richard Hughes
On Sun, 2007-06-17 at 11:10 +0300, Avi Kivity wrote: No no no. The proper fix will have suspend just working, whether or not a virtual machine is running or not. When you resume, the virtual machines continue running as if nothing had happened. Ahh gotcha. In which case I apologize, I

Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Avi Kivity
Daniel Veillard wrote: Well if there were a way to discover running KVM instances and communicate with them, then we wouldn't need to keep a daemon as a parent process for libvirt access and control. It's a point I would love to see solved at the QEmu level, but it's not really urgent :-)

[kvm-devel] [PATCH 00/58] KVM updates for 2.6.23

2007-06-17 Thread Avi Kivity
Following is my patchqueue for the 2.6.23 merge window, not including the cpu hotplug fixes posted earlier. The changes include performance improvements, guest smp, random fixes, and cleanups. Comments welcome. Anthony Liguori (1): KVM: SVM: Allow direct guest access to PC debug port Avi

[kvm-devel] [PATCH 01/58] KVM: VMX: Enable io bitmaps to avoid IO port 0x80 VMEXITs

2007-06-17 Thread Avi Kivity
From: He, Qing [EMAIL PROTECTED] This patch enables IO bitmaps control on vmx and unmask the 0x80 port to avoid VMEXITs caused by accessing port 0x80. 0x80 is used as delays (see include/asm/io.h), and handling VMEXITs on its access is unnecessary but slows things down. This patch improves kernel

[kvm-devel] [PATCH 03/58] KVM: Assume that writes smaller than 4 bytes are to non-pagetable pages

2007-06-17 Thread Avi Kivity
This allows us to remove write protection earlier than otherwise. Should some mad OS choose to use byte writes to update pagetables, it will suffer a performance hit, but still work correctly. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c |1 + 1 files changed, 1

[kvm-devel] [PATCH 07/58] KVM: Be more careful restoring fs on lightweight vmexit

2007-06-17 Thread Avi Kivity
i386 wants fs for accessing the pda even on a lightweight exit, so ensure we can always restore it. This fixes a regression on i386 introduced by the lightweight vmexit patch. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c | 22 +++--- 1 files changed, 11

[kvm-devel] [PATCH 04/58] KVM: Avoid saving and restoring some host CPU state on lightweight vmexit

2007-06-17 Thread Avi Kivity
Many msrs and the like will only be used by the host if we schedule() or return to userspace. Therefore, we avoid saving them if we handle the exit within the kernel, and if a reschedule is not requested. Based on a patch from Eddie Dong [EMAIL PROTECTED] with a couple of fixes by me.

[kvm-devel] [PATCH 08/58] KVM: Unify kvm_mmu_pre_write() and kvm_mmu_post_write()

2007-06-17 Thread Avi Kivity
Instead of calling two functions and repeating expensive checks, call one function and provide it with before/after information. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |4 ++-- drivers/kvm/kvm_main.c |4 ++-- drivers/kvm/mmu.c | 11 --- 3

[kvm-devel] [PATCH 06/58] KVM: Reduce misfirings of the fork detector

2007-06-17 Thread Avi Kivity
The kvm mmu tries to detects forks by looking for repeated writes to a page table. If it sees a fork, it unshadows the page table so the page table copying can proceed at native speed instead of being emulated. However, the detector also triggered on simple demand paging access patterns: a

[kvm-devel] [PATCH 10/58] KVM: Update shadow pte on write to guest pte

2007-06-17 Thread Avi Kivity
A typical demand page/copy on write pattern is: - page fault on vaddr - kvm propagates fault to guest - guest handles fault, updates pte - kvm traps write, clears shadow pte, resumes guest - guest returns to userspace, re-faults on same vaddr - kvm installs shadow pte, resumes guest - guest

[kvm-devel] [PATCH 05/58] KVM: Unindent some code

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c | 58 ++-- 1 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 84ce0c0..9ebb18d 100644 --- a/drivers/kvm/vmx.c +++

[kvm-devel] [PATCH 13/58] KVM: Move some more msr mangling into vmx_save_host_state()

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c | 14 +++--- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 677b38c..93c3abf 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -290,6 +290,13 @@ static

[kvm-devel] [PATCH 12/58] KVM: Fix potential guest state leak into host

2007-06-17 Thread Avi Kivity
The lightweight vmexit path avoids saving and reloading certain host state. However in certain cases lightweight vmexit handling can schedule() which requires reloading the host state. So we store the host state in the vcpu structure, and reloaded it if we relinquish the vcpu. Signed-off-by:

[kvm-devel] [PATCH 09/58] KVM: MMU: Respect nonpae pagetable quadrant when zapping ptes

2007-06-17 Thread Avi Kivity
When a guest writes to a page that has an mmu shadow, we have to clear the shadow pte corresponding to the memory location touched by the guest. Now, in nonpae mode, a single guest page may have two or four shadow pages (because a nonpae page maps 4MB or 4GB, whereas the pae shadow maps 2MB or

[kvm-devel] [PATCH 11/58] KVM: Increase mmu shadow cache to 1024 pages

2007-06-17 Thread Avi Kivity
This improves kbuild times by about 10%, bringing it within a respectable 25% of native. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 11c519e..f6ee189 100644

[kvm-devel] [PATCH 16/58] KVM: Set cr0.mp for guests

2007-06-17 Thread Avi Kivity
This allows fwait instructions to be trapped when the guest fpu is not loaded. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 4724087..5e6dac5 100644 ---

[kvm-devel] [PATCH 20/58] KVM: VMX: Only reload guest msrs if they are already loaded

2007-06-17 Thread Avi Kivity
If we set an msr via an ioctl() instead of by handling a guest exit, we have the host state loaded, so reloading the msrs would clobber host state instead of guest state. This fixes a host oops (and loss of a cpu) on a guest reboot. Signed-off-by: Avi Kivity [EMAIL PROTECTED] ---

[kvm-devel] [PATCH 26/58] KVM: VMX: Cleanup redundant code in MSR set

2007-06-17 Thread Avi Kivity
From: Eddie Dong [EMAIL PROTECTED] Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 872ca03..dc99191 100644

[kvm-devel] [PATCH 18/58] KVM: MMU: Simplify kvm_mmu_free_page() a tiny bit

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c | 10 -- 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 9ec3df9..a96c9ae 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c @@ -455,12 +455,10 @@ static int

[kvm-devel] [PATCH 14/58] KVM: Rationalize exception bitmap usage

2007-06-17 Thread Avi Kivity
Everyone owns a piece of the exception bitmap, but they happily write to the entire thing like there's no tomorrow. Centralize handling in update_exception_bitmap() and have everyone call that. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c | 42

[kvm-devel] [PATCH 19/58] KVM: MMU: Store shadow page tables as kernel virtual addresses, not physical

2007-06-17 Thread Avi Kivity
Simpifies things a bit. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |2 +- drivers/kvm/mmu.c | 32 +++- drivers/kvm/paging_tmpl.h |2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/kvm/kvm.h

[kvm-devel] [PATCH 17/58] KVM: Implement IA32_EBL_CR_POWERON msr

2007-06-17 Thread Avi Kivity
From: Matthew Gregan [EMAIL PROTECTED] Attempting to boot the default 'bsd' kernel of OpenBSD 4.1 i386 in a guest fails early in the kernel init inside p3_get_bus_clock while trying to read the IA32_EBL_CR_POWERON MSR. KVM logs an 'unhandled MSR' message and the guest kernel faults. This patch

[kvm-devel] [PATCH 25/58] KVM: VMX: Avoid saving and restoring msrs on lightweight vmexit

2007-06-17 Thread Avi Kivity
From: Eddie Dong [EMAIL PROTECTED] In a lightweight exit (where we exit and reenter the guest without scheduling or exiting to userspace in between), we don't need various msrs on the host, and avoiding shuffling them around reduces raw exit time by 8%. i386 compile fix by Daniel Hecken [EMAIL

[kvm-devel] [PATCH 31/58] KVM: Use symbolic constants instead of magic numbers

2007-06-17 Thread Avi Kivity
From: Eddie Dong [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/paging_tmpl.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 6dd0da9..183d4ca 100644 ---

[kvm-devel] [PATCH 15/58] KVM: Consolidate guest fpu activation and deactivation

2007-06-17 Thread Avi Kivity
Easier to keep track of where the fpu is this way. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |2 +- drivers/kvm/vmx.c | 50 +++--- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/kvm/kvm.h

[kvm-devel] [PATCH 22/58] KVM: Fix vmx I/O bitmap initialization on highmem systems

2007-06-17 Thread Avi Kivity
kunmap() expects a struct page, not a virtual address. Fixes an oops loading kvm-intel.ko on i386 with CONFIG_HIGHMEM. Thanks to Michael Ivanov [EMAIL PROTECTED] for reporting. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c |4 ++-- 1 files changed, 2 insertions(+), 2

[kvm-devel] [PATCH 23/58] KVM: VMX: Use local labels in inline assembly

2007-06-17 Thread Avi Kivity
This makes oprofile dumps and disassebly easier to read. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c | 15 +++ 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 34171d9..c4c5535 100644 ---

[kvm-devel] [PATCH 38/58] KVM: Move shadow pte modifications from set_pte/set_pde to set_pde_common()

2007-06-17 Thread Avi Kivity
We want all shadow pte modifications in one place. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/paging_tmpl.h |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index c067203..35f264f 100644 ---

[kvm-devel] [PATCH 27/58] KVM: VMX: Avoid saving and restoring msr_efer on lightweight vmexit

2007-06-17 Thread Avi Kivity
From: Eddie Dong [EMAIL PROTECTED] MSR_EFER.LME/LMA bits are automatically save/restored by VMX hardware, KVM only needs to save NX/SCE bits at time of heavy weight VM Exit. But clearing NX bits in host envirnment may cause system hang if the host page table is using EXB bits, thus we leave NX

[kvm-devel] [PATCH 34/58] KVM: MMU: Move set_pte_common() to pte width dependent code

2007-06-17 Thread Avi Kivity
In preparation of some modifications. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c | 48 -- drivers/kvm/paging_tmpl.h | 56 +--- 2 files changed, 52 insertions(+), 52 deletions(-) diff

[kvm-devel] [PATCH 40/58] KVM: MMU: Make setting shadow ptes atomic on i386

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/Kconfig |1 + drivers/kvm/mmu.c | 14 -- drivers/kvm/paging_tmpl.h |4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig index

[kvm-devel] [PATCH 29/58] KVM: x86 emulator: implement wbinvd

2007-06-17 Thread Avi Kivity
Vista seems to trigger it. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/x86_emulate.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 7ade090..6123c02 100644 --- a/drivers/kvm/x86_emulate.c +++

[kvm-devel] [PATCH 44/58] KVM: MMU: Remove unused large page marker

2007-06-17 Thread Avi Kivity
This has not been used for some time, as the same information is available in the page header. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c |1 - drivers/kvm/paging_tmpl.h |2 -- 2 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/kvm/mmu.c

[kvm-devel] [PATCH 36/58] KVM: MMU: Fold fix_read_pf() into set_pte_common()

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c | 17 - drivers/kvm/paging_tmpl.h | 34 +++--- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index a763150..2079d69

[kvm-devel] [PATCH 30/58] KVM: Fix includes

2007-06-17 Thread Avi Kivity
From: Markus Rechberger [EMAIL PROTECTED] KVM compilation fails for some .configs. This fixes it. Signed-off-by: Markus Rechberger [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git

[kvm-devel] [PATCH 39/58] KVM: Make shadow pte updates atomic

2007-06-17 Thread Avi Kivity
With guest smp, a second vcpu might see partial updates when the first vcpu services a page fault. So delay all updates until we have figured out what the pte should look like. Note that on i386, this is still not completely atomic as a 64-bit write will be split into two on a 32-bit machine.

[kvm-devel] [PATCH 41/58] KVM: MMU: Remove cr0.wp tricks

2007-06-17 Thread Avi Kivity
No longer needed as we do everything in one place. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/paging_tmpl.h | 11 --- 1 files changed, 0 insertions(+), 11 deletions(-) diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index fabc2c9..59b4cb2 100644 ---

[kvm-devel] [PATCH 33/58] KVM: MMU: Simplify fetch() a little bit

2007-06-17 Thread Avi Kivity
Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/paging_tmpl.h | 34 +- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h index 183d4ca..e094a8b 100644 --- a/drivers/kvm/paging_tmpl.h

[kvm-devel] [PATCH 37/58] KVM: MMU: Fold fix_write_pf() into set_pte_common()

2007-06-17 Thread Avi Kivity
This prevents some work from being performed twice, and, more importantly, reduces the number of places where we modify shadow ptes. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c | 11 +++ drivers/kvm/paging_tmpl.h | 168 +++-

[kvm-devel] [PATCH 35/58] KVM: MMU: Pass the guest pde to set_pte_common

2007-06-17 Thread Avi Kivity
We will need the accessed bit (in addition to the dirty bit) and also write access (for setting the dirty bit) in a future patch. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/paging_tmpl.h | 29 +++-- 1 files changed, 15 insertions(+), 14 deletions(-)

[kvm-devel] [PATCH 47/58] KVM: Remove unnecessary initialization and checks in mark_page_dirty()

2007-06-17 Thread Avi Kivity
From: Nguyen Anh Quynh [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm_main.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index bf35457..3c3231d 100644 --- a/drivers/kvm/kvm_main.c

[kvm-devel] [PATCH 48/58] KVM: Fix vcpu freeing for guest smp

2007-06-17 Thread Avi Kivity
A vcpu can pin up to four mmu shadow pages, which means the freeing loop will never terminate. Fix by first unpinning shadow pages on all vcpus, then freeing shadow pages. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm_main.c | 15 +++ drivers/kvm/mmu.c |

[kvm-devel] [PATCH 52/58] KVM: Emulate hlt on real mode for Intel

2007-06-17 Thread Avi Kivity
This has two use cases: the bios can't boot from disk, and guest smp bootstrap. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |1 + drivers/kvm/vmx.c |7 ++- drivers/kvm/x86_emulate.c |6 +- 3 files changed, 12 insertions(+), 2 deletions(-)

[kvm-devel] [PATCH 24/58] KVM: VMX: Handle #SS faults from real mode

2007-06-17 Thread Avi Kivity
From: Nitin A Kamble [EMAIL PROTECTED] Instructions with address size override prefix opcode 0x67 Cause the #SS fault with 0 error code in VM86 mode. Forward them to the emulator. Signed-Off-By: Nitin A Kamble [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c

[kvm-devel] [PATCH 28/58] Use menuconfig objects II - KVM/Virt

2007-06-17 Thread Avi Kivity
From: Jan Engelhardt [EMAIL PROTECTED] Make a menuconfig out of the Kconfig objects menu, ..., endmenu, so that the user can disable all the options in that menu at once instead of having to disable each option separately. Signed-off-by: Jan Engelhardt [EMAIL PROTECTED] Signed-off-by: Andrew

[kvm-devel] [PATCH 51/58] KVM: Move duplicate halt handling code into kvm_main.c

2007-06-17 Thread Avi Kivity
Will soon have a thid user. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |1 + drivers/kvm/kvm_main.c | 11 +++ drivers/kvm/svm.c |7 +-- drivers/kvm/vmx.c |7 +-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git

[kvm-devel] [PATCH 43/58] KVM: MMU: Don't cache guest access bits in the shadow page table

2007-06-17 Thread Avi Kivity
This was once used to avoid accessing the guest pte when upgrading the shadow pte from read-only to read-write. But usually we need to set the guest pte dirty or accessed bits anyway, so this wasn't really exploited. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c |

[kvm-devel] [PATCH 21/58] KVM: Avoid corrupting tr in real mode

2007-06-17 Thread Avi Kivity
The real mode tr needs to be set to a specific tss so that I/O instructions can function. Divert the new tr values to the real mode save area from where they will be restored on transition to protected mode. This fixes some crashes on reboot when the bios accesses an I/O instruction.

[kvm-devel] [PATCH 32/58] KVM: MMU: Use slab caches for shadow pages and their headers

2007-06-17 Thread Avi Kivity
Use slab caches instead of a simple custom list. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |4 +- drivers/kvm/kvm_main.c |1 - drivers/kvm/mmu.c | 64 +-- 3 files changed, 41 insertions(+), 28 deletions(-)

[kvm-devel] [PATCH 53/58] KVM: Keep an upper bound of initialized vcpus

2007-06-17 Thread Avi Kivity
That way, we don't need to loop for KVM_MAX_VCPUS for a single vcpu vm. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/kvm.h |1 + drivers/kvm/kvm_main.c |5 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index

[kvm-devel] [PATCH 56/58] KVM: VMX: Replace memset(addr, 0, PAGESIZE) with clear_page(addr)

2007-06-17 Thread Avi Kivity
From: Shani Moideen [EMAIL PROTECTED] Signed-off-by: Shani Moideen [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/vmx.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index b969db1..b909b54 100644

[kvm-devel] [PATCH 45/58] KVM: Lazy guest cr3 switching

2007-06-17 Thread Avi Kivity
Switch guest paging context may require us to allocate memory, which might fail. Instead of wiring up error paths everywhere, make context switching lazy and actually do the switch before the next guest entry, where we can return an error if allocation fails. Signed-off-by: Avi Kivity [EMAIL

[kvm-devel] [PATCH 42/58] KVM: MMU: Simpify accessed/dirty/present/nx bit handling

2007-06-17 Thread Avi Kivity
Always set the accessed and dirty bit (since having them cleared causes a read-modify-write cycle), always set the present bit, and copy the nx bit from the guest. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/mmu.c |5 - drivers/kvm/paging_tmpl.h |7 ++- 2

[kvm-devel] [PATCH 54/58] KVM: Flush remote tlbs when reducing shadow pte permissions

2007-06-17 Thread Avi Kivity
When a vcpu causes a shadow tlb entry to have reduced permissions, it must also clear the tlb on remote vcpus. We do that by: - setting a bit on the vcpu that requests a tlb flush before the next entry - if the vcpu is currently executing, we send an ipi to make sure it exits before we

[kvm-devel] [PATCH 57/58] KVM: Initialize the BSP bit in the APIC_BASE msr correctly

2007-06-17 Thread Avi Kivity
Needs to be set on vcpu 0 only. Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/svm.c |6 +++--- drivers/kvm/vmx.c |6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 68841ef..62ec38c 100644 ---

[kvm-devel] [PATCH 58/58] KVM: VMX: Ensure vcpu time stamp counter is monotonous

2007-06-17 Thread Avi Kivity
If the time stamp counter goes backwards, a guest delay loop can become infinite. This can happen if a vcpu is migrated to another cpu, where the counter has a lower value than the first cpu. Since we're doing an IPI to the first cpu anyway, we can use that to pick up the old tsc, and use that

[kvm-devel] [PATCH 55/58] KVM: SVM: Replace memset(addr, 0, PAGESIZE) with clear_page(addr)

2007-06-17 Thread Avi Kivity
From: Shani Moideen [EMAIL PROTECTED] Signed-off-by: Shani Moideen [EMAIL PROTECTED] Signed-off-by: Avi Kivity [EMAIL PROTECTED] --- drivers/kvm/svm.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index eb175c5..68841ef 100644

Re: [kvm-devel] [PATCH RFC 3/3] Virtio draft III: example block driver

2007-06-17 Thread Avi Kivity
Rusty Russell wrote: +static bool do_read(request_queue_t *q, struct virtio_blk *vblk, + struct virtblk_req *vbr) +{ + unsigned long num; + + vbr-out_hdr.type |= VIRTIO_BLK_T_READ; + + /* Set up for reply. */ + vblk-sg[0].page = virt_to_page(vbr-in_hdr); +

Re: [kvm-devel] [BUG] Oops with KVM-27

2007-06-17 Thread Luca Tettamanti
Il Sat, Jun 16, 2007 at 10:43:23AM +0300, Avi Kivity ha scritto: Luca Tettamanti wrote: Il Fri, Jun 15, 2007 at 12:06:50PM +0300, Avi Kivity ha scritto: After a bit of thinking: it's correct but removes an optimization; furthermore it may miss other instructions that write to memory

Re: [kvm-devel] [BUG] Oops with KVM-27

2007-06-17 Thread Avi Kivity
Luca Tettamanti wrote: Actually we haven't; just before the memcpy(), we can put a memcmp() to guard the kvm_mmu_pte_write(), which is the really expensive operation, especially with guest smp. Yup, but it seemed wasteful to map (at least when highmem is in use) a page just to check

[kvm-devel] Panic when loading kvm-amd.ko

2007-06-17 Thread Michael Hanselmann
Hello When loading kvm-amd.ko on an HP DL-145 G5 with one AMD Opteron 2216 HE (2 cores, 2.4 GHz), I get a kernel panic. I tried to find the exact cause but was unable to do so. It doesn't crash when I add a return before wrmsrl(MSR_EFER, efer | MSR_EFER_SVME_MASK); in svm_hardware_enable. The

Re: [kvm-devel] Panic when loading kvm-amd.ko

2007-06-17 Thread Avi Kivity
Michael Hanselmann wrote: Hello When loading kvm-amd.ko on an HP DL-145 G5 with one AMD Opteron 2216 HE (2 cores, 2.4 GHz), I get a kernel panic. I tried to find the exact cause but was unable to do so. It doesn't crash when I add a return before wrmsrl(MSR_EFER, efer | MSR_EFER_SVME_MASK);

[kvm-devel] [ANNOUNCE, CFP] KVM Forum 2007

2007-06-17 Thread Avi Kivity
Esteemed Lists, Qumranet will hold the first KVM Forum during 29-31 August, 2007, in Tucson, Arizona, USA. If you are interested in presenting, please contact the undersigned as soon as possible. Registration information will be provided in a separate announcement. See you in August, Avi

[kvm-devel] [PATCH 1/2] kvm: Fix x86 emulator writeback

2007-06-17 Thread Luca Tettamanti
When the old value and new one are the same the emulator skips the write; this is undesiderable when the destination is a MMIO area and the write shall be performed regardless of the previous value. This optimization breaks e.g. a Linux guest APIC compiled without X86_GOOD_APIC. Remove the check

[kvm-devel] [PATCH 2/2] kvm: avoid useless memory write when possible

2007-06-17 Thread Luca Tettamanti
When writing to normal memory and the memory area is unchanged the write can be safely skipped, avoiding the costly kvm_mmu_pte_write. Signed-Off-By: Luca Tettamanti [EMAIL PROTECTED] --- drivers/kvm/kvm_main.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git

Re: [kvm-devel] [PATCH 1/2] kvm: Fix x86 emulator writeback

2007-06-17 Thread Avi Kivity
Luca Tettamanti wrote: When the old value and new one are the same the emulator skips the write; this is undesiderable when the destination is a MMIO area and the write shall be performed regardless of the previous value. This optimization breaks e.g. a Linux guest APIC compiled without

Re: [kvm-devel] Panic when loading kvm-amd.ko

2007-06-17 Thread Michael Hanselmann
On Sun, Jun 17, 2007 at 06:37:19PM +0300, Avi Kivity wrote: I went through my BIOS settings and found: Advanced BIOS Features - CPU Feature - Virtualization However this was already set to Enabled. I tried changing the value to Disabled and now KVM works fine. Stupid ABIT... I suggest

[kvm-devel] /dev/kvm permissions

2007-06-17 Thread Baruch Even
Hello, What do peoples do/think about the permissions for /dev/kvm? I'm the maintainer for the Debian package and currently the package uses a group to control access, for no good reason really. I've seen that kqemu in Debian simply uses 0666 permissions and consider doing the same for kvm. I

Re: [kvm-devel] Panic when loading kvm-amd.ko

2007-06-17 Thread Avi Kivity
Michael Hanselmann wrote: I suggest trying the same, as well as a bios upgrade. Unfortunately, the BIOS doesn't allow me to configure anything like that and it's already the latest version released by HP. However, EFER.SVME isn't set before enabling it (checked using rdmsrl(MSR_EFER,

Re: [kvm-devel] /dev/kvm permissions

2007-06-17 Thread Avi Kivity
Baruch Even wrote: Hello, What do peoples do/think about the permissions for /dev/kvm? I'm the maintainer for the Debian package and currently the package uses a group to control access, for no good reason really. I've seen that kqemu in Debian simply uses 0666 permissions and consider

Re: [kvm-devel] /dev/kvm permissions

2007-06-17 Thread Baruch Even
Avi Kivity wrote: Baruch Even wrote: Hello, What do peoples do/think about the permissions for /dev/kvm? I'm the maintainer for the Debian package and currently the package uses a group to control access, for no good reason really. I've seen that kqemu in Debian simply uses 0666

[kvm-devel] Total freeze after modprobe kvm-amd

2007-06-17 Thread arie van roon
I am using Ubuntu feisty-amd 64 did a clean install today, just for kvm. Hardware proc amd x2 4600 stepping 2 on Gigabyte GA-M55S-S3 bios F6 (latest). I am not using git. After installing the packages 1:16 1ubuntu2 and qemu 0.8.2+dfsg-0ubuntu. and trying sudo modprobe kvm-amd a total freeze occurs

Re: [kvm-devel] Suspending with kvm and kvm_loaded

2007-06-17 Thread Richard Hughes
On Sun, 2007-06-17 at 11:10 +0300, Avi Kivity wrote: I posted a patchset which does just that, when the F kernel integrates it (through inclusion of 2.6.23 or by patching the current kernel), Fedora will be able to suspend/resume just fine. I've tried the current kvm kernel git tree and

[kvm-devel] Windows XP crash: emulation failed but !mmio_needed?

2007-06-17 Thread Adam Monsen
I had just installed a Windows XP guest and left it running for a few hours with no users logged in. The machine appears to have crashed. Avi requested that I send this bug(?) report to kvm-devel, so here 'tis... REPRO STEPS: 1. Install Fedora 7 2. Install KVM 3. Install Windows XP Professional

[kvm-devel] [PATCH 0/5] KVM paravirt_ops implementation

2007-06-17 Thread Anthony Liguori
Hi, This patch series is an update of my previous paravirt_ops patches. They are loosely based on Ingo's original paravirt_ops implementation for KVM. Some of the changes since the last series include: 1) Switch to using CPUID 0x4000 instead of using MSR writes to discover shared memory

[kvm-devel] [PATCH 1/5] KVM paravirt_ops core infrastructure

2007-06-17 Thread Anthony Liguori
Regards, Anthony Liguori Subject: [PATCH] KVM paravirt_ops core infrastructure Author: Anthony Liguori [EMAIL PROTECTED] This patch implements paravirt_ops support for KVM and updates the current paravirtualization support in KVM to match. Some changes to the previous paravirtualization

[kvm-devel] [PATCH 2/5] KVM: Implement CR read caching for KVM paravirt_ops

2007-06-17 Thread Anthony Liguori
Regards, Anthony Liguori Subject: [PATCH] KVM: Implement CR read caching for KVM paravirt_ops Author: Anthony Liguori [EMAIL PROTECTED] With hardware virtualization, CR reads often times require a VMEXIT which is rather expensive. Instead of reading CR and taking the VMEXIT, maintain a copy of

[kvm-devel] [PATCH 3/5] KVM: Add paravirt MMU write support

2007-06-17 Thread Anthony Liguori
Regards, Anthony Liguori Subject: [PATCH] KVM: Add paravirt MMU write support Author: Anthony Liguori [EMAIL PROTECTED] On at least AMD hardware, hypercall based manipulation of page table memory is significantly faster than taking a page fault. Additionally, using hypercalls to manipulation

[kvm-devel] [PATCH 4/5] KVM: Add hypercall queue for paravirt_ops implementation

2007-06-17 Thread Anthony Liguori
Regards, Anthony Liguori Subject: [PATCH] KVM: Add hypercall queue for paravirt_ops implementation Author: Anthony Liguori [EMAIL PROTECTED] Implemented a hypercall queue that can be used when paravirt_ops lazy mode is enabled. This patch enables queueing of MMU write operations and CR

[kvm-devel] [PATCH 5/5] KVM: paravirt time source

2007-06-17 Thread Anthony Liguori
Regards, Anthony Liguori Subject: [PATCH] KVM: paravirt time source Author: Anthony Liguori [EMAIL PROTECTED] This is a paravirt time source for KVM based on Ingo Molnars similar patch. A very different patch will probably be needed that takes advantage of hrtimers but I have to learn a bit

Re: [kvm-devel] [PATCH 0/5] KVM paravirt_ops implementation

2007-06-17 Thread Jeremy Fitzhardinge
Anthony Liguori wrote: 1) Not really sure what is needed for CONFIG_PREEMPT support. I'm not sure which paravirt_ops calls are actually re-entrant. I'm not sure that has specifically come up. The main issue is whether a particular call can be preempted and whether that matters. I guess the

Re: [kvm-devel] [PATCH 0/5] KVM paravirt_ops implementation

2007-06-17 Thread Anthony Liguori
Hi Jeremy, Jeremy Fitzhardinge wrote: Anthony Liguori wrote: 1) Not really sure what is needed for CONFIG_PREEMPT support. I'm not sure which paravirt_ops calls are actually re-entrant. I'm not sure that has specifically come up. The main issue is whether a particular call can

Re: [kvm-devel] [PATCH 4/5] KVM: Add hypercall queue for paravirt_ops implementation

2007-06-17 Thread Jeremy Fitzhardinge
Anthony Liguori wrote: Regards, Anthony Liguori Subject: [PATCH] KVM: Add hypercall queue for paravirt_ops implementation Author: Anthony Liguori [EMAIL PROTECTED] Implemented a hypercall queue that can be used when

Re: [kvm-devel] [PATCH 4/5] KVM: Add hypercall queue for paravirt_ops implementation

2007-06-17 Thread Jeremy Fitzhardinge
Jeremy Fitzhardinge wrote: +static int kvm_hypercall_flush(struct kvm_vcpu *vcpu) +{ +struct kvm_hypercall_entry *queue; +struct kvm_vmca *vmca; +int ret = 0; +int i; + +queue = kmap(vcpu-queue_page); +vmca = kmap(vcpu-para_state_page); kmap_atomic? Or

Re: [kvm-devel] [PATCH 0/5] KVM paravirt_ops implementation

2007-06-17 Thread Jeremy Fitzhardinge
Anthony Liguori wrote: Hi Jeremy, Jeremy Fitzhardinge wrote: Anthony Liguori wrote: 1) Not really sure what is needed for CONFIG_PREEMPT support. I'm not sure which paravirt_ops calls are actually re-entrant. I'm not sure that has specifically come up. The main issue is whether