[ANNOUNCE] kvm-kmod-2.6.34-rc3

2010-04-15 Thread Jan Kiszka
Here is a preview on the next stable kvm-kmod series based on 2.6.34. There are currently no pending patches in the related kernel queue, so you may want to give this a try. It should be close to final 2.6.34. To recall the major contributions (as Avi summarized them): - rdtscp support - much

[PATCH] KVM-test: Add a subtest 'qemu_img' v3

2010-04-15 Thread Lucas Meneghel Rodrigues
This is designed to test all subcommands of 'qemu-img' however so far 'commit' is not implemented. * For 'check' subcommand test, it will 'dd' to create a file with specified size and see whether it's supported to be checked. Then convert it to be supported formats ('qcow2' and 'raw' so far) to

Re: [Autotest] [PATCH] [Autotest PATCH v2] KVM-test: Add a subtest 'qemu_img'

2010-04-15 Thread Lucas Meneghel Rodrigues
On Wed, Mar 31, 2010 at 4:23 AM, Yolkfull Chow yz...@redhat.com wrote: This is designed to test all subcommands of 'qemu-img' however so far 'commit' is not implemented. * For 'check' subcommand test, it will 'dd' to create a file with specified size and see whether it's supported to be

Timedrift in KVM guests after livemigration.

2010-04-15 Thread Espen Berg
We have three KVM hosts that supports live-migration between them, but one of our problems is time drifting. The three frontends has different CPU frequency and the KVM guests adopt the frequency from the host machine where it was first started. Host1: cat /proc/cpuinfo model name :

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

2010-04-15 Thread Avi Kivity
On 04/15/2030 04:04 AM, Zhang, Yanmin wrote: An even more accurate way to determine this is to check whether the interrupt frame points back at the 'int $2' instruction. However we plan to switch to a self-IPI method to inject the NMI, and I'm not sure wether APIC NMIs are accepted on an

Re: VM performance issue in KVM guests.

2010-04-15 Thread Avi Kivity
On 04/15/2010 07:58 AM, Srivatsa Vaddagiri wrote: On Sun, Apr 11, 2010 at 11:40 PM, Avi Kivity a...@redhat.com mailto:a...@redhat.com wrote: The current handing of PLE is very suboptimal. With proper directed yield we should be much better there. Hi Avi, By directed

Re: [PATCH v4 3/3] Inter-VM shared memory PCI device

2010-04-15 Thread Avi Kivity
On 04/15/2010 02:30 AM, Cam Macdonell wrote: Sample programs, init scripts and the shared memory server are available in a git repo here: www.gitorious.org/nahanni Please consider qemu.git/contrib. Should the compilation be tied into Qemu's regular build with a switch

Re: KVM: x86: Push potential exception error code on task switches

