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

2010-03-15 Thread Avi Kivity
On 03/16/2010 02:20 AM, Jason wrote: In comparing KVM 2.6.31.6b to XenServer 5.5.0, it seems KVM has fewer overall VMREADs and VMWRITEs, but there are a lot of VMWRITEs to Host FS_SEL, Host GS_SEL, Host FS_BASE, and Host GS_BASE that don't appear in Xen. Ugh, these should definitely be elimina

[ kvm-Bugs-2971075 ] Assertion `bmdma->unit != (uint8_t)-1' failed.

2010-03-15 Thread SourceForge.net
Bugs item #2971075, was opened at 2010-03-16 07:02 Message generated for change (Tracker Item Submitted) made by zaphodbrx You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2971075&group_id=180599 Please note that this message will contain a full copy of th

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

2010-03-15 Thread Avi Kivity
On 03/16/2010 03:21 AM, Anthony Liguori wrote: On 03/15/2010 10:06 AM, Avi Kivity wrote: 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 f

Re: [PATCH] Enhance perf to collect KVM guest os statistics from host side

2010-03-15 Thread Avi Kivity
On 03/16/2010 07:27 AM, Zhang, Yanmin wrote: From: Zhang, Yanmin Based on the discussion in KVM community, I worked out the patch to support perf to collect guest os statistics from host side. This patch is implemented with Ingo, Peter and some other guys' kind help. Yang Sheng pointed out a cri

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

2010-03-15 Thread Balbir Singh
* Randy Dunlap [2010-03-15 08:46:31]: > On Mon, 15 Mar 2010 12:52:15 +0530 Balbir Singh wrote: > > Hi, > If you go ahead with this, please add the boot parameter & its description > to Documentation/kernel-parameters.txt. > I certainly will, thanks for keeping a watch. -- Three Cheer

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

2010-03-15 Thread Balbir Singh
* Chris Webb [2010-03-15 20:23:54]: > Avi Kivity writes: > > > On 03/15/2010 10:07 AM, Balbir Singh wrote: > > > > >Yes, it is a virtio call away, but is the cost of paying twice in > > >terms of memory acceptable? > > > > Usually, it isn't, which is why I recommend cache=off. > > Hi Avi. One

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

2010-03-15 Thread Anthony Liguori
On 03/15/2010 07:43 PM, Christoph Hellwig wrote: On Mon, Mar 15, 2010 at 06:43:06PM -0500, Anthony Liguori wrote: I knew someone would do this... This really gets down to your definition of "safe" behaviour. As it stands, if you suffer a power outage, it may lead to guest corruption. Whil

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

2010-03-15 Thread Anthony Liguori
On 03/15/2010 10:06 AM, Avi Kivity wrote: 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, whi

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

2010-03-15 Thread Christoph Hellwig
On Mon, Mar 15, 2010 at 06:43:06PM -0500, Anthony Liguori wrote: > I knew someone would do this... > > This really gets down to your definition of "safe" behaviour. As it > stands, if you suffer a power outage, it may lead to guest corruption. > > While we are correct in advertising a write-cach

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

2010-03-15 Thread Jason
Avi Kivity redhat.com> writes: > > On 03/15/2010 03:23 PM, Anthony Liguori wrote: > > On 03/15/2010 08:11 AM, Avi Kivity wrote: > >> Your guest wasn't doing a zillion VMREADs and VMWRITEs every exit. > >> > >> I plan to reduce VMREAD/VMWRITE overhead for kvm, but not much we can > >> do for othe

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

2010-03-15 Thread Anthony Liguori
On 03/15/2010 03:23 PM, Chris Webb wrote: Avi Kivity writes: On 03/15/2010 10:07 AM, Balbir Singh wrote: Yes, it is a virtio call away, but is the cost of paying twice in terms of memory acceptable? Usually, it isn't, which is why I recommend cache=off. Hi Avi. One

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

2010-03-15 Thread Chris Webb
Avi Kivity writes: > On 03/15/2010 10:07 AM, Balbir Singh wrote: > > >Yes, it is a virtio call away, but is the cost of paying twice in > >terms of memory acceptable? > > Usually, it isn't, which is why I recommend cache=off. Hi Avi. One observation about your recommendation for cache=none: We

Re: [PATCH] kvm: clean up assigned_device_enable_host_msix

2010-03-15 Thread Marcelo Tosatti
On Sat, Mar 13, 2010 at 03:00:45PM +0800, jing zhang wrote: > From: Jing Zhang > > Date: Sat Mar 13 14:05:27 2010 > > Cc: Avi Kivity > Signed-off-by: Jing Zhang Applied (with a better description), thanks. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a

Re: [PATCH v4 0/2] qemu-kvm: Save&restore debug registers

2010-03-15 Thread Marcelo Tosatti
On Fri, Mar 12, 2010 at 03:20:48PM +0100, Jan Kiszka wrote: > Patch 1 is for upstream and should be applied to uq/master as well, patch > 2 is for qemu-kvm only. > > Jan Kiszka (2): > KVM: x86: Add debug register saving and restoring > qemu-kvm: x86: Add support for saving&restoring debug regi

Re: [PATCH] KVM: fix the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO failure

2010-03-15 Thread Marcelo Tosatti
On Fri, Mar 12, 2010 at 12:59:06PM +0800, Wei Yongjun wrote: > This patch change the errno of ioctl KVM_[UN]REGISTER_COALESCED_MMIO > from -EINVAL to -ENXIO if no coalesced mmio dev exists. > > Signed-off-by: Wei Yongjun Applied all, thanks. -- To unsubscribe from this list: send the line "unsu

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

2010-03-15 Thread Anthony Liguori
On 03/15/2010 04:27 AM, Avi Kivity wrote: That's only beneficial if the cache is shared. Otherwise, you could use the balloon to evict cache when memory is tight. Shared cache is mostly a desktop thing where users run similar workloads. For servers, it's much less likely. So a modified-gu

nfs and db servers under kvm?

2010-03-15 Thread Mike Diehl
Hi all, I'm considering changing much of my current infrastructure so that it runs under an array of VM's. I'm wondering how well database and nfs servers run under KVM.  Should I put the data on a host filesystem, or can I put it on the guest filesystem? -- Take care and have fun, Mike Die

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

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 04:46:20PM +0100, Andre Przywara wrote: > 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

Re: [PATCH v3 00/30] emulator cleanup

2010-03-15 Thread Gleb Natapov
On Mon, Mar 15, 2010 at 04:51:35PM +0100, Andre Przywara wrote: > 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 o

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

2010-03-15 Thread Joerg Roedel
On Mon, Mar 15, 2010 at 08:14:29AM -0500, Anthony Liguori wrote: > 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, > >>

Re: [PATCH v3 00/30] emulator cleanup

2010-03-15 Thread Andre Przywara
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 now also pass where it fa

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

2010-03-15 Thread Avi Kivity
On 03/15/2010 05:46 PM, Andre Przywara wrote: 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

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

2010-03-15 Thread Randy Dunlap
On Mon, 15 Mar 2010 12:52:15 +0530 Balbir Singh wrote: > Selectively control Unmapped Page Cache (nospam version) > > From: Balbir Singh > > This patch implements unmapped page cache control via preferred > page cache reclaim. The current patch hooks into kswapd and reclaims > page cache if the

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 actua

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 ex

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 n

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

[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 --- 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(+), 7 deletions(-)

[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 --- 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 +2563,7 @@ twobyte

[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 --- 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 @@ -1508,7 +1508,7 @@ s

[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 --- 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 --- a/arch/x86/kvm/em

[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 --- 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 a/arch/x86/include/asm/kvm_emulate.h b/arch/x86

[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 --- 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 b89a8f2..46a7ee3 100

[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 --- arch/x86/kvm/emulate.c | 125 +---

[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 --- 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 100644 --- a/arch/x

[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 --- arch/x86/include/asm/kvm_emulate.h |5 + arch/x86/kvm/emulate.c | 563 2 files changed, 568 insertions(+), 0 deletions(-) diff --git a/arch/x86/includ

[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 --- 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 index 1bedbb6..541

[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 --- arch/x86/include/asm/kvm_emulate.h | 16 + arch/x86/kvm/x86.c | 130 +++--

[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 implem

[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 i

[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 --- 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 index cd0043a..1

[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 --- 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 100644 --- a/arc

[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 --- 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 @@ -2407,13 +2407,

[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 --- arch/x86/kvm/emulate.c | 66 +-

[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 --- arch/x86/include/asm/kvm_emulate.h |7 ++ arch/x86/kvm/emulate.c | 43 +++

[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 --- arch/x86/kvm/emulate.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x8

[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 kvm_emulate_

[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 --- arch/x86/include/asm/kvm_emulate.h |3 +- arch/x86/include/asm/kvm_host.h|2 - arch/x86

[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 --- arch/x86/kvm/emulate.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emu

[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 --- 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 +2520,13 @@ two

[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 --- arch/x86/kvm/emulate.c |8 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/arch/x86

[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 --- 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(-) diff --git a/arch/

[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 --- 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 --- a/arch/x86/kvm/emulate.c +++

[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 --- 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 +++ b/arch/x86/kvm

[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. ChangeLo

[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 --- 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 --- a/arch/x86/kvm/emulate.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 --- 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 --- a/arch/x86/

[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 --- arch/x86/include/asm/kvm_host.h |3 +-- arch/x86/kvm/emulate.c |3 +-- arch/x86/kvm/x86.c |4 +--- 3 file

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

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. Afte

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 mak

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

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 t

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 e

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: [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: [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 --- arch/x86/include/asm/kvm_emulate.h |1 + arch/x86/kvm

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: http://wiki.qemu.org

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 an

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 perfor

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 befor

[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 p

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 i

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: > > > > > >http://wiki.qe

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 emulati

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: [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 t

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: [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 emul

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, wh

[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

[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. Signed-off-by:

[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 non-ato

[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 trans

[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 holdin

[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 execut

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 in

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 not

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=detail&aid=2962575&group_id=180599&atid=893831 >> > > MINIX is using big real mode which is currently not well

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 sy

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 vmallo

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

2010-03-15 Thread Balbir Singh
* Avi Kivity [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 > >>mod

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 > t

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. IN

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

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" messa

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 implement

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 mecha

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

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 de

  1   2   >