Re: [PATCH 0/18][RFC] Nested Paging support for Nested SVM (aka NPT-Virtualization)

2010-03-15 Thread Marcelo Tosatti
On Fri, Mar 12, 2010 at 09:36:41AM +0200, Avi Kivity wrote: On 03/11/2010 10:58 PM, Marcelo Tosatti wrote: Can't you translate l2_gpa - l1_gpa walking the current l1 nested pagetable, and pass that to the kvm tdp fault path (with the correct context setup)? If I understand your suggestion

[PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Balbir Singh
Selectively control Unmapped Page Cache (nospam version) From: Balbir Singh bal...@linux.vnet.ibm.com This patch implements unmapped page cache control via preferred page cache reclaim. The current patch hooks into kswapd and reclaims page cache if the user has requested for unmapped page

Re: [PATCH 0/18][RFC] Nested Paging support for Nested SVM (aka NPT-Virtualization)

2010-03-15 Thread Avi Kivity
On 03/15/2010 08:27 AM, Marcelo Tosatti wrote: You should disable out of sync shadow so that l1 guest writes to l1-nested-ptables always trap. Why? The guest is under obligation to flush the tlb if it writes to a page table, and we will resync on that tlb flush. The guests

Re: [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

2010-03-15 Thread Avi Kivity
On 03/03/2010 09:12 PM, Joerg Roedel wrote: This patch implements logic to make sure that either a page-fault/page-fault-vmexit or a nested-page-fault-vmexit is propagated back to the guest. Signed-off-by: Joerg Roedeljoerg.roe...@amd.com --- arch/x86/kvm/mmu.h |1 +

Re: [PATCH v2 25/30] KVM: x86 emulator: fix in/out emulation.

2010-03-15 Thread Avi Kivity
On 03/14/2010 07:35 PM, Gleb Natapov wrote: On Sun, Mar 14, 2010 at 06:54:11PM +0200, Avi Kivity wrote: On 03/14/2010 06:21 PM, Gleb Natapov wrote: in/out emulation is broken now. The breakage is different depending on where IO device resides. If it is in userspace emulator reports

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Avi Kivity
On 03/14/2010 08:06 PM, Gleb Natapov wrote: Suggest simply reentering every N executions. This restart mechanism is, in fact, needed for ins read ahead to work. After reading ahead from IO port we need to avoid entering decoder until entire cache is consumed otherwise decoder will clear

Re: [PATCH v2 25/30] KVM: x86 emulator: fix in/out emulation.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 09:41:51AM +0200, Avi Kivity wrote: On 03/14/2010 07:35 PM, Gleb Natapov wrote: On Sun, Mar 14, 2010 at 06:54:11PM +0200, Avi Kivity wrote: On 03/14/2010 06:21 PM, Gleb Natapov wrote: in/out emulation is broken now. The breakage is different depending on where IO

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Avi Kivity
On 03/15/2010 09:22 AM, Balbir Singh wrote: Selectively control Unmapped Page Cache (nospam version) From: Balbir Singhbal...@linux.vnet.ibm.com This patch implements unmapped page cache control via preferred page cache reclaim. The current patch hooks into kswapd and reclaims page cache if

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Balbir Singh
* Avi Kivity a...@redhat.com [2010-03-15 09:48:05]: On 03/15/2010 09:22 AM, Balbir Singh wrote: Selectively control Unmapped Page Cache (nospam version) From: Balbir Singhbal...@linux.vnet.ibm.com This patch implements unmapped page cache control via preferred page cache reclaim. The

[PATCH] KVM: cleanup: change to use bool return values

2010-03-15 Thread Gui Jianfeng
Make use of bool as return valuses. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c | 72 ++-- 1 files changed, 36 insertions(+), 36 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Avi Kivity
On 03/15/2010 10:07 AM, Balbir Singh wrote: * Avi Kivitya...@redhat.com [2010-03-15 09:48:05]: On 03/15/2010 09:22 AM, Balbir Singh wrote: Selectively control Unmapped Page Cache (nospam version) From: Balbir Singhbal...@linux.vnet.ibm.com This patch implements unmapped page

Re: [PATCH] KVM: cleanup: change to use bool return values

2010-03-15 Thread Avi Kivity
On 03/15/2010 10:23 AM, Gui Jianfeng wrote: Make use of bool as return valuses. -static inline int cpu_has_vmx_tpr_shadow(void) +static inline bool cpu_has_vmx_tpr_shadow(void) { - return vmcs_config.cpu_based_exec_ctrl CPU_BASED_TPR_SHADOW; + return

Re: [PATCH] KVM: x86: Use native_store_idt() instead of kvm_get_idt()

2010-03-15 Thread Marcelo Tosatti
On Fri, Mar 05, 2010 at 12:11:48PM +0800, Wei Yongjun wrote: This patch use generic linux function native_store_idt() instead of kvm_get_idt(), and also removed the useless function kvm_get_idt(). Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com --- arch/x86/include/asm/kvm_host.h |5

Re: [RFC] Moving dirty bitmaps to userspace - Double buffering approach

2010-03-15 Thread Marcelo Tosatti
On Mon, Mar 08, 2010 at 05:22:43PM +0900, Takuya Yoshikawa wrote: Hi, I would like to hear your comments about the following plan: Moving dirty bitmaps to userspace - Double buffering approach especially I would be glad if I can hear some advice about how to keep the compatibility.

RE: [PATCH v1 2/3] Provides multiple submits and asynchronous notifications.

2010-03-15 Thread Xin, Xiaohui
+/* The structure to notify the virtqueue for async socket */ +struct vhost_notifier { +struct list_head list; +struct vhost_virtqueue *vq; +int head; +int size; +int log; +void *ctrl; +void (*dtor)(struct vhost_notifier *); +}; + So IMO, this is not the

Re: [RFC] Moving dirty bitmaps to userspace - Double buffering approach

2010-03-15 Thread Avi Kivity
On 03/15/2010 10:33 AM, Marcelo Tosatti wrote: Are there any good ways to solve this kind of problems? You can introduce a new get_dirty_log ioctl that passes the address of the next bitmap in userspace, and use it (after pinning with get_user_pages), instead of vmalloc'ing. No

Re: [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 09:36:52AM +0200, Avi Kivity wrote: On 03/03/2010 09:12 PM, Joerg Roedel wrote: This patch implements logic to make sure that either a page-fault/page-fault-vmexit or a nested-page-fault-vmexit is propagated back to the guest. Signed-off-by: Joerg

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Balbir Singh
* Avi Kivity a...@redhat.com [2010-03-15 10:27:45]: On 03/15/2010 10:07 AM, Balbir Singh wrote: * Avi Kivitya...@redhat.com [2010-03-15 09:48:05]: On 03/15/2010 09:22 AM, Balbir Singh wrote: Selectively control Unmapped Page Cache (nospam version) From: Balbir

Re: [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

2010-03-15 Thread Avi Kivity
On 03/15/2010 11:06 AM, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 09:36:52AM +0200, Avi Kivity wrote: On 03/03/2010 09:12 PM, Joerg Roedel wrote: This patch implements logic to make sure that either a page-fault/page-fault-vmexit or a nested-page-fault-vmexit is propagated back to

Re: [PATCH v1 2/3] Provides multiple submits and asynchronous notifications.

2010-03-15 Thread Michael S. Tsirkin
On Mon, Mar 15, 2010 at 04:46:50PM +0800, Xin, Xiaohui wrote: +/* The structure to notify the virtqueue for async socket */ +struct vhost_notifier { + struct list_head list; + struct vhost_virtqueue *vq; + int head; + int size; + int log; + void *ctrl; + void

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Avi Kivity
On 03/15/2010 11:17 AM, Balbir Singh wrote: * Avi Kivitya...@redhat.com [2010-03-15 10:27:45]: On 03/15/2010 10:07 AM, Balbir Singh wrote: * Avi Kivitya...@redhat.com [2010-03-15 09:48:05]: On 03/15/2010 09:22 AM, Balbir Singh wrote: Selectively control

[PATCH] KVM: Cleanup: change to use bool return values

2010-03-15 Thread Gui Jianfeng
Make use of bool as return values, and remove some useless bool value converting. Thanks Avi to point this out. Signed-off-by: Gui Jianfeng guijianf...@cn.fujitsu.com --- arch/x86/kvm/vmx.c | 54 ++-- 1 files changed, 27 insertions(+), 27

Re: [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 11:23:07AM +0200, Avi Kivity wrote: On 03/15/2010 11:06 AM, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 09:36:52AM +0200, Avi Kivity wrote: On 03/03/2010 09:12 PM, Joerg Roedel wrote: This patch implements logic to make sure that either a

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 09:44:26AM +0200, Avi Kivity wrote: On 03/14/2010 08:06 PM, Gleb Natapov wrote: Suggest simply reentering every N executions. This restart mechanism is, in fact, needed for ins read ahead to work. After reading ahead from IO port we need to avoid entering decoder

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Avi Kivity
On 03/15/2010 11:44 AM, Gleb Natapov wrote: On Mon, Mar 15, 2010 at 09:44:26AM +0200, Avi Kivity wrote: On 03/14/2010 08:06 PM, Gleb Natapov wrote: Suggest simply reentering every N executions. This restart mechanism is, in fact, needed for ins read ahead to work. After

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 11:56:32AM +0200, Avi Kivity wrote: On 03/15/2010 11:44 AM, Gleb Natapov wrote: On Mon, Mar 15, 2010 at 09:44:26AM +0200, Avi Kivity wrote: On 03/14/2010 08:06 PM, Gleb Natapov wrote: Suggest simply reentering every N executions. This restart mechanism is, in fact,

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Avi Kivity
On 03/15/2010 12:07 PM, Gleb Natapov wrote: Or we can make the buffer larger for everyone (outside this patchset though). I am not sure what do you mean here. INS read ahead and MMIO read cache are different beasts. Former is needed to speed-up string pio reads, later (not yet

Re: [PATCH 0/5] Fix some mmu/emulator atomicity issues (v2)

2010-03-15 Thread Marcelo Tosatti
On Sun, Mar 14, 2010 at 09:03:47AM +0200, Avi Kivity wrote: On 03/10/2010 04:50 PM, Avi Kivity wrote: Currently when we emulate a locked operation into a shadowed guest page table, we perform a write rather than a true atomic. This is indicated by the emulating exchange as write message that

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 12:15:22PM +0200, Avi Kivity wrote: On 03/15/2010 12:07 PM, Gleb Natapov wrote: Or we can make the buffer larger for everyone (outside this patchset though). I am not sure what do you mean here. INS read ahead and MMIO read cache are different beasts. Former is

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Avi Kivity
On 03/15/2010 12:19 PM, Gleb Natapov wrote: On Mon, Mar 15, 2010 at 12:15:22PM +0200, Avi Kivity wrote: On 03/15/2010 12:07 PM, Gleb Natapov wrote: Or we can make the buffer larger for everyone (outside this patchset though). I am not sure what do you mean here.

Re: [PATCH v2 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 12:24:43PM +0200, Avi Kivity wrote: On 03/15/2010 12:19 PM, Gleb Natapov wrote: On Mon, Mar 15, 2010 at 12:15:22PM +0200, Avi Kivity wrote: On 03/15/2010 12:07 PM, Gleb Natapov wrote: Or we can make the buffer larger for everyone (outside this patchset though). I am

Re: [PATCH][RF C/T/D] Unmapped page cache control - via boot parameter

2010-03-15 Thread Balbir Singh
* Avi Kivity a...@redhat.com [2010-03-15 11:27:56]: The knobs are for 1. Selective enablement 2. Selective control of the % of unmapped pages An alternative path is to enable KSM for page cache. Then we have direct read-only guest access to host page cache, without any guest

Re: [RFC] Moving dirty bitmaps to userspace - Double buffering approach

2010-03-15 Thread Takuya Yoshikawa
Avi Kivity wrote: On 03/15/2010 10:33 AM, Marcelo Tosatti wrote: Are there any good ways to solve this kind of problems? You can introduce a new get_dirty_log ioctl that passes the address of the next bitmap in userspace, and use it (after pinning with get_user_pages), instead of

Re: [PATCH v2 06/30] KVM: remove realmode_lmsw function.

2010-03-15 Thread Andre Przywara
Gleb Natapov wrote: Use (get|set)_cr callback to emulate lmsw inside emulator. I see that vmx.c:handle_cr() is the only other user of kvm_lmsw(). If we fix this place similar like you did below, we could get rid of kvm_lmsw() entirely. But I am not sure whether it's OK to remove an exported

Re: [long] MINIX 3.1.6 works in QEMU-0.12.3 only with KVM disabled

2010-03-15 Thread Antoine Leca
Avi Kivity wrote on 2010-03-10 13:03:25 +0200: On 03/10/2010 12:26 PM, Erik van der Kouwe wrote: I've submitted this bug report a week ago: http://sourceforge.net/tracker/?func=detailaid=2962575group_id=180599atid=893831 MINIX is using big real mode which is currently not well supported

Re: [PATCH v2 06/30] KVM: remove realmode_lmsw function.

2010-03-15 Thread Avi Kivity
On 03/15/2010 01:02 PM, Andre Przywara wrote: Gleb Natapov wrote: Use (get|set)_cr callback to emulate lmsw inside emulator. I see that vmx.c:handle_cr() is the only other user of kvm_lmsw(). If we fix this place similar like you did below, we could get rid of kvm_lmsw() entirely. But I am

Re: [PATCH 0/5] Fix some mmu/emulator atomicity issues (v2)

2010-03-15 Thread Avi Kivity
On 03/15/2010 12:16 PM, Marcelo Tosatti wrote: On Sun, Mar 14, 2010 at 09:03:47AM +0200, Avi Kivity wrote: On 03/10/2010 04:50 PM, Avi Kivity wrote: Currently when we emulate a locked operation into a shadowed guest page table, we perform a write rather than a true atomic. This is

[PATCH 5/5] KVM: MMU: Reinstate pte prefetch on invlpg

2010-03-15 Thread Avi Kivity
Commit fb341f57 removed the pte prefetch on guest invlpg, citing guest races. However, the SDM is adamant that prefetch is allowed: The processor may create entries in paging-structure caches for translations required for prefetches and for accesses that are a result of speculative

[PATCH 2/5] KVM: Make locked operations truly atomic

2010-03-15 Thread Avi Kivity
Once upon a time, locked operations were emulated while holding the mmu mutex. Since mmu pages were write protected, it was safe to emulate the writes in a non-atomic manner, since there could be no other writer, either in the guest or in the kernel. These days emulation takes place without

[PATCH 4/5] KVM: MMU: Do not instantiate nontrapping spte on unsync page

2010-03-15 Thread Avi Kivity
The update_pte() path currently uses a nontrapping spte when a nonpresent (or nonaccessed) gpte is written. This is fine since at present it is only used on sync pages. However, on an unsync page this will cause an endless fault loop as the guest is under no obligation to invlpg a gpte that

[PATCH 3/5] KVM: Don't follow an atomic operation by a non-atomic one

2010-03-15 Thread Avi Kivity
Currently emulated atomic operations are immediately followed by a non-atomic operation, so that kvm_mmu_pte_write() can be invoked. This updates the mmu but undoes the whole point of doing things atomically. Fix by only performing the atomic operation and the mmu update, and avoiding the

[PATCH 1/5] KVM: MMU: Consolidate two guest pte reads in kvm_mmu_pte_write()

2010-03-15 Thread Avi Kivity
kvm_mmu_pte_write() reads guest ptes in two different occasions, both to allow a 32-bit pae guest to update a pte with 4-byte writes. Consolidate these into a single read, which also allows us to consolidate another read from an invlpg speculating a gpte into the shadow page table.

[PATCH 0/5] Fix some mmu/emulator atomicity issues (v2)

2010-03-15 Thread Avi Kivity
Currently when we emulate a locked operation into a shadowed guest page table, we perform a write rather than a true atomic. This is indicated by the emulating exchange as write message that shows up in dmesg. In addition, the pte prefetch operation during invlpg suffered from a race. This was

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Avi Kivity
On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well: http://wiki.qemu.org/Google_Summer_of_Code_2010 I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests,

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well: http://wiki.qemu.org/Google_Summer_of_Code_2010 I will add another project - iommu emulation. Could

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Avi Kivity
On 03/15/2010 02:38 PM, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well: http://wiki.qemu.org/Google_Summer_of_Code_2010

Re: [long] MINIX 3.1.6 works in QEMU-0.12.3 only with KVM disabled

2010-03-15 Thread Avi Kivity
On 03/15/2010 12:54 PM, Antoine Leca wrote: When doing switch, the cached segment selectors are preserved, which allows one to use protected mode segments in real-address mode (this is called unreal mode). Now this is a by-product of the implementation inside the BIOS. In fact, even if

Re: [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 04:30:47AM +, Daniel K. wrote: Joerg Roedel wrote: diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2883ce8..9f8b02d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -314,6 +314,19 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu,

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Muli Ben-Yehuda
On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well: http://wiki.qemu.org/Google_Summer_of_Code_2010 I will add another project - iommu emulation. Could

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 05:53:13AM -0700, Muli Ben-Yehuda wrote: On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well:

Re: [PATCH v2 05/30] KVM: Provide callback to get/set control registers in emulator ops.

2010-03-15 Thread Andre Przywara
Gleb Natapov wrote: Use this callback instead of directly call kvm function. Also rename realmode_(set|get)_cr to emulator_(set|get)_cr since function has nothing to do with real mode. Do you mind removing the static before emulator_{set,get}_cr and marking it EXPORT_SYMBOL? Then one could use

[PATCH rework] KVM: coalesced_mmio: fix kvm_coalesced_mmio_init()'s error handling

2010-03-15 Thread Takuya Yoshikawa
kvm_coalesced_mmio_init() keeps to hold the addresses of a coalesced mmio ring page and dev even after it has freed them. Also, if this function fails, though it might be rare, it seems to be suggesting the system's serious state: so we'd better stop the works following the kvm_creat_vm(). This

Re: [PATCH v2 05/30] KVM: Provide callback to get/set control registers in emulator ops.

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 02:06:48PM +0100, Andre Przywara wrote: Gleb Natapov wrote: Use this callback instead of directly call kvm function. Also rename realmode_(set|get)_cr to emulator_(set|get)_cr since function has nothing to do with real mode. Do you mind removing the static before

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Avi Kivity
On 03/15/2010 03:03 PM, Joerg Roedel wrote: I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests, which could make testing a lot easier. Our experiments show that nested device assignment is pretty much required for I/O

Re: [PATCH v2 05/30] KVM: Provide callback to get/set control registers in emulator ops.

2010-03-15 Thread Avi Kivity
On 03/15/2010 03:06 PM, Andre Przywara wrote: Gleb Natapov wrote: Use this callback instead of directly call kvm function. Also rename realmode_(set|get)_cr to emulator_(set|get)_cr since function has nothing to do with real mode. Do you mind removing the static before emulator_{set,get}_cr

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Anthony Liguori
On 03/15/2010 07:42 AM, Avi Kivity wrote: On 03/15/2010 02:38 PM, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer of Code 2010 is doing quite well:

Re: [PATCH v2 07/30] KVM: Provide x86_emulate_ctxt callback to get current cpl

2010-03-15 Thread Andre Przywara
Gleb, what is the purpose of this patch? Is this a preparation for something upcoming? I don't see a reason to change this, in my eyes it is not a simplification. Regards, Andre. Gleb Natapov wrote: Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |1

Re: [PATCH v2 07/30] KVM: Provide x86_emulate_ctxt callback to get current cpl

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 02:16:01PM +0100, Andre Przywara wrote: Gleb, what is the purpose of this patch? Is this a preparation for something upcoming? I don't see a reason to change this, in my eyes it is not a simplification. To make emulator independent of KVM. All direct calls from

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Anthony Liguori
On 03/15/2010 08:11 AM, Avi Kivity wrote: On 03/15/2010 03:03 PM, Joerg Roedel wrote: I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests, which could make testing a lot easier. Our experiments show that nested device assignment is

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 03:11:42PM +0200, Avi Kivity wrote: On 03/15/2010 03:03 PM, Joerg Roedel wrote: I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests, which could make testing a lot easier. Our experiments show that

Fwd: Corrupted filesystem, possible after livemigration with iSCSI storagebackend.

2010-03-15 Thread Espen Berg
In our KVM system we have two iSCSI backends (master/slave configuration) with failover and two KVM hosts supporting live migration. The iSCSI volumes are shared by the host as a block device in KVM, and the volumes are available on both frontends. After a reboot one of the KVMs where not able

Re: how to tweak kernel to get the best out of kvm?

2010-03-15 Thread Harald Dunkel
On 03/13/10 09:54, Avi Kivity wrote: If the slowdown is indeed due to I/O, LVM (with cache=off) should eliminate it completely. As promised I have installed LVM: The difference is remarkable. My test case (running 8 vhosts in parallel, each building a Linux kernel) just works. There is no

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Anthony Liguori
On 03/15/2010 08:24 AM, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 03:11:42PM +0200, Avi Kivity wrote: On 03/15/2010 03:03 PM, Joerg Roedel wrote: I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests, which could

Re: Fwd: Corrupted filesystem, possible after livemigration with iSCSI storagebackend.

2010-03-15 Thread Anthony Liguori
On 03/15/2010 08:46 AM, Espen Berg wrote: In our KVM system we have two iSCSI backends (master/slave configuration) with failover and two KVM hosts supporting live migration. The iSCSI volumes are shared by the host as a block device in KVM, and the volumes are available on both frontends.

Re: Fwd: Corrupted filesystem, possible after livemigration with iSCSI storagebackend.

2010-03-15 Thread Daniel P. Berrange
On Mon, Mar 15, 2010 at 08:59:10AM -0500, Anthony Liguori wrote: On 03/15/2010 08:46 AM, Espen Berg wrote: In our KVM system we have two iSCSI backends (master/slave configuration) with failover and two KVM hosts supporting live migration. The iSCSI volumes are shared by the host as a block

[PATCH v3 04/30] KVM: Remove pointer to rflags from realmode_set_cr parameters.

2010-03-15 Thread Gleb Natapov
Mov reg, cr instruction doesn't change flags in any meaningful way, so no need to update rflags after instruction execution. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_host.h |3 +-- arch/x86/kvm/emulate.c |3 +-- arch/x86/kvm/x86.c |

[PATCH v3 03/30] KVM: x86 emulator: check return value against correct define

2010-03-15 Thread Gleb Natapov
Check return value against correct define instead of open code the value. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 4dce805..670ca8f 100644

[PATCH v3 01/30] KVM: x86 emulator: Fix DstAcc decoding.

2010-03-15 Thread Gleb Natapov
Set correct operation length. Add RAX (64bit) handling. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2832a8c..0b70a36 100644 ---

[PATCH v3 00/30] emulator cleanup

2010-03-15 Thread Gleb Natapov
This is the first series of patches that tries to cleanup emulator code. This is mix of bug fixes and moving code that does emulation from x86.c to emulator.c while making it KVM independent. The status of the patches: works for me. realtime.flat test now also pass where it failed before.

[PATCH v3 10/30] KVM: x86 emulator: fix 0f 01 /5 emulation

2010-03-15 Thread Gleb Natapov
It is undefined and should generate #UD. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index c3b9334..7c7debb 100644 --- a/arch/x86/kvm/emulate.c

[PATCH v3 06/30] KVM: remove realmode_lmsw function.

2010-03-15 Thread Gleb Natapov
Use (get|set)_cr callback to emulate lmsw inside emulator. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_host.h |2 -- arch/x86/kvm/emulate.c |4 ++-- arch/x86/kvm/x86.c |7 --- 3 files changed, 2 insertions(+), 11 deletions(-)

[PATCH v3 09/30] KVM: x86 emulator: fix mov r/m, sreg emulation.

2010-03-15 Thread Gleb Natapov
mov r/m, sreg generates #UD ins sreg is incorrect. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2c27aa4..c3b9334 100644 ---

[PATCH v3 11/30] KVM: x86 emulator: 0f (20|21|22|23) ignore mod bits.

2010-03-15 Thread Gleb Natapov
Resent spec says that for 0f (20|21|22|23) the 2 bits in the mod field are ignored. Interestingly enough older spec says that 11 is only valid encoding. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff

[PATCH v3 12/30] KVM: x86 emulator: inject #UD on access to non-existing CR

2010-03-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index fa4604e..836e97b 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2520,6

[PATCH v3 14/30] KVM: x86 emulator: fix return values of syscall/sysenter/sysexit emulations

2010-03-15 Thread Gleb Natapov
Return X86EMUL_PROPAGATE_FAULT is fault was injected. Also inject #UD for those instruction when appropriate. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/emulate.c

[PATCH v3 05/30] KVM: Provide callback to get/set control registers in emulator ops.

2010-03-15 Thread Gleb Natapov
Use this callback instead of directly call kvm function. Also rename realmode_(set|get)_cr to emulator_(set|get)_cr since function has nothing to do with real mode. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |3 +- arch/x86/include/asm/kvm_host.h|

[PATCH v3 25/30] KVM: x86 emulator: fix in/out emulation.

2010-03-15 Thread Gleb Natapov
in/out emulation is broken now. The breakage is different depending on where IO device resides. If it is in userspace emulator reports emulation failure since it incorrectly interprets kvm_emulate_pio() return value. If IO device is in the kernel emulation of 'in' will do nothing since

[PATCH v3 17/30] KVM: x86 emulator: cleanup grp3 return value

2010-03-15 Thread Gleb Natapov
When x86_emulate_insn() does not know how to emulate instruction it exits via cannot_emulate label in all cases except when emulating grp3. Fix that. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff

[PATCH v3 29/30] KVM: x86 emulator: introduce pio in string read ahead.

2010-03-15 Thread Gleb Natapov
To optimize rep ins instruction do IO in big chunks ahead of time instead of doing it only when required during instruction emulation. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |7 ++ arch/x86/kvm/emulate.c | 43

[PATCH v3 22/30] KVM: x86 emulator: populate OP_MEM operand during decoding.

2010-03-15 Thread Gleb Natapov
All struct operand fields are initialized during decoding for all operand types except OP_MEM, but there is no reason for that. Move OP_MEM operand initialization into decoding stage for consistency. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 66

[PATCH v3 24/30] KVM: x86 emulator: during rep emulation decrement ECX only if emulation succeeded

2010-03-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 15 --- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 6ebd642..a166235 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@

[PATCH v3 21/30] KVM: Use task switch from emulator.c

2010-03-15 Thread Gleb Natapov
Remove old task switch code from x86.c Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86.c | 557 ++-- 1 files changed, 17 insertions(+), 540 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 2ef83db..7d1b481

[PATCH v3 30/30] KVM: small kvm_arch_vcpu_ioctl_run() cleanup.

2010-03-15 Thread Gleb Natapov
Unify all conditions that get us back into emulator after returning from userspace. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86.c | 32 ++-- 1 files changed, 6 insertions(+), 26 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c

[PATCH v3 28/30] KVM: x86 emulator: restart string instruction without going back to a guest.

2010-03-15 Thread Gleb Natapov
Currently when string instruction is only partially complete we go back to a guest mode, guest tries to reexecute instruction and exits again and at this point emulation continues. Avoid all of this by restarting instruction without going back to a guest mode, but return to a guest mode each 1024

[PATCH v3 26/30] KVM: x86 emulator: Move string pio emulation into emulator.c

2010-03-15 Thread Gleb Natapov
Currently emulation is done outside of emulator so things like doing ins/outs to/from mmio are broken it also makes it hard (if not impossible) to implement single stepping in the future. The implementation in this patch is not efficient since it exits to userspace for each IO while previous

[PATCH v3 18/30] KVM: x86 emulator: Provide more callbacks for x86 emulator.

2010-03-15 Thread Gleb Natapov
Provide get_cached_descriptor(), set_cached_descriptor(), get_segment_selector(), set_segment_selector(), get_gdt(), write_std() callbacks. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h | 16 + arch/x86/kvm/x86.c | 130

[PATCH v3 27/30] KVM: x86 emulator: remove saved_eip

2010-03-15 Thread Gleb Natapov
c-eip is never written back in case of emulation failure, so no need to set it to old value. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |9 + 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c

[PATCH v3 19/30] KVM: x86 emulator: Emulate task switch in emulator.c

2010-03-15 Thread Gleb Natapov
Implement emulation of 16/32 bit task switch in emulator.c Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |5 + arch/x86/kvm/emulate.c | 563 2 files changed, 568 insertions(+), 0 deletions(-) diff --git

[PATCH v3 02/30] KVM: x86 emulator: fix RCX access during rep emulation

2010-03-15 Thread Gleb Natapov
During rep emulation access length to RCX depends on current address mode. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 0b70a36..4dce805

[PATCH v3 16/30] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory.

2010-03-15 Thread Gleb Natapov
If LOCK prefix is used dest arg should be memory, otherwise instruction should generate #UD. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index

[PATCH v3 23/30] KVM: x86 emulator: add decoding of X,Y parameters from Intel SDM

2010-03-15 Thread Gleb Natapov
Add decoding of X,Y parameters from Intel SDM which are used by string instruction to specify source and destination. Use this new decoding to implement movs, cmps, stos, lods in a generic way. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 125

[PATCH v3 07/30] KVM: Provide x86_emulate_ctxt callback to get current cpl

2010-03-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |1 + arch/x86/kvm/emulate.c | 15 --- arch/x86/kvm/x86.c |6 ++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git

[PATCH v3 13/30] KVM: x86 emulator: fix mov dr to inject #UD when needed.

2010-03-15 Thread Gleb Natapov
If CR4.DE=1 access to registers DR4/DR5 cause #UD. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 18 -- 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 836e97b..5afddcf 100644 ---

[PATCH v3 08/30] KVM: Provide current eip as part of emulator context.

2010-03-15 Thread Gleb Natapov
Eliminate the need to call back into KVM to get it from emulator. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |3 ++- arch/x86/kvm/emulate.c | 12 ++-- arch/x86/kvm/x86.c |1 + 3 files changed, 9 insertions(+),

[PATCH v3 20/30] KVM: x86 emulator: Use load_segment_descriptor() instead of kvm_load_segment_descriptor()

2010-03-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index db4776c..702bfff 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@

[PATCH v3 15/30] KVM: x86 emulator: do not call writeback if msr access fails.

2010-03-15 Thread Gleb Natapov
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/emulate.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 1393bf0..b89a8f2 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2563,7

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Muli Ben-Yehuda
On Mon, Mar 15, 2010 at 02:03:11PM +0100, Joerg Roedel wrote: On Mon, Mar 15, 2010 at 05:53:13AM -0700, Muli Ben-Yehuda wrote: On Mon, Mar 15, 2010 at 02:25:41PM +0200, Avi Kivity wrote: On 03/10/2010 11:30 PM, Luiz Capitulino wrote: Hi there, Our wiki page for the Summer

Re: [PATCH v3 00/30] emulator cleanup

2010-03-15 Thread Avi Kivity
On 03/15/2010 04:38 PM, Gleb Natapov wrote: This is the first series of patches that tries to cleanup emulator code. This is mix of bug fixes and moving code that does emulation from x86.c to emulator.c while making it KVM independent. The status of the patches: works for me. realtime.flat test

Re: [Qemu-devel] Ideas wiki for GSoC 2010

2010-03-15 Thread Avi Kivity
On 03/15/2010 03:23 PM, Anthony Liguori wrote: On 03/15/2010 08:11 AM, Avi Kivity wrote: On 03/15/2010 03:03 PM, Joerg Roedel wrote: I will add another project - iommu emulation. Could be very useful for doing device assignment to nested guests, which could make testing a lot easier. Our

Re: [PATCH v3 16/30] KVM: x86 emulator: If LOCK prefix is used dest arg should be memory.

2010-03-15 Thread Andre Przywara
Gleb Natapov wrote: If LOCK prefix is used dest arg should be memory, otherwise instruction should generate #UD. Well, there is one exception: There is an AMD specific lock mov cr0 = mov cr8 equivalence, where there is no memory involved (and we intercept this). I am not sure if anyone

  1   2   >