[PATCH 2/2 v2] PCI: pci-stub module to reserve pci device

2008-11-25 Thread Chris Wright
When doing device assignment with KVM there's currently nothing to protect the device from having a driver in the host as well as the guest. This trivial module just binds the pci device on the host to a stub driver so that a real host driver can't bind to the device. It has no pci id table, it su

Re: [PATCH 2/2] PCI: pci-stub module to reserve pci device

2008-11-25 Thread Chris Wright
* Greg KH ([EMAIL PROTECTED]) wrote: > On Tue, Nov 25, 2008 at 07:38:39PM -0800, Chris Wright wrote: > > When doing device assignment with KVM there's currently nothing to > > protect the device from having a driver in the host as well as the guest. > > This trivial module just binds the pci device

Re: [PATCH 2/2] PCI: pci-stub module to reserve pci device

2008-11-25 Thread Greg KH
On Tue, Nov 25, 2008 at 07:38:39PM -0800, Chris Wright wrote: > When doing device assignment with KVM there's currently nothing to > protect the device from having a driver in the host as well as the guest. > This trivial module just binds the pci device on the host to a stub > driver so that a rea

[PATCH 2/2] PCI: pci-stub module to reserve pci device

2008-11-25 Thread Chris Wright
When doing device assignment with KVM there's currently nothing to protect the device from having a driver in the host as well as the guest. This trivial module just binds the pci device on the host to a stub driver so that a real host driver can't bind to the device. It has no pci id table, it su

[PATCH 1/2] PCI: allow pci driver to support only dynids

2008-11-25 Thread Chris Wright
commit b41d6cf38e27 (PCI: Check dynids driver_data value for validity) requires all drivers to include an id table to try and match driver_data. Before validating driver_data check driver has an id table. Cc: Jean Delvare <[EMAIL PROTECTED]> Cc: Milton Miller <[EMAIL PROTECTED]> Signed-off-by: Ch

[PATCH 2/2] KVM: Change to use new APIs for KVM VT-d

2008-11-25 Thread Han, Weidong
This patch changes to use new APIs for KVM VT-d, and add device deassignment for hotplug. Signed-off-by: Weidong Han <[EMAIL PROTECTED]> --- include/linux/kvm.h |2 + include/linux/kvm_host.h | 23 -- virt/kvm/kvm_main.c | 45 ++- virt/kvm/vtd.c

[PATCH 0/2] Support VT-d multiple device assignment for KVM

2008-11-25 Thread Han, Weidong
In native VT-d usage, one domain (dmar_domain) owns one device (PCI-e). KVM uses VT-d driver to assign device, so currently kvm VT-d only supports assign single device to a guest. While in KVM VT-d usage, multiple devices from different iommus can be assigned to one guest. In order to support

[PATCH 2/2] Virtio block device support

2008-11-25 Thread Anthony Liguori
This has been posted before but I believe it now has addressed all outstanding concerns. I'd like to apply it if there are no objections. This patch adds virtio-blk support to QEMU. virtio-blk is a paravirtual disk controller that can achieve good performance when using KVM. Since virtio is bas

[PATCH 1/2] Virtio core support

2008-11-25 Thread Anthony Liguori
This has been posted before but I believe it now has addressed all outstanding concerns. I'd like to apply it if there are no objections. This patch adds virtio support to QEMU. virtio is a paravirtualization ABI based around a virtual PCI device and shared ring queue. It has been supported in

Re: [RFT] Rebased gdb/debug register patches

2008-11-25 Thread Hollis Blanchard
On Mon, 2008-11-24 at 16:27 +0100, Jan Kiszka wrote: > Hi, > > this is not yet the official submission, but a request for testing: > > I'm happy to announce the availability of a rebased patch series to > enhance KVM's guest debugging support as well as to add debug register > emulation. It was r

[PATCH 12/12] Accelerate nested SVM by emulating parts of GIF=0 v7