2010-04-15 Thread Avi Kivity
On 04/14/2010 04:19 PM, Jan Kiszka wrote: Avi Kivity wrote: On 04/14/2010 03:58 PM, Jan Kiszka wrote: The TSS descriptor (gate doesn't have a size). But isn't it possible to have a 32-bit TSS with a 16-bit CS/SS? Might be possible, but will cause troubles as the spec

Re: KVM: x86: Push potential exception error code on task switches

2010-04-15 Thread Jan Kiszka
Avi Kivity wrote: On 04/14/2010 04:19 PM, Jan Kiszka wrote: Avi Kivity wrote: On 04/14/2010 03:58 PM, Jan Kiszka wrote: The TSS descriptor (gate doesn't have a size). But isn't it possible to have a 32-bit TSS with a 16-bit CS/SS? Might be possible, but will cause

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

2010-04-15 Thread Zhang, Yanmin
On Thu, 2010-04-15 at 11:05 +0300, Avi Kivity wrote: On 04/15/2030 04:04 AM, Zhang, Yanmin wrote: An even more accurate way to determine this is to check whether the interrupt frame points back at the 'int $2' instruction. However we plan to switch to a self-IPI method to inject the NMI,

RE: [RFC][PATCH v3 1/3] A device for zero-copy based on KVM virtio-net.

2010-04-15 Thread Xin, Xiaohui
Arnd, From: Xin Xiaohui xiaohui@intel.com Add a device to utilize the vhost-net backend driver for copy-less data transfer between guest FE and host NIC. It pins the guest user space to the host memory and provides proto_ops as sendmsg/recvmsg to vhost-net. Sorry for taking so long

Re: [PATCH] KVM: MMU: Replace role.glevels with role.cr4_pae

2010-04-15 Thread Avi Kivity
On 04/14/2010 09:29 PM, Marcelo Tosatti wrote: On Wed, Apr 14, 2010 at 07:32:12PM +0300, Avi Kivity wrote: On 04/14/2010 07:20 PM, Avi Kivity wrote: There is no real distinction between glevels=3 and glevels=4; both have exactly the same format and the code is treated exactly the

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

2010-04-15 Thread oerg Roedel
On Mon, Apr 15, 2030 at 04:57:38PM +0800, Zhang, Yanmin wrote: I checked svm.c and it seems svm.c doesn't trigger a NMI to host if the NMI happens in guest os. In addition, svm_complete_interrupts is called after interrupt is enabled. Yes. The NMI is held pending by the hardware until the

Re: [RFC][PATCH v3 1/3] A device for zero-copy based on KVM virtio-net.

2010-04-15 Thread Michael S. Tsirkin
On Thu, Apr 15, 2010 at 05:01:10PM +0800, Xin, Xiaohui wrote: It smells like a layering violation to look at the iocb-private field from a lower-level driver. I would have hoped that it's possible to implement this without having this driver know about the higher-level vhost driver internals.

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

2010-04-15 Thread Avi Kivity
On 04/15/2010 12:04 PM, oerg Roedel wrote: On Mon, Apr 15, 2030 at 04:57:38PM +0800, Zhang, Yanmin wrote: I checked svm.c and it seems svm.c doesn't trigger a NMI to host if the NMI happens in guest os. In addition, svm_complete_interrupts is called after interrupt is enabled. Yes.

[PATCH] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Gleb Natapov
kvm_task_switch() never requires userspace exit, so no matter what the function returns we should not exit to userspace. Signed-off-by: Gleb Natapov g...@redhat.com diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c773a46..1bd434b 100644 --- a/arch/x86/kvm/svm.c +++

RE: [RFC][PATCH v2 0/3] Provide a zero-copy method on KVM virtio-net.

2010-04-15 Thread Xin, Xiaohui
Michael, The idea is simple, just to pin the guest VM user space and then let host NIC driver has the chance to directly DMA to it. The patches are based on vhost-net backend driver. We add a device which provides proto_ops as sendmsg/recvmsg to vhost-net to send/recv directly to/from the

Re: [PATCH] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Avi Kivity
On 04/15/2010 12:28 PM, Gleb Natapov wrote: kvm_task_switch() never requires userspace exit, so no matter what the function returns we should not exit to userspace. Signed-off-by: Gleb Natapovg...@redhat.com diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c773a46..1bd434b 100644 ---

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

2010-04-15 Thread oerg Roedel
On Thu, Apr 15, 2010 at 12:09:28PM +0300, Avi Kivity wrote: On 04/15/2010 12:04 PM, oerg Roedel wrote: On Mon, Apr 15, 2030 at 04:57:38PM +0800, Zhang, Yanmin wrote: I checked svm.c and it seems svm.c doesn't trigger a NMI to host if the NMI happens in guest os. In addition,

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

2010-04-15 Thread Avi Kivity
On 04/15/2010 12:44 PM, oerg Roedel wrote: So, we'd need something like the following: if (exit == NMI) __get_cpu_var(nmi_vcpu) = vcpu; stgi(); if (exit == NMI) { while (!nmi_handled()) cpu_relax(); __get_cpu_var(nmi_vcpu) = NULL; }

Re: kvm autotest, how to disable address cache

2010-04-15 Thread Michael Goldish
On 04/08/2010 11:53 PM, Ryan Harper wrote: Is there any way to disable this? I'm running a guest on -net user networking, no interaction with the host network, yet, during the test, I get tons of: 15:50:48 DEBUG| (address cache) Adding cache entry: 00:1a:64:39:04:91 --- 10.0.253.16

[PATCHv2] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Gleb Natapov
If kvm_task_switch() fails code exits to userspace without specifying exit reason, so the previous exit reason is reused by userspace. Fix this by specifying exit reason correctly. --- Changelog: v1-v2: - report emulation error to userspace instead of ignoring it silently. Should be

Re: [RFC][PATCH v2 0/3] Provide a zero-copy method on KVM virtio-net.

2010-04-15 Thread Michael S. Tsirkin
On Thu, Apr 15, 2010 at 05:36:07PM +0800, Xin, Xiaohui wrote: Michael, The idea is simple, just to pin the guest VM user space and then let host NIC driver has the chance to directly DMA to it. The patches are based on vhost-net backend driver. We add a device which provides proto_ops

Re: [PATCHv2] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Avi Kivity
On 04/15/2010 01:09 PM, Gleb Natapov wrote: If kvm_task_switch() fails code exits to userspace without specifying exit reason, so the previous exit reason is reused by userspace. Fix this by specifying exit reason correctly. --- Changelog: v1-v2: - report emulation error to userspace

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

2010-04-15 Thread Joerg Roedel
On Thu, Apr 15, 2010 at 12:48:09PM +0300, Avi Kivity wrote: On 04/15/2010 12:44 PM, oerg Roedel wrote: So, we'd need something like the following: if (exit == NMI) __get_cpu_var(nmi_vcpu) = vcpu; stgi(); if (exit == NMI) { while (!nmi_handled())

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

2010-04-15 Thread Avi Kivity
On 04/15/2010 01:40 PM, Joerg Roedel wrote: That means an NMI that happens outside guest code (for example, in the mmu, or during the exit itself) would be counted as if in guest code. Hmm, true. The same is true for an NMI that happens between VMSAVE and STGI but that window is

TCM_Loop virtual SAS Ports + megasas HBA emulation into Linux Guests

2010-04-15 Thread Nicholas A. Bellinger
Greetings Hannes, Christoph and Co, So after some additional discussions on and off the linux-scsi list wrt to KVM + megasas emulation, I got motivated and decided to try it out for myself using the QEMU code from Gerd's tree at: http://repo.or.cz/w/qemu/kraxel.git branch: scsi.v9. As expected

[PATCH v2 1/5] KVM MMU: remove unused struct

2010-04-15 Thread Xiao Guangrong
Remove 'struct kvm_unsync_walk' since it's not used Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/kvm/mmu.c |5 - 1 files changed, 0 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b44380b..a23ca75 100644 ---

[PATCH v2 2/5] KVM MMU: fix kvm_mmu_zap_page() and its calling path

2010-04-15 Thread Xiao Guangrong
- calculate zapped page number properly in mmu_zap_unsync_children() - calculate freeed page number properly kvm_mmu_change_mmu_pages() Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 12 1 files changed, 8 insertions(+), 4 deletions(-) diff

[PATCH v2 3/5] KVM MMU: cleanup for restart hlist walking

2010-04-15 Thread Xiao Guangrong
Quote from Avi: |Just change the assignment to a 'goto restart;' please, |I don't like playing with list_for_each internals. Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 15 ++- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git

[PATCH v2 4/5] KVM MMU: smaller reduce 'struct kvm_mmu_page' size

2010-04-15 Thread Xiao Guangrong
define 'multimapped' as 'bool' Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/include/asm/kvm_host.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 0c49c88..cace232

[PATCH v2 5/5] KVM MMU: remove unused parameter in mmu_parent_walk()

2010-04-15 Thread Xiao Guangrong
'vcpu' is unused, remove it Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 24 +++- 1 files changed, 11 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index a32c60c..2f8ae9e 100644 ---

Re: VM performance issue in KVM guests.

2010-04-15 Thread Peter Zijlstra
On Thu, 2010-04-15 at 11:18 +0300, Avi Kivity wrote: Certainly that has even greater potential for Linux guests. Note that we spin on mutexes now, so we need to prevent preemption while the lock owner is running. either that, or disable spinning on (para) virt kernels. Para virt kernels

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

2010-04-15 Thread Sheng Yang
On Thursday 15 April 2010 18:44:15 Avi Kivity wrote: On 04/15/2010 01:40 PM, Joerg Roedel wrote: That means an NMI that happens outside guest code (for example, in the mmu, or during the exit itself) would be counted as if in guest code. Hmm, true. The same is true for an NMI that happens

Re: [RFC][PATCH v3 1/3] A device for zero-copy based on KVM virtio-net.

2010-04-15 Thread Arnd Bergmann
On Thursday 15 April 2010, Xin, Xiaohui wrote: It seems that you are duplicating a lot of functionality that is already in macvtap. I've asked about this before but then didn't look at your newer versions. Can you explain the value of introducing another interface to user land? I'm still

Re: [Autotest] [PATCH] KVM test: Memory ballooning test for KVM guest

2010-04-15 Thread pradeep
Hi Lucas Please ignore my earlier patch Find the correct patch with the suggested changes. --SP diff -purN autotest/client/tests/kvm/tests/balloon_check.py autotest-new/client/tests/kvm/tests/balloon_check.py --- autotest/client/tests/kvm/tests/balloon_check.py1969-12-31

Question on copy paste

2010-04-15 Thread Stephen Liu
Hi folks, host - Debian 5.04 What will the easy way to enable copy_and_paste function between guest and hosts? Also among guests. TIA B.R. Stephen L Send instant messages to your online friends http://uk.messenger.yahoo.com -- To unsubscribe from this list: send the line unsubscribe kvm

Re: Question on copy paste

2010-04-15 Thread Amit Shah
On (Thu) Apr 15 2010 [08:45:23], Stephen Liu wrote: Hi folks, host - Debian 5.04 What will the easy way to enable copy_and_paste function between guest and hosts? Also among guests. TIA This doesn't exist yet, but something should be available in a few months. Amit --

Re: Question on copy paste

2010-04-15 Thread Stephen Liu
- Original Message From: Amit Shah amit.s...@redhat.com To: Stephen Liu sati...@yahoo.com Cc: kvm@vger.kernel.org Sent: Thu, April 15, 2010 9:02:53 AM Subject: Re: Question on copy paste On (Thu) Apr 15 2010 [08:45:23], Stephen Liu wrote: Hi folks, host - Debian 5.04 What will

Re: VM performance issue in KVM guests.

2010-04-15 Thread Srivatsa Vaddagiri
On Thu, Apr 15, 2010 at 03:33:18PM +0200, Peter Zijlstra wrote: On Thu, 2010-04-15 at 11:18 +0300, Avi Kivity wrote: Certainly that has even greater potential for Linux guests. Note that we spin on mutexes now, so we need to prevent preemption while the lock owner is running.

Re: [PATCHv2] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Marcelo Tosatti
On Thu, Apr 15, 2010 at 01:09:05PM +0300, Gleb Natapov wrote: If kvm_task_switch() fails code exits to userspace without specifying exit reason, so the previous exit reason is reused by userspace. Fix this by specifying exit reason correctly. --- Changelog: v1-v2: - report

Re: [PATCH] KVM: MMU: Replace role.glevels with role.cr4_pae

2010-04-15 Thread Marcelo Tosatti
On Wed, Apr 14, 2010 at 07:20:03PM +0300, Avi Kivity wrote: There is no real distinction between glevels=3 and glevels=4; both have exactly the same format and the code is treated exactly the same way. Drop role.glevels and replace is with role.cr4_pae (which is meaningful). This simplifies

Re: [PATCH] kvm test: Add 32-bit task switch micro-test

2010-04-15 Thread Marcelo Tosatti
On Wed, Apr 14, 2010 at 04:12:46PM +0200, Jan Kiszka wrote: This implements a basic task switch test for 32-bit targets. It specifically stresses the case that a fault with attached error code triggers the switch via a task gate. Signed-off-by: Jan Kiszka jan.kis...@siemens.com Applied,

Re: [PATCH v2 2/2] KVM: x86: Push potential exception error code on task switches

2010-04-15 Thread Marcelo Tosatti
On Wed, Apr 14, 2010 at 03:51:09PM +0200, Jan Kiszka wrote: When a fault triggers a task switch, the error code, if existent, has to be pushed on the new task's stack. Implement the missing bits. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- Changes in v2: - push writeback into

Re: [PATCH v2 2/5] KVM MMU: fix kvm_mmu_zap_page() and its calling path

2010-04-15 Thread Marcelo Tosatti
On Fri, Apr 16, 2010 at 09:25:03PM +0800, Xiao Guangrong wrote: - calculate zapped page number properly in mmu_zap_unsync_children() - calculate freeed page number properly kvm_mmu_change_mmu_pages() Signed-off-by: Xiao Guangrong xiaoguangr...@cn.fujitsu.com --- arch/x86/kvm/mmu.c | 12

Re: [PATCHv2 REBASE] KVM: prevent spurious exit to userspace during task switch emulation.

2010-04-15 Thread Gleb Natapov
If kvm_task_switch() fails code exits to userspace without specifying exit reason, so the previous exit reason is reused by userspace. Fix this by specifying exit reason correctly. --- Changelog: v1-v2: - report emulation error to userspace instead of ignoring it silently. Signed-off-by: Gleb

[PATCH 4/5] export new cpuid KVM_CAP

2010-04-15 Thread Glauber Costa
Since we're changing the msrs kvmclock uses, we have to communicate that to the guest, through cpuid. We can add a new KVM_CAP to the hypervisor, and then patch userspace to recognize it. And if we ever add a new cpuid bit in the future, we have to do that again, which create some complexity and

[PATCH 0/5] pv clock misc fixes

2010-04-15 Thread Glauber Costa
Hello folks, In this series, I present a couple of fixes for kvmclock. In patch 1, a guest-side fix is proposed for a problem that is biting us for quite a while now. the tsc inside VMs does not seem to be that good, (up to now, only single-socket nehalems were stable enough), and we're seeing

[PATCH 2/5] change msr numbers for kvmclock

2010-04-15 Thread Glauber Costa
Avi pointed out a while ago that those MSRs falls into the pentium PMU range. So the idea here is to add new ones, and after a while, deprecate the old ones. Signed-off-by: Glauber Costa glom...@redhat.com --- arch/x86/include/asm/kvm_para.h |8 ++-- arch/x86/kvm/x86.c |

[PATCH 1/5] Add a global synchronization point for pvclock

2010-04-15 Thread Glauber Costa
In recent stress tests, it was found that pvclock-based systems could seriously warp in smp systems. Using ingo's time-warp-test.c, I could trigger a scenario as bad as 1.5mi warps a minute in some systems. (to be fair, it wasn't that bad in most of them). Investigating further, I found out that

[PATCH 5/5] add documentation about kvmclock

2010-04-15 Thread Glauber Costa
This patch adds a new file, kvm/kvmclock.txt, describing the mechanism we use in kvmclock. Signed-off-by: Glauber Costa glom...@redhat.com --- Documentation/kvm/kvmclock.txt | 138 1 files changed, 138 insertions(+), 0 deletions(-) create mode 100644

[PATCH 3/5] Try using new kvm clock msrs

2010-04-15 Thread Glauber Costa
We now added a new set of clock-related msrs in replacement of the old ones. In theory, we could just try to use them and get a return value indicating they do not exist, due to our use of kvm_write_msr_save. However, kvm clock registration happens very early, and if we ever try to write to a

KVM autotest: add boot_savevm test

2010-04-15 Thread Marcelo Tosatti
This test boots a guest while periodically running savevm/loadvm. Adjust savevm_delay/guest memory size to reduce run time, if excessive. Signed-off-by: Marcelo Tosatti mtosa...@redhat.com Index: autotest/client/tests/kvm/tests/boot_savevm.py

Re: [PATCH 5/5] add documentation about kvmclock

2010-04-15 Thread Randy Dunlap
On Thu, 15 Apr 2010 14:37:28 -0400 Glauber Costa wrote: This patch adds a new file, kvm/kvmclock.txt, describing the mechanism we use in kvmclock. Signed-off-by: Glauber Costa glom...@redhat.com --- Documentation/kvm/kvmclock.txt | 138 1 files

[PATCH] KVM test: Memory ballooning test for KVM guest v4

2010-04-15 Thread Lucas Meneghel Rodrigues
From: pradeep psuri...@linux.vnet.ibm.com This test verifies memory ballooning functionality for KVM guests. It will boot a guest with -balloon virtio, increase and decrease memory on qemu monitor, verifying the changes, for a given number of iterations. Changes from v3: * Also check current

Re: [PATCH 5/5] add documentation about kvmclock

2010-04-15 Thread Glauber Costa
On Thu, Apr 15, 2010 at 12:28:36PM -0700, Randy Dunlap wrote: On Thu, 15 Apr 2010 14:37:28 -0400 Glauber Costa wrote: Thanks Randy, All coments relevant. I'll update the document to cover them. As for your question: Both bit 3 and 0 are used, yes. But they tell the guest to use a different

Re: [Autotest] [PATCH] KVM test: Memory ballooning test for KVM guest

2010-04-15 Thread Lucas Meneghel Rodrigues
On Thu, 2010-04-15 at 20:40 +0530, pradeep wrote: Hi Lucas Please ignore my earlier patch Find the correct patch with the suggested changes. Hi Pradeep, I was reading the test once again while trying it myself, some other ideas came to me. I spent some time hacking the test and sent an

[PATCH V2] drivers/uio/uio_pci_generic.c: allow access for non-privileged processes

2010-04-15 Thread Tom Lyon
This is the firt of 2 related, but independent, patches. This is for uio_pci_generic.c, the next is for uio.c. The 2 patches were previously one large patch. Changes for this version: - uio_pci_generic.c just gets extensions so that a single fd can be used by non-privileged processes for

[PATCH V2] drivers/uio/uio.c: DMA mapping, interrupt extensions, etc.

2010-04-15 Thread Tom Lyon
This is the second of 2 related, but independent, patches. This is for uio.c, the previous is for uio_pci_generic.c. The 2 patches were previously one large patch. Changes for this version: - uio_pci_generic.c just gets extensions so that a single fd can be used by non-privileged processes for

Re: Question on copy paste

2010-04-15 Thread Jim Paris
Stephen Liu wrote: - Original Message From: Amit Shah amit.s...@redhat.com To: Stephen Liu sati...@yahoo.com Cc: kvm@vger.kernel.org Sent: Thu, April 15, 2010 9:02:53 AM Subject: Re: Question on copy paste On (Thu) Apr 15 2010 [08:45:23], Stephen Liu wrote: Hi folks,

[PATCH 1/2] qemu-char.c: Fix memory leaks in qemu_chr_open_pty when openpty fails

2010-04-15 Thread Thomas Bächler
--- qemu-char.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 05df971..d845572 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -986,6 +986,8 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts) s =

