Re: [PATCH 5/6] kvm: qemu: deassign device from guest

2009-02-13 Thread Mark McLoughlin
On Fri, 2009-02-13 at 14:58 +0800, Han, Weidong wrote: +static void deassign_device(AssignedDevInfo *adev) +{ +struct kvm_assigned_pci_dev assigned_dev_data; +AssignedDevice *dev = adev-assigned_dev; +int r; + +memset(assigned_dev_data, 0, sizeof(assigned_dev_data)); +

RE: [PATCH 5/6] kvm: qemu: deassign device from guest

2009-02-13 Thread Han, Weidong
Mark McLoughlin wrote: On Fri, 2009-02-13 at 14:58 +0800, Han, Weidong wrote: +static void deassign_device(AssignedDevInfo *adev) +{ +struct kvm_assigned_pci_dev assigned_dev_data; +AssignedDevice *dev = adev-assigned_dev; +int r; + +memset(assigned_dev_data, 0,

[PATCH 2/7] [V3] kvm: fix kvm_vm_ioctl_deassign_device

2009-02-13 Thread Han, Weidong
only need to set assigned_dev_id for deassignment, use match-flags to judge and deassign it. Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com --- virt/kvm/kvm_main.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git

[PATCH 1/7] [V3] kvm: define KVM_CAP_DEVICE_DEASSIGNMENT

2009-02-13 Thread Han, Weidong
define KVM_CAP_DEVICE_DEASSIGNMENT and KVM_DEASSIGN_PCI_DEVICE for device deassignment. the ioctl has been already implemented in the commit: 0a920356748df4fb06e86c21c23d2ed6d31d37ad Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com ---

[PATCH 3/7] [V3] kvm: libkvm: add deassign ioctl

2009-02-13 Thread Han, Weidong
add this to support hot remove device with iommu Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com --- libkvm/libkvm.c | 14 ++ libkvm/libkvm.h | 13 + 2 files changed, 27 insertions(+), 0 deletions(-) diff --git

[PATCH 4/7] [V3] kvm: qemu: free device on error in init_assigned_device

2009-02-13 Thread Han, Weidong
make init_assigned_device call free_assigned_device on error, and then make free_assigned_device is static because it's only invoked in device-assigned.c. Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com --- qemu/hw/device-assignment.c | 12

[PATCH 5/7] [V3] kvm: qemu: wrap assign_device and assign_irq

2009-02-13 Thread Han, Weidong
just wrap assign_device and assign_irq, no functional changes Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com --- qemu/hw/device-assignment.c | 121 +-- 1 files changed, 70 insertions(+), 51 deletions(-) diff

[PATCH 6/7] [V3] kvm: qemu: deassign device from guest

2009-02-13 Thread Han, Weidong
free_assigned_device just frees device from qemu, it should also deassign the device from guest when guest exits or hot remove a device. Acked-by: Mark McLoughlin mar...@redhat.com Signed-off-by: Weidong Han weidong@intel.com --- qemu/hw/device-assignment.c | 28

Re: qcow2 corruption observed, fixed by reverting old change

2009-02-13 Thread Kevin Wolf
Hi Marc, You should not take qemu-devel out of the CC list. This is where the bugs need to be fixed, they aren't KVM specific. I'm quoting your complete mail to forward it to where it belongs. Marc Bevand schrieb: Jamie Lokier jamie at shareable.org writes: As you see from the subject, I'm

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Paul Brook
- A device requests a filter and is told if the request is successful   - On success the device may skip it's own filtering - If another vlan client is added, the following _must_ occur:   - The filterer must clear (remove) the filter   - The filteree must revert to using their own filtering

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Jamie Lokier
Paul Brook wrote: We could use a changed() function, but it would need to know the direction of the change, which leads back to the same mechanics. If there's a better way, please suggest it. Thanks, I still don't see why the device needs to know what's changed. The response should

Re: Running KVM on a Laptop

2009-02-13 Thread Jorge Lucángeli Obes
On Thu, Feb 12, 2009 at 11:56 PM, Ross McKay ro...@zeta.org.au wrote: dnjap wrote: I'm looking for a laptop on which I can run KVM. 1. Does anyone have a list of AMD-V or VT-x capable laptop CPU's? http://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors The header before each chart

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Paul Brook
On Friday 13 February 2009, Jamie Lokier wrote: Paul Brook wrote: We could use a changed() function, but it would need to know the direction of the change, which leads back to the same mechanics. If there's a better way, please suggest it. Thanks, I still don't see why the device

Re: [Qemu-devel] Re: qcow2 corruption observed, fixed by reverting old change

2009-02-13 Thread Jamie Lokier
Marc Bevand schrieb: I tested kvm-81 and kvm-83 as well (can't test kvm-80 or older because of the qcow2 performance regression caused by the default writethrough caching policy) but it randomly triggers an even worse bug: the moment I shut down a guest by typing quit in the monitor, it

KVM PCI device assignment issues

2009-02-13 Thread Mark McLoughlin
Hi, KVM has support for PCI device assignment using VT-d and AMD IOMMU, but there are a number of inter-related issues that need some further discussion: - Unbinding devices from any existing device driver before assignment - Resetting devices before and after assignment - Helping users

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Jamie Lokier
Paul Brook wrote: Well, you do need some way to notify a client that the filter which used to work has been removed because it's no longer available, for example when migrating between host kernels. This is actually more evidence that the add and remove callbacks are bogus. I agree,

Re: [PATCH v8 1/7] PCI: initialize and release SR-IOV capability

2009-02-13 Thread Andi Kleen
Yu Zhao yu.z...@intel.com writes: + + +static int sriov_init(struct pci_dev *dev, int pos) +{ + int i; + int rc; + int nres; + u32 pgsz; + u16 ctrl, total, offset, stride; + struct pci_sriov *iov; + struct resource *res; + struct pci_dev *pdev; + +

Re: KVM PCI device assignment issues

2009-02-13 Thread Greg KH
On Fri, Feb 13, 2009 at 04:32:47PM +, Mark McLoughlin wrote: Driver Unbinding Before a device is assigned to a guest, we should make sure that no host device driver is currently bound to the device. We can do that with e.g. $ echo -n 8086 10de

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Paul Brook
A simple Something changed, please try your filter again callback automatically covers all these cases. It doesn't, if tap has no memory of how many clients require a filter. I'm talking about a callback for devices requesting an inbound filter. Devices implementing outgoing (device-vlan)

Re: KVM PCI device assignment issues

2009-02-13 Thread Mark McLoughlin
On Fri, 2009-02-13 at 08:56 -0800, Greg KH wrote: On Fri, Feb 13, 2009 at 04:32:47PM +, Mark McLoughlin wrote: Driver Unbinding Before a device is assigned to a guest, we should make sure that no host device driver is currently bound to the device. We can do

Re: [PATCH 2/3] KVM: Add gsi_msg_pending_bitmap for MSI-X

2009-02-13 Thread Marcelo Tosatti
On Fri, Feb 13, 2009 at 11:37:45AM +0800, Sheng Yang wrote: +#define KVM_ASSIGNED_DEV_MSIX((1 2) | (1 10)) Can you explain the usage of the two bits? Um... Just to keep consistent with formers(one for guest and one for host), at cost of one bit. OK Can drop the

Re: [PATCH 3/3] KVM: Enable MSI-X for KVM assigned device

2009-02-13 Thread Marcelo Tosatti
On Fri, Feb 13, 2009 at 01:29:42PM +0800, Sheng Yang wrote: The allocation only happen once, at the second time it would report error in current code. But allocate/deallocate is also acceptable for future. Oops, it OK. - interrupt context can read the table while

Re: KVM PCI device assignment issues

2009-02-13 Thread Matthew Wilcox
On Fri, Feb 13, 2009 at 04:32:47PM +, Mark McLoughlin wrote: Hi, You raise some interesting points. Thanks for doing that rather than going off and creating a big pile of patches and demanding they be applied ;-) This gets confusing, so some background constraints first: -

Re: Nested kvm - vmware esx

2009-02-13 Thread Jeffry Molanus
I have applied the patches you suggested and the system boots. The system boots *very* slow and panics once it boots. I do not have the dump with me right now but its something in sched.c Jeffry On Thu, Feb 12, 2009 at 6:25 PM, Alexander Graf ag...@suse.de wrote: Jeffry Molanus wrote: Ps. I

Re: [PATCH v8 1/7] PCI: initialize and release SR-IOV capability

2009-02-13 Thread Matthew Wilcox
On Fri, Feb 13, 2009 at 05:56:44PM +0100, Andi Kleen wrote: + pci_read_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl); + if (ctrl PCI_SRIOV_CTRL_VFE) { + pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, 0); + msleep(100); That's really long. Hopefully that's

[PATCH] use KVM_UPSTREAM for ppc.

2009-02-13 Thread Glauber Costa
ppc should compile with upstream qemu code, so, put these defines in ppc specific code that references kvm functions. We don put them in config.h in this case, since there are files (like vl.c) that includes both kvm.h and qemu-kvm.h, and would break compilation. Signed-off-by: Glauber Costa

Re: KVM PCI device assignment issues

2009-02-13 Thread Chris Wright
* Matthew Wilcox (matt...@wil.cx) wrote: On Fri, Feb 13, 2009 at 04:32:47PM +, Mark McLoughlin wrote: - Conventional PCI devices (i.e. PCI/PCI-X, not PCIe) behind the same bridge must be assigned to the same VT-d domain - i.e given device A (:0f:1.0) and device B (and

Re: [PATCH] use KVM_UPSTREAM for ppc.

2009-02-13 Thread Hollis Blanchard
On Fri, 2009-02-13 at 13:07 -0500, Glauber Costa wrote: ppc should compile with upstream qemu code, so, put these defines in ppc specific code that references kvm functions. We don put them in config.h in this case, since there are files (like vl.c) that includes both kvm.h and qemu-kvm.h,

Re: KVM PCI device assignment issues

2009-02-13 Thread Chris Wright
* Chris Wright (chr...@redhat.com) wrote: * Matthew Wilcox (matt...@wil.cx) wrote: I might suggest a second approach which would be to have an explicit echo to the bind file ignore the list of ids. Then you wouldn't need to 'echo -n 8086 10de' to begin with. I tried that first, and it

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: - add a watchpoint to break when the value of gs:[0x30] changes It seems that the problem can be reproduced by compiling the following simple program using cygwin's gcc. The program crashes on w2k3-amd64 on kvm-83 on core2-duo,

Re: kvm-userspace compile problem

2009-02-13 Thread Hans de Bruin
Glauber Costa wrote: e$ ./configure --prefix=/usr --with-patched-kernel Install prefix/usr BIOS directory/usr/share/qemu binary directory /usr/bin Manual directory /usr/share/man ELF interp prefix /usr/gnemul/qemu-%M Source path /home/hns/kvm-userspace/qemu C compilergcc

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: Can you rerun on AMD, but set add npt=0 as a kvm-amd module parameter? This will determine if this is an mmu bug or kvm-intel bug. AMD works fine with npt=0, both cygwin and my setjmp()/longjmp() test program. dmesg confirms

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: Can you rerun on AMD, but set add npt=0 as a kvm-amd module parameter? This will determine if this is an mmu bug or kvm-intel bug. AMD works fine with npt=0, both cygwin and my setjmp()/longjmp() test program. dmesg confirms

Re: [Qemu-devel] [PATCH 3/4] qemu:virtio-net: Add support for qemu_vlan_rxfilter

2009-02-13 Thread Jamie Lokier
Paul Brook wrote: A simple Something changed, please try your filter again callback automatically covers all these cases. It doesn't, if tap has no memory of how many clients require a filter. I'm talking about a callback for devices requesting an inbound filter. Devices implementing

Re: Nested kvm - vmware esx

2009-02-13 Thread Alexander Graf
Does the first or second level guest panic? Alex On 13.02.2009, at 18:38, Jeffry Molanus jeffry.mola...@gmail.com wrote: I have applied the patches you suggested and the system boots. The system boots *very* slow and panics once it boots. I do not have the dump with me right now but its

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Avi Kivity a...@redhat.com writes: - run a cygwin program in an infinite loop (while :; do :; done is sufficient) - 'info registers', look at gdt - 'x/28x 0x$GDT' I'm interested in offset 0x28, but please provide the whole thing for sanity checking. Here it is. This is with npt=1, but

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Avi Kivity a...@redhat.com writes: Can you rerun on AMD, but set add npt=0 as a kvm-amd module parameter? This will determine if this is an mmu bug or kvm-intel bug. AMD works fine with npt=0, both cygwin and my setjmp()/longjmp() test program. dmesg confirms that nested paging is disabled.

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: - run a cygwin program in an infinite loop (while :; do :; done is sufficient) - 'info registers', look at gdt - 'x/28x 0x$GDT' I'm interested in offset 0x28, but please provide the whole thing for sanity checking. Here it is.

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Avi Kivity a...@redhat.com writes: More questions: - is the bad 'mov gs' instruction reached on AMD? or is it avoided somehow? What about bare metal? The instruction is indeed reached on amd, and gs is 0x2b after the instruction. I don't know about bare metal. - does the attached program

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: More questions: - is the bad 'mov gs' instruction reached on AMD? or is it avoided somehow? What about bare metal? The instruction is indeed reached on amd, and gs is 0x2b after the instruction. I don't know about bare metal.

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Avi Kivity a...@redhat.com writes: More questions: - is the bad 'mov gs' instruction reached on AMD? or is it avoided somehow? What about bare metal? The instruction is indeed reached on amd, and gs is 0x2b after the instruction. I don't know about bare metal.

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Avi Kivity a...@redhat.com writes: Can you run the slightly modified gs.c (attached) and rerun on AMD? The is to see if the runtime somehow restores gs. Crashes as follows: w2k3-64:~$ ./a.exe gs: 2b gs:0x30: 7efdb000 Segmentation fault (core dumped) -- To unsubscribe from this list: send the

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Matteo Frigo ath...@fftw.org writes: Avi Kivity a...@redhat.com writes: Can you run the slightly modified gs.c (attached) and rerun on AMD? The is to see if the runtime somehow restores gs. Crashes as follows: w2k3-64:~$ ./a.exe gs: 2b gs:0x30: 7efdb000 Segmentation fault (core

Re: running windows xp created by vmware server on kvm/qemu

2009-02-13 Thread David S. Ahern
Martin Maurer wrote: -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of David S. Ahern Sent: Donnerstag, 12. Februar 2009 22:46 To: qemu-de...@nongnu.org; kvm-devel Subject: running windows xp created by vmware server on kvm/qemu

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: Matteo Frigo ath...@fftw.org writes: Avi Kivity a...@redhat.com writes: Can you run the slightly modified gs.c (attached) and rerun on AMD? The is to see if the runtime somehow restores gs. Crashes as follows: w2k3-64:~$ ./a.exe gs: 2b gs:0x30: 7efdb000

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Matteo Frigo
Avi Kivity a...@redhat.com writes: + vmx_load_host_state(vcpu); Works here as well (on intel). (On kvm-83, gcc complains about passing argument 1 of 'vmx_load_host_state' from incompatible pointer type.) Thanks for the terrific support. kvm rocks! Regards, Matteo Frigo -- To

Re: Cygwin bash's built-in test command crashes on Windows 2008 Server 64bit under KVM

2009-02-13 Thread Avi Kivity
Matteo Frigo wrote: (On kvm-83, gcc complains about passing argument 1 of 'vmx_load_host_state' from incompatible pointer type.) Yes, should be to_vmx(vcpu). Same value anyway so it works. Thanks for the terrific support. kvm rocks! Thanks for the debugging help. kvm users rock!

[PATCH] pci: add remove_id sysfs entry

2009-02-13 Thread Chris Wright
This adds a remove_id sysfs entry to allow users of new_id to later remove the added dynid. One use case is management tools that want to dynamically bind/unbind devices to pci-stub driver while devices are assigned to KVM guests. Rather than having to track which driver was originally bound to

Re: [PATCH v8 1/7] PCI: initialize and release SR-IOV capability

2009-02-13 Thread Yu Zhao
On Sat, Feb 14, 2009 at 12:56:44AM +0800, Andi Kleen wrote: Yu Zhao yu.z...@intel.com writes: + + +static int sriov_init(struct pci_dev *dev, int pos) +{ + int i; + int rc; + int nres; + u32 pgsz; + u16 ctrl, total, offset, stride; + struct pci_sriov *iov; +

Re: [PATCH v8 1/7] PCI: initialize and release SR-IOV capability

2009-02-13 Thread Yu Zhao
On Sat, Feb 14, 2009 at 01:49:59AM +0800, Matthew Wilcox wrote: On Fri, Feb 13, 2009 at 05:56:44PM +0100, Andi Kleen wrote: + pci_read_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl); + if (ctrl PCI_SRIOV_CTRL_VFE) { + pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, 0); +

Re: [PATCH] pci: add remove_id sysfs entry

2009-02-13 Thread Greg KH
On Fri, Feb 13, 2009 at 06:12:44PM -0800, Chris Wright wrote: This adds a remove_id sysfs entry to allow users of new_id to later remove the added dynid. One use case is management tools that want to dynamically bind/unbind devices to pci-stub driver while devices are assigned to KVM guests.

Re: [Qemu-devel] Re: qcow2 corruption observed, fixed by reverting old change

2009-02-13 Thread Marc Bevand
On Fri, Feb 13, 2009 at 8:23 AM, Jamie Lokier ja...@shareable.org wrote: Marc.. this is quite a serious bug you've reported. Is there a reason you didn't report it earlier? Because I only started hitting that bug a couple weeks ago after having upgraded to a buggy kvm version. Is there a