2008-11-25 Thread Alexander Graf
Until this patch we bounced between the VM and the VMM for a couple of instructions after CLGI, only to find out that yet another SVM instruction follows. Since roundtrips are really expensive, it's a lot faster to emulate these few instructions. Now we can execute CLGI/VMLOAD/VMRUN on one intercep

[PATCH 07/12] Add VMRUN handler v7

2008-11-25 Thread Alexander Graf
This patch implements VMRUN. VMRUN enters a virtual CPU and runs that in the same context as the normal guest CPU would run. So basically it is implemented the same way, a normal CPU would do it. We also prepare all intercepts that get OR'ed with the original intercepts, as we do not allow a level

[PATCH 06/12] Add VMLOAD and VMSAVE handlers v7

2008-11-25 Thread Alexander Graf
This implements the VMLOAD and VMSAVE instructions, that usually surround the VMRUN instructions. Both instructions load / restore the same elements, so we only need to implement them once. v2 fixes CPL checking and replaces memcpy by assignments v3 makes use of the new permission checking Signed

[PATCH 10/12] Allow setting the SVME bit v7

2008-11-25 Thread Alexander Graf
Normally setting the SVME bit in EFER is not allowed, as we did not support SVM. Not since we do, we should also allow enabling SVM mode. v2 comes as last patch, so we don't enable half-ready code v4 introduces a module option to enable SVM v6 warns that nesting is enabled Signed-off-by: Alexande

[PATCH 09/12] Allow read access to MSR_VM_VR v7

2008-11-25 Thread Alexander Graf
From: Joerg Roedel <[EMAIL PROTECTED]> KVM tries to read the VM_CR MSR to find out if SVM was disabled by the BIOS. So implement read support for this MSR to make nested SVM running. Signed-off-by: Joerg Roedel <[EMAIL PROTECTED]> Signed-off-by: Alexander Graf <[EMAIL PROTECTED]> --- arch/x86/kv

[PATCH 08/12] Add VMEXIT handler and intercepts v7

2008-11-25 Thread Alexander Graf
This adds the #VMEXIT intercept, so we return to the level 1 guest when something happens in the level 2 guest that should return to the level 1 guest. v2 implements HIF handling and cleans up exception interception v3 adds support for V_INTR_MASKING_MASK v4 uses the host page hsave v5 removes IOP

[PATCH 05/12] Implement hsave v7

2008-11-25 Thread Alexander Graf
Implement the hsave MSR, that gives the VCPU a GPA to save the old guest state in. v2 allows userspace to save/restore hsave v4 dummys out the hsave MSR, so we use a host page v6 remembers the guest's hsave and exports the MSR Signed-off-by: Alexander Graf <[EMAIL PROTECTED]> --- arch/x86/kvm/kv

[PATCH 11/12] Only allow setting of EFER_SVME when CPUID SVM is set v7

2008-11-25 Thread Alexander Graf
Userspace has to tell the kernel module somehow that nested SVM should be used. The easiest way that doesn't break anything I could think of is to implement if (cpuid & svm) allow write to efer else deny write to efer Old userspaces mask the SVM capability bit, so they don't break. In ord

[PATCH 02/12] Move EFER and MSR constants to generic x86 code v7

2008-11-25 Thread Alexander Graf
MSR_EFER_SVME_MASK, MSR_VM_CR and MSR_VM_HSAVE_PA are set in KVM specific headers. Linux does have nice header files to collect EFER bits and MSR IDs, so IMHO we should put them there. While at it, I also changed the naming scheme to match that of the other defines. (introduced in v6) Signed-off

[PATCH 03/12] Add helper functions for nested SVM v7

2008-11-25 Thread Alexander Graf
These are helpers for the nested SVM implementation. - nsvm_printk implements a debug printk variant - nested_svm_do calls a handler that can accesses gpa-based memory v3 makes use of the new permission checker v6 changes: - streamline nsvm_debug() - remove printk(KERN_ERR) - SVME check before CP