[PATCH 2/2] Add a 'screen' backend to qemu-char.c

2010-04-15 Thread Thomas Bächler
This backend uses the 'pty' backend, but attaches the pseudo tty to a screen. A user can use 'screen:name' as a char device in a qemu options and run 'screen -R name' to attach to it. This is very useful for running headless qemu/qemu-kvm machines, where you can create screen sessions for the

[PATCH 00/27] Book3S_32 (PPC32) KVM support

2010-04-15 Thread Alexander Graf
Since we do have support for Book3S_64 KVM now, the next obvious step is to support the generation before that: Book3S_32. This patch set adds support for Book3S_32 hosts, making your old G4 this much more useful. It should also work on fancy exotic systems like the Wii and the Game Cube, but I

[PATCH 10/27] KVM: PPC: Use KVM_BOOK3S_HANDLER

2010-04-15 Thread Alexander Graf
So far we had a lot of conditional code on CONFIG_KVM_BOOK3S_64_HANDLER. As we're moving towards common code between 32 and 64 bits, most of these ifdefs can be moved to a more generic term define, called CONFIG_KVM_BOOK3S_HANDLER. This patch adds the new generic config option and moves ifdefs

[PATCH 23/27] KVM: PPC: Export MMU variables

2010-04-15 Thread Alexander Graf
Our shadow MMU code needs to know where the HTAB is located and how big it is. So we need some variables from the kernel exported to module space if KVM is built as a module. CC: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 25/27] KVM: PPC: Check max IRQ prio