[PATCH 01/12] Clean up VINTR setting v7

2008-11-25 Thread Alexander Graf
The current VINTR intercept setters don't look clean to me. To make the code easier to read and enable the possibilty to trap on a VINTR set, this uses a helper function to set the VINTR intercept. v2 uses two distinct functions for setting and clearing the bit Signed-off-by: Alexander Graf <[EMA

[PATCH 00/12] Add support for nested SVM (kernel) v7

2008-11-25 Thread Alexander Graf
The current generation of virtualization extensions only supports one VM layer. While we can't change that, it is pretty easy to emulate the CPU's behavior and implement the virtualization opcodes ourselves. This patchset does exactly this for SVM. Using it, KVM can run within a VM. Since we're em

[PATCH 04/12] Implement GIF, clgi and stgi v7

2008-11-25 Thread Alexander Graf
This patch implements the GIF flag and the clgi and stgi instructions that set this flag. Only if the flag is set (default), interrupts can be received by the CPU. To keep the information about that somewhere, this patch adds a new hidden flags vector. that is used to store information that does n

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread David S. Ahern
Hollis Blanchard wrote: > On Mon, 2008-11-24 at 21:41 -0700, David S. Ahern wrote: >> RHEL3 (which is based on the 2.4.21 kernel) gets microsecond >> resolutions >> by reading the TSC. Reading the TSC from within a guest is very fast >> on kvm. >> >> RHEL4 (which is basd on the 2.6.9 kernel) allo

Re: KVM: MMU: avoid creation of unreachable pages in the shadow

2008-11-25 Thread John Rousseau
Marcelo Tosatti wrote: On Tue, Nov 25, 2008 at 01:27:27PM -0500, John Rousseau wrote: Marcelo Tosatti wrote: It is possible for a shadow page to have a parent link pointing to a freed page. When zapping a high level table, kvm_mmu_page_unlink_children fails to remove the parent_pte link. For th

Re: KVM: MMU: avoid creation of unreachable pages in the shadow

2008-11-25 Thread Marcelo Tosatti
On Tue, Nov 25, 2008 at 01:27:27PM -0500, John Rousseau wrote: > Marcelo Tosatti wrote: >> It is possible for a shadow page to have a parent link >> pointing to a freed page. When zapping a high level table, >> kvm_mmu_page_unlink_children fails to remove the parent_pte link. >> For that to happen,

Re: KVM: MMU: avoid creation of unreachable pages in the shadow

2008-11-25 Thread John Rousseau
Marcelo Tosatti wrote: It is possible for a shadow page to have a parent link pointing to a freed page. When zapping a high level table, kvm_mmu_page_unlink_children fails to remove the parent_pte link. For that to happen, the child must be unreachable via the shadow tree, which can happen in sh

Re: KVM: MMU: optimize set_spte for page sync

2008-11-25 Thread Marcelo Tosatti
On Tue, Nov 25, 2008 at 04:38:13PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> *shadow_pte can point to a different page if the guest updates >> pagetable, there is a fault before resync, the fault updates the >> spte with new gfn (and pfn) via mmu_set_spte. In which case the gfn >> cache

KVM: MMU: avoid creation of unreachable pages in the shadow

2008-11-25 Thread Marcelo Tosatti
It is possible for a shadow page to have a parent link pointing to a freed page. When zapping a high level table, kvm_mmu_page_unlink_children fails to remove the parent_pte link. For that to happen, the child must be unreachable via the shadow tree, which can happen in shadow_walk_entry if the g

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Hollis Blanchard
On Mon, 2008-11-24 at 21:41 -0700, David S. Ahern wrote: > > RHEL3 (which is based on the 2.4.21 kernel) gets microsecond > resolutions > by reading the TSC. Reading the TSC from within a guest is very fast > on kvm. > > RHEL4 (which is basd on the 2.6.9 kernel) allows multiple time > sources: >

Re: Out of sync shadow core breaks Hurd

2008-11-25 Thread Aurelien Jarno
On Tue, Nov 25, 2008 at 10:57:17AM +0100, Aurelien Jarno wrote: > On Thu, Nov 20, 2008 at 10:48:21AM +0100, Marcelo Tosatti wrote: > > Hi Aurelien, > Hi, > > > On Wed, Nov 12, 2008 at 08:00:37PM +0100, Aurelien Jarno wrote: > > > Hi, > > > > > > Starting with kvm-76 (and including kvm-79), Hurd d

RE: [PATCH] kvm: ppc: stop leaking host memory on VM exit

2008-11-25 Thread Hollis Blanchard
On Tue, 2008-11-25 at 16:32 +0800, Liu Yu wrote: > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Hollis Blanchard > > Sent: Tuesday, November 25, 2008 1:38 AM > > To: Avi Kivity > > Cc: kvm-ppc; kvm > > Subject: [PATCH] kvm: ppc: stop leaking h

Re: [PATCH 05/11] KVM: Add fields for MSI device assignment

2008-11-25 Thread Sheng Yang
On Tue, Nov 25, 2008 at 04:49:49PM +0200, Avi Kivity wrote: > Avi Kivity wrote: >>> (In fact, PCI spec defined message data length is u64, but as you >>> see, now msi_msg for whole Linux only have u32...) >>> >> >> Well in that case please define data as __u64, so we don't have >> surprises

Re: [Patch 4/5] x86_emulator: add the assembler code for three operands