2010-04-15 Thread Alexander Graf
We have a define on what the highest bit of IRQ priorities is. So we can just as well use it in the bit checking code and avoid invalid IRQ values to be triggered. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/book3s.c |2 +- 1 files changed, 1 insertions(+), 1

[PATCH 26/27] KVM: PPC: Add KVM intercept handlers

2010-04-15 Thread Alexander Graf
When an interrupt occurs we don't know yet if we're in guest context or in host context. When in guest context, KVM needs to handle it. So let's pull the same trick we did on Book3S_64: Just add a macro to determine if we're in guest context or not and if so jump on to KVM code. CC: Benjamin

[PATCH 24/27] PPC: Export SWITCH_FRAME_SIZE

2010-04-15 Thread Alexander Graf
We need the SWITCH_FRAME_SIZE define on Book3S_32 now too. So let's export it unconditionally. CC: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kernel/asm-offsets.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff

[PATCH 21/27] KVM: PPC: Emulate segment fault

2010-04-15 Thread Alexander Graf
Book3S_32 doesn't know about segment faults. It only knows about page faults. So in order to know that we didn't map a segment, we need to fake segment faults. We do this by setting invalid segment registers to an invalid VSID and then check for that VSID on normal page faults. Signed-off-by:

[PATCH 05/27] PPC: Split context init/destroy functions

2010-04-15 Thread Alexander Graf
We need to reserve a context from KVM to make sure we have our own segment space. While we did that split for Book3S_64 already, 32 bit is still outstanding. So let's split it now. Signed-off-by: Alexander Graf ag...@suse.de CC: Benjamin Herrenschmidt b...@kernel.crashing.org ---

[PATCH 03/27] KVM: PPC: Add SR swapping code

2010-04-15 Thread Alexander Graf
Later in this series we will move the current segment switch code to generic code and make that call hooks for the specific sub-archs (32 vs. 64 bit). This is the hook for 32 bits. It enabled the entry and exit code to swap segment registers with values from the shadow cpu structure.

[PATCH 04/27] KVM: PPC: Add generic segment switching code

2010-04-15 Thread Alexander Graf
This is the code that will later be used instead of book3s_64_slb.S. It does the last step of guest entry and the first generic steps of guest exiting, once we have determined the interrupt is a KVM interrupt. It also reads the last used instruction from the guest virtual address space if

[PATCH 12/27] PPC: Add STLU

2010-04-15 Thread Alexander Graf
For assembly code there are several long load and store defines already. The one that's missing is the typical stack store, stdu/stwu. So let's add that define as well, making my KVM code happy. CC: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 27/27] KVM: PPC: Enable Book3S_32 KVM building