2008-11-25 Thread Avi Kivity
Guillaume Thouvenin wrote: On Tue, 04 Nov 2008 12:21:30 +0200 Avi Kivity <[EMAIL PROTECTED]> wrote: Guillaume Thouvenin wrote: Add the assembler code for three operands +/* Instruction has three operands */ +/* In the switch we only implement case 4 because we know that for shld i

Re: [PATCH] KVM: VMX: Fix race between pending IRQ and NMI

2008-11-25 Thread Jan Kiszka
Avi Kivity wrote: > Jan Kiszka wrote: > But I think I see a bigger issue - if we inject an regular interrupt > while another is pending, then we will encounter this problem. Looks > like we have to enable the interrupt window after injecting an > interrupt > if there are still

Re: [PATCH 05/11] KVM: Add fields for MSI device assignment

2008-11-25 Thread Avi Kivity
Avi Kivity wrote: (In fact, PCI spec defined message data length is u64, but as you see, now msi_msg for whole Linux only have u32...) Well in that case please define data as __u64, so we don't have surprises later on. btw, if you agree with this, don't resend; I'll edit the patch. --

Re: [PATCH 05/11] KVM: Add fields for MSI device assignment

2008-11-25 Thread Avi Kivity
Sheng Yang wrote: union { + struct { + __u32 addr_lo; + __u32 addr_hi; __u64 addr; ? Here I followed the spec that distinguish the "Message Address" and "Message Upper address". And the native Linux structure: st

Re: [PATCH] KVM: VMX: Fix race between pending IRQ and NMI

2008-11-25 Thread Avi Kivity
Jan Kiszka wrote: But I think I see a bigger issue - if we inject an regular interrupt while another is pending, then we will encounter this problem. Looks like we have to enable the interrupt window after injecting an interrupt if there are still pending interrupts. Yeah, probabl

Re: [PATCH] kvm-testsuite: Fix halt callback

2008-11-25 Thread Avi Kivity
Jan Kiszka wrote: Change halt callback in testsuite to conform with latest refactorings. Applied, thanks. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [EMAIL PROTECTED] More maj

Re: [PATCH 3/4] Support for device capability

2008-11-25 Thread Avi Kivity
Sheng Yang wrote: On Sunday 23 November 2008 20:28:21 Avi Kivity wrote: Sheng Yang wrote: This framework can be easily extended to support device capability, like MSI/MSI-x. At least some of this should go into pci.c, so non-assigned devices can benefit. So you means a ca

Re: KVM: MMU: optimize set_spte for page sync

2008-11-25 Thread Avi Kivity
Marcelo Tosatti wrote: *shadow_pte can point to a different page if the guest updates pagetable, there is a fault before resync, the fault updates the spte with new gfn (and pfn) via mmu_set_spte. In which case the gfn cache is updated since: } else if (pfn != spte_to_pfn(*sh

Re: [PATCH] sign kvmclock as paravirt

2008-11-25 Thread Avi Kivity
Glauber Costa wrote: Currently, we only set the KVM paravirt signature in case of CONFIG_KVM_GUEST. However, it is possible to have it turned off, while CONFIG_KVM_CLOCK is turned on. This is also a paravirt case, and should be shown accordingly. Applied, thanks. -- error compiling committe

Re: [PATCH] Fix -no-kvm with SMP

2008-11-25 Thread Avi Kivity
Jan Kiszka wrote: Fix condition for the !kvm_enabled() case. Applied, thanks. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.

Re: [PATCH] always assign userspace_addr

2008-11-25 Thread Avi Kivity
Glauber Costa wrote: Hm, if !npages we should just kvm_free_physmem_slot(&old, NULL). Actually, I believe we need a little bit more than that, because we can have valid rmaps in flight. Tell me what you think about this. diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index b19

[PATCH] kvm-userspace: fix module build with --kerneldir

2008-11-25 Thread Joerg Roedel
From: Maik Hentsche <[EMAIL PROTECTED]> When kvm-userspace is build with a different kernel version than the running kernel the depmod at the end will fail. This patch fixed the problem. Signed-off-by: Maik Hentsche <[EMAIL PROTECTED]> Signed-off-by: Joerg Roedel <[EMAIL PROTECTED]> --- build/ke

Re: [PATCH/RFC 2] kvm: fix module refcount issues with anon_inodegetfd

2008-11-25 Thread Avi Kivity
Christian Borntraeger wrote: Messing with module counts is slightly ugly. I changed my patch to be more generic. Instead of messing with the module refcount in the kvm module, I decided to change anon_inode_getfd instead. If the owner field is set, we will try an module_get in anon_inode_g

[PATCH] Fix -no-kvm with SMP

2008-11-25 Thread Jan Kiszka
Fix condition for the !kvm_enabled() case. Signed-off-by: Jan Kiszka <[EMAIL PROTECTED]> --- qemu/hw/apic.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/qemu/hw/apic.c b/qemu/hw/apic.c index 8836784..6657276 100644 --- a/qemu/hw/apic.c +++ b/qemu/hw/apic.c @@ -436,7

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Andi Kleen
> But yeah - the remapping of HPET timers to virtual HPET timers sounds > pretty tough. I wonder if one could overcome that with a little > hardware support though ... For gettimeofday better make TSC work. Even in the best case (no virtualization) it is much faster than HPET because it sits

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Alexander Graf
On 25.11.2008, at 12:48, Andi Kleen wrote: Why does hpet need to be slow? Can't you just 1:1 pass through one of the hpet timers if you only have a limited amount of vms? HPET is not a truly virtualizable device, it's all the counters in one block that cannot be really mapped to different peo

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Andi Kleen
> Why does hpet need to be slow? Can't you just 1:1 pass through one of > the hpet timers if you only have a limited amount of vms? HPET is not a truly virtualizable device, it's all the counters in one block that cannot be really mapped to different people. Also most systems have very little c

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Alexander Graf
On 25.11.2008, at 11:14, Andi Kleen <[EMAIL PROTECTED]> wrote: "David S. Ahern" <[EMAIL PROTECTED]> writes: Any chance the pit or pmtmr options can be optimized a bit? They both will require vmexits and never be really fast. Same for HPET. If you want fast gtod you really need to make TS

Re: [PATCH] kvm: ppc: stop leaking host memory on VM exit

2008-11-25 Thread Avi Kivity
Hollis Blanchard wrote: When the VM exits, we must call put_page() for every page referenced in the shadow TLB. Without this patch, we usually leak 30-50 host pages (120 - 200 KiB with 4 KiB pages). The maximum number of pages leaked is the size of our shadow TLB, 64 pages. Signed-off-by: Holli

[PATCH v2] Accept password as an argument to 'change vnc password'

2008-11-25 Thread Chris Webb
Accept password as an argument to 'change vnc password' monitor command This allows easier use of the change vnc password monitor command from management scripts, without having to implement expect(1)-like behaviour. Signed-off-by: Chris Webb <[EMAIL PROTECTED]> --- monitor.c | 14

[PATCH v2] Fix off-by-one bug limiting VNC passwords to 7 chars

2008-11-25 Thread Chris Webb
Fix off-by-one bug limiting VNC passwords to 7 characters instead of 8 monitor_readline expects buf_size to include the terminating \0, but do_change_vnc in monitor.c calls it as though it doesn't. The other site where monitor_readline reads a password (in vl.c) passes the buffer length correctly.

Re: gettimeofday "slow" in RHEL4 guests

2008-11-25 Thread Andi Kleen
"David S. Ahern" <[EMAIL PROTECTED]> writes: > > Any chance the pit or pmtmr options can be optimized a bit? They both will require vmexits and never be really fast. Same for HPET. If you want fast gtod you really need to make TSC work. -Andi -- [EMAIL PROTECTED] -- To unsubscribe from this li

Re: [Qemu-devel] [PATCH] Fix off-by-one bug limiting VNC passwords to 7 chars

2008-11-25 Thread Chris Webb
Thiemo Seufer <[EMAIL PROTECTED]> writes: > Chris Webb wrote: [...] > > - monitor_readline("Password: ", 1, password, sizeof(password)-1); > > + monitor_readline("Password: ", 1, password, sizeof(password)); > > password[sizeof(password)-1] = '\0'; > > The next line can go as well, the st

Re: Out of sync shadow core breaks Hurd

2008-11-25 Thread Aurelien Jarno
On Thu, Nov 20, 2008 at 10:48:21AM +0100, Marcelo Tosatti wrote: > Hi Aurelien, Hi, > On Wed, Nov 12, 2008 at 08:00:37PM +0100, Aurelien Jarno wrote: > > Hi, > > > > Starting with kvm-76 (and including kvm-79), Hurd does not boot anymore > > under KVM. The ext2fs translator issues a strange error

[ kvm-Bugs-2327497 ] NFS copy makes guest network unstable

2008-11-25 Thread SourceForge.net
Bugs item #2327497, was opened at 2008-11-22 17:53 Message generated for change (Comment added) made by avik You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=893831&aid=2327497&group_id=180599 Please note that this message will contain a full copy of the comment thre

RE: [PATCH] kvm: ppc: stop leaking host memory on VM exit

2008-11-25 Thread Liu Yu
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hollis Blanchard > Sent: Tuesday, November 25, 2008 1:38 AM > To: Avi Kivity > Cc: kvm-ppc; kvm > Subject: [PATCH] kvm: ppc: stop leaking host memory on VM exit > > When the VM exits, we must call put_

Re: [PATCH/RFC 2] kvm: fix module refcount issues with anon_inodegetfd

2008-11-25 Thread Christian Borntraeger
> Messing with module counts is slightly ugly. I changed my patch to be more generic. Instead of messing with the module refcount in the kvm module, I decided to change anon_inode_getfd instead. If the owner field is set, we will try an module_get in anon_inode_getfd, since the VFS release functio