2010-04-15 Thread Alexander Graf
Now that we have all the bits and pieces in place, let's enable building of the Book3S_32 target. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/Kconfig | 18 ++ arch/powerpc/kvm/Makefile | 12 2 files changed, 30 insertions(+), 0 deletions(-)

[PATCH 18/27] KVM: PPC: Release clean pages as clean

2010-04-15 Thread Alexander Graf
When we mapped a page as read-only, we can just release it as clean to KVM's page claim mechanisms, because we're pretty sure it hasn't been touched. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/book3s_64_mmu_host.c |6 +- 1 files changed, 5 insertions(+), 1

[PATCH 20/27] KVM: PPC: Add SVCPU to Book3S_32

2010-04-15 Thread Alexander Graf
We need to keep the pointer to the shadow vcpu somewhere accessible from within really early interrupt code. The best fit I found was the thread struct, as that resides in an SPRG. So let's put a pointer to the shadow vcpu in the thread struct and add an asm-offset so we can find it.

[PATCH 09/27] KVM: PPC: Improve indirect svcpu accessors

2010-04-15 Thread Alexander Graf
We already have some inline fuctions we use to access vcpu or svcpu structs, depending on whether we're on booke or book3s. Since we just put a few more registers into the svcpu, we also need to make sure the respective callbacks are available and get used. So this patch moves direct use of the

[PATCH 22/27] KVM: PPC: Add Book3S compatibility code

2010-04-15 Thread Alexander Graf
Some code we had so far required defines and had code that was completely Book3S_64 specific. Since we now opened book3s.c to Book3S_32 too, we need to take care of these pieces. So let's add some minor code where it makes sense to not go the Book3S_64 code paths and add compat defines on others.

[PATCH 16/27] KVM: PPC: Make highmem code generic

2010-04-15 Thread Alexander Graf
Since we now have several fields in the shadow VCPU, we also change the internal calling convention between the different entry/exit code layers. Let's reflect that in the IR=1 code and make sure we use long defines for long field access. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 19/27] KVM: PPC: Remove fetch fail code

2010-04-15 Thread Alexander Graf
When instruction fetch failed, the inline function hook automatically detects that and starts the internal guest memory load function. So whenever we access kvmppc_get_last_inst(), we're sure the result is sane. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/emulate.c |4

[PATCH 11/27] KVM: PPC: Use CONFIG_PPC_BOOK3S define

2010-04-15 Thread Alexander Graf
Upstream recently added a new name for PPC64: Book3S_64. So instead of using CONFIG_PPC64 we should use CONFIG_PPC_BOOK3S consotently. That makes understanding the code easier (I hope). Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/include/asm/kvm_host.h |8

[PATCH 07/27] KVM: PPC: Add kvm_book3s_32.h

2010-04-15 Thread Alexander Graf
In analogy to the 64 bit specific header file, this is the 32 bit pendant. With this in place we can just always call to_svcpu and be assured we get the right pointer anywhere. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/include/asm/kvm_book3s_32.h | 42

[PATCH 06/27] KVM: PPC: Add kvm_book3s_64.h

2010-04-15 Thread Alexander Graf
In the process of generalizing as much code as possible, I also moved the shadow vcpu code together to a generic book3s file. Unfortunately the location of the shadow vcpu is different on 32 and 64 bit, so we need a wrapper function to tell us where it is. That sounded like a perfect fit for a

[PATCH 08/27] KVM: PPC: Add fields to shadow vcpu

2010-04-15 Thread Alexander Graf
After a lot of thought on how to make the entry / exit code easier, I figured it'd be clever to put even more register state into the shadow vcpu. That way we have more registers available to use, making the code easier to read. So this patch adds a few new fields to that shadow vcpu. Later on we

[PATCH 17/27] KVM: PPC: Make SLB switching code the new segment framework

2010-04-15 Thread Alexander Graf
We just introduced generic segment switching code that only needs to call small macros to do the actual switching, but keeps most of the entry / exit code generic. So let's move the SLB switching code over to use this new mechanism. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 15/27] KVM: PPC: Make real mode handler generic

2010-04-15 Thread Alexander Graf
The real mode handler code was originally writen for 64 bit Book3S only. But since we not add 32 bit functionality too, we need to make some tweaks to it. This patch basically combines using the long access defines and using fields from the shadow VCPU we just moved there. Signed-off-by:

[PATCH 13/27] KVM: PPC: Use now shadowed vcpu fields

2010-04-15 Thread Alexander Graf
The shadow vcpu now contains some fields we don't use from the vcpu anymore. Access to them happens using inline functions that happily use the shadow vcpu fields. So let's now ifdef them out to booke only and add asm-offsets. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 14/27] KVM: PPC: Extract MMU init

2010-04-15 Thread Alexander Graf
The host shadow mmu code needs to get initialized. It needs to fetch a segment it can use to put shadow PTEs into. That initialization code was in generic code, which is icky. Let's move it over to the respective MMU file. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 02/27] KVM: PPC: Add host MMU Support

2010-04-15 Thread Alexander Graf
In order to support 32 bit Book3S, we need to add code to enable our shadow MMU to actually add shadow PTEs. This is the module enabling that support. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/book3s_32_mmu_host.c | 480 + 1 files changed,

[PATCH] KVM: PPC: Convert u64 - ulong

2010-04-15 Thread Alexander Graf
There are quite some pieces in the code that I overlooked that still use u64s instead of longs. This has two side effects: 1) Slowness 2) Breakage This patch fixes both, enabling me to successfully run a Debian guest on a G4 iBook in KVM. Signed-off-by: Alexander Graf ag...@suse.de ---

RE: VM performance issue in KVM guests.

2010-04-15 Thread Zhang, Xiantao
Avi Kivity wrote: On 04/14/2010 06:24 AM, Zhang, Xiantao wrote: Spin loops need to be addressed first, they are known to kill performance in overcommit situations. Even in overcommit case, if vcpu threads of one qemu are not scheduled or pulled to the same logical processor, the

Re: [Autotest] [PATCH] KVM test: Memory ballooning test for KVM guest

2010-04-15 Thread pradeep
Lucas Meneghel Rodrigues wrote: Hi Pradeep, I was reading the test once again while trying it myself, some other ideas came to me. I spent some time hacking the test and sent an updated patch with changes. Please let me know what you think, if you are OK with them I'll commit it. Hi