[PATCH 2/2] KVM: cleanup pic reset

2012-07-26 Thread Gleb Natapov
kvm_pic_reset() is not used anywhere. Move reset logic from pic_ioport_write() there. Signed-off-by: Gleb Natapov --- arch/x86/kvm/i8259.c | 52 +++--- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kv

[PATCH 1/2] KVM: PIC: call ack notifiers for irqs that are dropped form irr

2012-07-26 Thread Gleb Natapov
After commit 242ec97c358256 PIT interrupts are no longer delivered after PIC reset. It happens because PIT injects interrupt only if previous one was acked, but since on PIC reset it is dropped from irr it will never be delivered and hence acknowledged. Fix that by calling ack notifier on PIC reset

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-26 Thread Paolo Bonzini
Il 25/07/2012 23:04, Boaz Harrosh ha scritto: >> That not all architectures have ARCH_HAS_SG_CHAIN (though all those I >> care about do). So I need to go through all architectures and make sure >> they use for_each_sg, or at least to change ARCH_HAS_SG_CHAIN to a >> Kconfig define so that dependen

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-26 Thread Boaz Harrosh
On 07/26/2012 10:23 AM, Paolo Bonzini wrote: > > In the meanwhile, we still have a bug to fix, and we need to choose > between Sen Wang's v1 (sg_set_page) or v2 (value assignment). I'm still > leaning more towards v2, if only because I already tested that one myself. > It's your call, you kno

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 09:56, Boaz Harrosh ha scritto: >> > In the meanwhile, we still have a bug to fix, and we need to choose >> > between Sen Wang's v1 (sg_set_page) or v2 (value assignment). I'm still >> > leaning more towards v2, if only because I already tested that one myself. > > It's your call, y

Re: [net-next RFC V5 2/5] virtio_ring: move queue_index to vring_virtqueue

2012-07-26 Thread Paolo Bonzini
Il 05/07/2012 13:40, Sasha Levin ha scritto: > @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq) > vring_del_virtqueue(vq); > > /* Select and deactivate the queue */ > - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); > + writel(virtqueue

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/25/2012 10:53 PM, Alex Williamson wrote: > On Wed, 2012-07-25 at 22:30 +0300, Avi Kivity wrote: >> On 07/25/2012 08:03 PM, Alex Williamson wrote: >> > This adds PCI based device assignment to Qemu using the Linux VFIO >> > userspace driver interface. After setting up VFIO device access, >> >

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Avi Kivity
On 07/26/2012 06:58 AM, Xiao Guangrong wrote: > Currently, kvm allocates some pages and use them as error indicators, > it wastes memory and is not good for scalability > > Base on Avi's suggestion, we use the error codes instead of these pages > to indicate the error conditions > > > +static pf

Re: [PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION

2012-07-26 Thread Avi Kivity
On 07/26/2012 05:34 AM, Nicholas A. Bellinger wrote: > > In that case, respinning a -v5 for tcm_vhost to start from ABI=0 and > will post an updated patch shortly. > >> The main thing I would like to confirm is that this only versions the >> tcm_vhost ioctls? In that case a single version number

Re: [PATCH 1/2] KVM: PIC: call ack notifiers for irqs that are dropped form irr

2012-07-26 Thread Avi Kivity
On 07/26/2012 10:00 AM, Gleb Natapov wrote: > After commit 242ec97c358256 PIT interrupts are no longer delivered after > PIC reset. It happens because PIT injects interrupt only if previous one > was acked, but since on PIC reset it is dropped from irr it will never > be delivered and hence acknowl

Re: [PATCH 1/2] KVM: PIC: call ack notifiers for irqs that are dropped form irr

2012-07-26 Thread Gleb Natapov
On Thu, Jul 26, 2012 at 12:09:36PM +0300, Avi Kivity wrote: > On 07/26/2012 10:00 AM, Gleb Natapov wrote: > > After commit 242ec97c358256 PIT interrupts are no longer delivered after > > PIC reset. It happens because PIT injects interrupt only if previous one > > was acked, but since on PIC reset i

Re: [PATCH 1/2] KVM: PIC: call ack notifiers for irqs that are dropped form irr

2012-07-26 Thread Avi Kivity
On 07/26/2012 12:11 PM, Gleb Natapov wrote: > On Thu, Jul 26, 2012 at 12:09:36PM +0300, Avi Kivity wrote: >> On 07/26/2012 10:00 AM, Gleb Natapov wrote: >> > After commit 242ec97c358256 PIT interrupts are no longer delivered after >> > PIC reset. It happens because PIT injects interrupt only if pre

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 11:56:15 +0300 Avi Kivity wrote: > Since my comments are better done as a separate patch, I applied all > three patches. Thanks! Is this patch really safe for all architectures? IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. Isn't it possible to

Re: [PATCH] KVM: emulator: drop unneeded call to get_segment()

2012-07-26 Thread Avi Kivity
On 07/25/2012 03:49 PM, Gleb Natapov wrote: > setup_syscalls_segments() calls get_segment() and than overwrites all > but one of the structure fields and this one should also be overwritten > anyway, so we can drop call to get_segment() and avoid a couple of vmreads > on vmx. Also drop zeroing ss/c

Re: [PATCH v2] KVM: Move KVM_IRQ_LINE to arch-generic code

2012-07-26 Thread Avi Kivity
On 07/24/2012 03:51 PM, Christoffer Dall wrote: > Handle KVM_IRQ_LINE and KVM_IRQ_LINE_STATUS in the generic > kvm_vm_ioctl() function and call into kvm_vm_ioctl_irq_line(). > > This is even more relevant when KVM/ARM also uses this ioctl. Applied, thanks. -- error compiling committee.c: too m

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Xiao Guangrong
On 07/26/2012 04:56 PM, Avi Kivity wrote: > On 07/26/2012 06:58 AM, Xiao Guangrong wrote: >> Currently, kvm allocates some pages and use them as error indicators, >> it wastes memory and is not good for scalability >> >> Base on Avi's suggestion, we use the error codes instead of these pages >> to

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Andreas Hartmann
Avi Kivity wrote: > On 07/25/2012 10:53 PM, Alex Williamson wrote: >> On Wed, 2012-07-25 at 22:30 +0300, Avi Kivity wrote: >>> On 07/25/2012 08:03 PM, Alex Williamson wrote: This adds PCI based device assignment to Qemu using the Linux VFIO userspace driver interface. After setting up VF

Re: [PATCH 0/3] KVM: s390: Trace events support.

2012-07-26 Thread Avi Kivity
On 07/23/2012 06:20 PM, Cornelia Huck wrote: > Avi, Marcelo, > > here's a patch set that introduces trace events for kvm/s390. > > It's split into two parts: > > - Trace points for architecture-defined events, like intercepts. > This patch calls into the disassembler via the interface provided

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Xiao Guangrong
On 07/26/2012 05:20 PM, Takuya Yoshikawa wrote: > On Thu, 26 Jul 2012 11:56:15 +0300 > Avi Kivity wrote: > >> Since my comments are better done as a separate patch, I applied all >> three patches. Thanks! > > Is this patch really safe for all architectures? > > IS_ERR_VALUE() casts -MAX_ERRNO

Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Mian M. Hamayun
Hi Everyone, I want to know if we can force a VMExit on a KVM VCPU currently in Guest Mode from the User Mode ? As an example, I want to execute an IOCTL on a KVM VCPU which is currently in Guest Mode, say it is waiting to execute some guest instructions. As far as I know, the VCPU should no

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/26/2012 12:28 PM, Andreas Hartmann wrote: > Avi Kivity wrote: >> On 07/25/2012 10:53 PM, Alex Williamson wrote: >>> On Wed, 2012-07-25 at 22:30 +0300, Avi Kivity wrote: On 07/25/2012 08:03 PM, Alex Williamson wrote: > This adds PCI based device assignment to Qemu using the Linux VFIO

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Chris Clayton
On 07/19/12 19:23, Chris Clayton wrote: On 07/19/12 13:17, Avi Kivity wrote: On 07/19/2012 03:14 PM, Chris Clayton wrote: Change of diagnostics, unfortunately. qemu-kvm-1.0.1 can, in fact, crash on 3.5.0-rc6 (and rc7). I didn't get it earlier because it takes many times more invocations before

Re: [PATCH v2 3/3] KVM: remove dummy pages

2012-07-26 Thread Takuya Yoshikawa
On Thu, 26 Jul 2012 17:35:13 +0800 Xiao Guangrong wrote: > > Is this patch really safe for all architectures? > > > > IS_ERR_VALUE() casts -MAX_ERRNO to unsigned long and then does comparison. > > Isn't it possible to conflict with valid pfns? > > > > See IS_ERR_VALUE(): > > #define IS_ERR_VA

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Avi Kivity
On 07/26/2012 12:52 PM, Chris Clayton wrote: > On 07/19/12 19:23, Chris Clayton wrote: >> On 07/19/12 13:17, Avi Kivity wrote: >>> On 07/19/2012 03:14 PM, Chris Clayton wrote: >>> > Change of diagnostics, unfortunately. qemu-kvm-1.0.1 can, in fact, > crash > on 3.5.0-rc6 (and rc7). I di

Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Avi Kivity
On 07/26/2012 12:38 PM, Mian M. Hamayun wrote: > > This mechanism 'seems' to work fine when both vcpu threads are in User > Mode. But when booting an SMP Guest, the boot processor (BSP) initially > executes the bootstrap code while the non-boot processors (APs) are > waiting for initial INIT-SI

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Jan Kiszka
On 2012-07-26 12:01, Avi Kivity wrote: > On 07/26/2012 12:52 PM, Chris Clayton wrote: >> On 07/19/12 19:23, Chris Clayton wrote: >>> On 07/19/12 13:17, Avi Kivity wrote: On 07/19/2012 03:14 PM, Chris Clayton wrote: >> Change of diagnostics, unfortunately. qemu-kvm-1.0.1 can, in fact,

Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Mian M. Hamayun
On 07/26/2012 12:06 PM, Avi Kivity wrote: On 07/26/2012 12:38 PM, Mian M. Hamayun wrote: This mechanism 'seems' to work fine when both vcpu threads are in User Mode. But when booting an SMP Guest, the boot processor (BSP) initially executes the bootstrap code while the non-boot processors (A

Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Avi Kivity
On 07/26/2012 01:34 PM, Mian M. Hamayun wrote: > > On 07/26/2012 12:06 PM, Avi Kivity wrote: >> On 07/26/2012 12:38 PM, Mian M. Hamayun wrote: >> >> >> >>> This mechanism 'seems' to work fine when both vcpu threads are in User >>> Mode. But when booting an SMP Guest, the boot processor (BSP) init

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Avi Kivity
On 07/26/2012 01:29 PM, Jan Kiszka wrote: >> It looks like general memory corruption. Is this repeatable? What's >> the guest uptime when it happens (i.e. is it immediate?) >> >> Jan, why are we calling cpu_set_apic_tpr() with kvm_irqchip_in_kernel? > > To sync the userspace state with what th

Re: [PATCH 0/3] KVM: s390: Trace events support.

2012-07-26 Thread Cornelia Huck
On Thu, 26 Jul 2012 12:35:10 +0300 Avi Kivity wrote: > On 07/23/2012 06:20 PM, Cornelia Huck wrote: > > Avi, Marcelo, > > > > here's a patch set that introduces trace events for kvm/s390. > > > > It's split into two parts: > > > > - Trace points for architecture-defined events, like intercepts

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Jan Kiszka
On 2012-07-26 12:45, Avi Kivity wrote: > On 07/26/2012 01:29 PM, Jan Kiszka wrote: > >>> It looks like general memory corruption. Is this repeatable? What's >>> the guest uptime when it happens (i.e. is it immediate?) >>> >>> Jan, why are we calling cpu_set_apic_tpr() with kvm_irqchip_in_kernel?

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Jan Kiszka
On 2012-07-26 12:49, Jan Kiszka wrote: > On 2012-07-26 12:45, Avi Kivity wrote: >> On 07/26/2012 01:29 PM, Jan Kiszka wrote: >> It looks like general memory corruption. Is this repeatable? What's the guest uptime when it happens (i.e. is it immediate?) Jan, why are we calling

Re: [PATCH 0/3] KVM: s390: Trace events support.

2012-07-26 Thread Avi Kivity
On 07/26/2012 01:47 PM, Cornelia Huck wrote: > On Thu, 26 Jul 2012 12:35:10 +0300 > Avi Kivity wrote: > >> On 07/23/2012 06:20 PM, Cornelia Huck wrote: >> > Avi, Marcelo, >> > >> > here's a patch set that introduces trace events for kvm/s390. >> > >> > It's split into two parts: >> > >> > - Tr

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Xiao Guangrong
Hi Chris, Could you please try this patch? http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=ccebf448daf7964ee2aff7947c0bbe4c7962d059 On 07/26/2012 05:52 PM, Chris Clayton wrote: > On 07/19/12 19:23, Chris Clayton wrote: >> On 07/19/12 13:17, Avi Kivity wrote: >>> On 07/19/

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Chris Clayton
On 07/26/12 11:01, Avi Kivity wrote: On 07/26/2012 12:52 PM, Chris Clayton wrote: On 07/19/12 19:23, Chris Clayton wrote: On 07/19/12 13:17, Avi Kivity wrote: On 07/19/2012 03:14 PM, Chris Clayton wrote: Change of diagnostics, unfortunately. qemu-kvm-1.0.1 can, in fact, crash on 3.5.0-rc6 (a

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Avi Kivity
On 07/26/2012 02:58 PM, Chris Clayton wrote: >> It looks like general memory corruption. Is this repeatable? What's >> the guest uptime when it happens (i.e. is it immediate?) > > I've just done 10 runs of WinXP SP3 and 5 of them crashed. Three crashed > early as XP was starting up - well befor

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Jan Kiszka
On 2012-07-26 13:58, Chris Clayton wrote: > On 07/26/12 11:01, Avi Kivity wrote: >> On 07/26/2012 12:52 PM, Chris Clayton wrote: >>> On 07/19/12 19:23, Chris Clayton wrote: On 07/19/12 13:17, Avi Kivity wrote: > On 07/19/2012 03:14 PM, Chris Clayton wrote: > >>> Change of diagnosti

[RFC PATCH] KVM: Only print vcpu_unimpl when DEBUG is set

2012-07-26 Thread Markus Trippelsdorf
Every time I start qemu-kvm on my system the following line is added to the syslog: vcpu0 unhandled rdmsr: 0xc0010001 AFAICS all calls to vcpu_unimpl only contain debugging info with little or no value for the end user. Wouldn't something like the following patch make sense? Signed-off-by: Mar

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini wrote: > Il 25/07/2012 05:31, Liu Ping Fan ha scritto: >> From: Liu Ping Fan >> >> rwlock: >> qemu_device_tree_mutex >> >> rd side: >> --device_del(destruction of device will be postphoned until unplug >> ack from guest), >> --pci hot-unplu

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 5:18 PM, Paolo Bonzini wrote: > Il 25/07/2012 10:12, liu ping fan ha scritto: >> +qemu_rwlock_rdlock_devtree(); >> section = phys_page_find(page >> TARGET_PAGE_BITS); >> +if (!(memory_region_is_ram(section->mr) || >> +

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread Avi Kivity
On 07/26/2012 03:56 PM, liu ping fan wrote: > On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini wrote: >> Il 25/07/2012 05:31, Liu Ping Fan ha scritto: >>> From: Liu Ping Fan >>> >>> rwlock: >>> qemu_device_tree_mutex >>> >>> rd side: >>> --device_del(destruction of device will be postphoned unt

Re: virtio(-scsi) vs. chained sg_lists (was Re: [PATCH] scsi: virtio-scsi: Fix address translation failure of HighMem pages used by sg list)

2012-07-26 Thread Paolo Bonzini
Il 26/07/2012 09:58, Paolo Bonzini ha scritto: > >> > Please CC me on the "convert to sg copy-less" patches, It looks interesting > Sure. Well, here is the gist of it (note it won't apply on any public tree, hence no SoB yet). It should be split in multiple changesets and you can make more simpl

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-26 Thread liu ping fan
On Wed, Jul 25, 2012 at 8:27 PM, Avi Kivity wrote: > On 07/25/2012 01:58 PM, Avi Kivity wrote: >>> while (len > 0) { >>> page = addr & TARGET_PAGE_MASK; >>> l = (page + TARGET_PAGE_SIZE) - addr; >>> if (l > len) >>> l = len; >>> + >>> +qemu_rwlo

Re: [PATCH 2/5] exec.c: use refcnt to protect device during dispatching

2012-07-26 Thread Avi Kivity
On 07/26/2012 04:06 PM, liu ping fan wrote: > On Wed, Jul 25, 2012 at 8:27 PM, Avi Kivity wrote: >> On 07/25/2012 01:58 PM, Avi Kivity wrote: while (len > 0) { page = addr & TARGET_PAGE_MASK; l = (page + TARGET_PAGE_SIZE) - addr; if (l > len) >>>

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Thu, Jul 26, 2012 at 9:00 PM, Avi Kivity wrote: > On 07/26/2012 03:56 PM, liu ping fan wrote: >> On Wed, Jul 25, 2012 at 5:08 PM, Paolo Bonzini wrote: >>> Il 25/07/2012 05:31, Liu Ping Fan ha scritto: From: Liu Ping Fan rwlock: qemu_device_tree_mutex rd side: >

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread Avi Kivity
On 07/26/2012 04:14 PM, liu ping fan wrote: >> >> From the description above, I don't see why it can't be a mutex. >> > Searching in the device tree (or MemoryRegion view) can be often in > parallel, especially in mmio-dispatch code path In mmio dispatch we have a pointer to the object, we don't n

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread liu ping fan
On Thu, Jul 26, 2012 at 9:15 PM, Avi Kivity wrote: > On 07/26/2012 04:14 PM, liu ping fan wrote: >>> >>> From the description above, I don't see why it can't be a mutex. >>> >> Searching in the device tree (or MemoryRegion view) can be often in >> parallel, especially in mmio-dispatch code path >

[kvm:auto-next 24/39] (.init.rodata+0x830): undefined reference to `x86_hyper_kvm'

2012-07-26 Thread Fengguang Wu
Hi Raghavendra, Kernel build failed on tree: git://git.kernel.org/pub/scm/virt/kvm/kvm.git auto-next head: 12938728e8145ecd49dce97c52f10b713bcdfc94 commit: f2a743473194a1ad44a85f8b63aeef9d63e5bf47 [24/39] KVM: Add config to support ple or cpu relax optimzation config: x86_64-alldefconfig (at

[PATCH 2/2] virtio-scsi: support online resizing of disks

2012-07-26 Thread Paolo Bonzini
Support the LUN parameter change event. Currently, the host fires this event when the capacity of a disk is changed from the virtual machine monitor. The resize then appears in the kernel log like this: sd 0:0:0:0: [sda] 46137344 512-byte logical blocks: (23.6 GB/22.0 GIb) sda: detected capac

[PATCH 0/2] virtio-scsi fixes for 3.6

2012-07-26 Thread Paolo Bonzini
James, patch 1 fixes scanning of LUNs whose number is greater than 255. QEMU passes a max_lun of 16383 (because it uses SAM numbering) but in Linux it must become 32768 (because LUNs above 255 are "relocated" to 16640). Patch 2 is a resubmission of the patch for online resizing of virtio-scsi LUN

[PATCH 1/2] virtio-scsi: fix LUNs greater than 255

2012-07-26 Thread Paolo Bonzini
virtio-scsi needs to report LUNs greater than 256 using the "flat" format. Because the Linux SCSI layer just maps the SCSI LUN to an u32, without any parsing, these end up in the range from 16640 to 32767. Fix max_lun to account for the possibility that logical unit numbers are encoded with the "

Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Mian M. Hamayun
On 07/26/2012 12:43 PM, Avi Kivity wrote: On 07/26/2012 01:34 PM, Mian M. Hamayun wrote: On 07/26/2012 12:06 PM, Avi Kivity wrote: On 07/26/2012 12:38 PM, Mian M. Hamayun wrote: This mechanism 'seems' to work fine when both vcpu threads are in User Mode. But when booting an SMP Guest, the

Re: [PATCH 1/5] qom: adopt rwlock to protect accessing dev from removing it

2012-07-26 Thread Avi Kivity
On 07/26/2012 04:21 PM, liu ping fan wrote: > On Thu, Jul 26, 2012 at 9:15 PM, Avi Kivity wrote: >> On 07/26/2012 04:14 PM, liu ping fan wrote: From the description above, I don't see why it can't be a mutex. >>> Searching in the device tree (or MemoryRegion view) can be often in >>

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Andreas Hartmann
Avi Kivity schrieb: > On 07/26/2012 12:28 PM, Andreas Hartmann wrote: >> Avi Kivity wrote: >>> On 07/25/2012 10:53 PM, Alex Williamson wrote: On Wed, 2012-07-25 at 22:30 +0300, Avi Kivity wrote: > On 07/25/2012 08:03 PM, Alex Williamson wrote: >> This adds PCI based device assignment t

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Chris Clayton
On 07/26/12 12:10, Xiao Guangrong wrote: Hi Chris, Could you please try this patch? http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=ccebf448daf7964ee2aff7947c0bbe4c7962d059 Sorry, that patch does not fix the crashes. On 07/26/2012 05:52 PM, Chris Clayton wrote: On

Re: Can we force a KVM VCPU in Guest Mode to Exit to User Mode From User Mode ?

2012-07-26 Thread Avi Kivity
On 07/26/2012 04:39 PM, Mian M. Hamayun wrote: >> >> Can you share your reproducer? > Actually its based on kvm-tool and I have integrated some code from > qemu-kvm to add debug support to kvm-tool. > I don't have a smaller example that could reproduce the same problem. Then there's probably a bug

Re: [kvm:auto-next 24/39] (.init.rodata+0x830): undefined reference to `x86_hyper_kvm'

2012-07-26 Thread Avi Kivity
On 07/26/2012 04:26 PM, Fengguang Wu wrote: > Hi Raghavendra, > > Kernel build failed on > > tree: git://git.kernel.org/pub/scm/virt/kvm/kvm.git auto-next > head: 12938728e8145ecd49dce97c52f10b713bcdfc94 > commit: f2a743473194a1ad44a85f8b63aeef9d63e5bf47 [24/39] KVM: Add config to > support

Re: [kvm:auto-next 24/39] (.init.rodata+0x830): undefined reference to `x86_hyper_kvm'

2012-07-26 Thread Fengguang Wu
Hi Avi, On Thu, Jul 26, 2012 at 04:58:35PM +0300, Avi Kivity wrote: > On 07/26/2012 04:26 PM, Fengguang Wu wrote: > > Hi Raghavendra, > > > > Kernel build failed on > > > > tree: git://git.kernel.org/pub/scm/virt/kvm/kvm.git auto-next > > head: 12938728e8145ecd49dce97c52f10b713bcdfc94 > > co

Re: [kvm:auto-next 24/39] (.init.rodata+0x830): undefined reference to `x86_hyper_kvm'

2012-07-26 Thread Avi Kivity
On 07/26/2012 05:03 PM, Fengguang Wu wrote: > Hi Avi, > > On Thu, Jul 26, 2012 at 04:58:35PM +0300, Avi Kivity wrote: >> On 07/26/2012 04:26 PM, Fengguang Wu wrote: >> > Hi Raghavendra, >> > >> > Kernel build failed on >> > >> > tree: git://git.kernel.org/pub/scm/virt/kvm/kvm.git auto-next >>

Re: [kvm:auto-next 24/39] (.init.rodata+0x830): undefined reference to `x86_hyper_kvm'

2012-07-26 Thread Fengguang Wu
On Thu, Jul 26, 2012 at 05:13:45PM +0300, Avi Kivity wrote: > On 07/26/2012 05:03 PM, Fengguang Wu wrote: > > Hi Avi, > > > > On Thu, Jul 26, 2012 at 04:58:35PM +0300, Avi Kivity wrote: > >> On 07/26/2012 04:26 PM, Fengguang Wu wrote: > >> > Hi Raghavendra, > >> > > >> > Kernel build failed on >

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 11:35 +0300, Avi Kivity wrote: > On 07/25/2012 10:53 PM, Alex Williamson wrote: > > On Wed, 2012-07-25 at 22:30 +0300, Avi Kivity wrote: > >> On 07/25/2012 08:03 PM, Alex Williamson wrote: > >> > This adds PCI based device assignment to Qemu using the Linux VFIO > >> > userspa

[PATCH 0/4] kvm_timer cleanup

2012-07-26 Thread Avi Kivity
While preparing to fix up KVM_REQ_PENDING_TIMERS, and looking for a bug that turned out not to exist, I cleaned up kvm_timer a little. Avi Kivity (4): KVM: Remove internal timer abstraction. KVM: Simplify kvm_timer KVM: Simplify kvm_pit_timer KVM: fold kvm_pit_timer into kvm_kpit_state

[PATCH 1/4] KVM: Remove internal timer abstraction

2012-07-26 Thread Avi Kivity
kvm_timer_fn(), the sole inhabitant of timer.c, is only used by lapic.c. Move it there to make it easier to hack on it. struct kvm_timer is a thin wrapper around hrtimer, and only adds obfuscation. Move near its two users (with different names) to prepare for simplification. Signed-off-by: Avi Ki

[PATCH 2/4] KVM: Simplify kvm_timer

2012-07-26 Thread Avi Kivity
'reinject' is never initialized 't_ops' only serves as indirection to lapic_is_periodic; call that directly instead 'kvm' is never used 'vcpu' can be derived via container_of Remove these fields. Signed-off-by: Avi Kivity --- arch/x86/kvm/lapic.c | 18 +- arch/x86/kvm/lapic.h

[PATCH 3/4] KVM: Simplify kvm_pit_timer

2012-07-26 Thread Avi Kivity
'timer_mode_mask' is unused 'tscdeadline' is unused 't_ops' only adds needless indirection 'vcpu' is unused Remove. Signed-off-by: Avi Kivity --- arch/x86/kvm/i8254.c | 14 +- arch/x86/kvm/i8254.h | 8 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/arch/x86

[PATCH 4/4] KVM: fold kvm_pit_timer into kvm_kpit_state

2012-07-26 Thread Avi Kivity
One structure nests inside the other, providing no value at all. Signed-off-by: Avi Kivity --- arch/x86/kvm/i8254.c | 52 +--- arch/x86/kvm/i8254.h | 14 +- arch/x86/kvm/x86.c | 2 +- 3 files changed, 31 insertions(+), 37 deletions(-

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Wed, 2012-07-25 at 11:03 -0600, Alex Williamson wrote: > This adds PCI based device assignment to Qemu using the Linux VFIO > userspace driver interface. After setting up VFIO device access, > devices can be added to Qemu guests using the vfio-pci device > option: > > -device vfio-pci,host=1:

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/26/2012 05:56 PM, Alex Williamson wrote: >> >> Let's use the same syntax as for kvm device assignment. Then we can >> >> fall back on kvm when vfio is not available. We can also have an >> >> optional parameter kernel-driver to explicitly select vfio or kvm. >> > >> > This seems confusing

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/26/2012 05:56 PM, Alex Williamson wrote: > > Both KVM and VFIO do strive to make the device in the guest look as much > like it does on bare metal as possible, but we don't guarantee they're > identical and we don't guarantee to match each other. btw, this is somewhat problematic, conceivab

[GIT PULL (PATCH 0/4) v2] VFIO driver for v3.6

2012-07-26 Thread Alex Williamson
On Wed, 2012-07-25 at 08:53 -0600, Alex Williamson wrote: > Hi Linus, > > This series includes the VFIO userspace driver interface for the > 3.6 kernel merge window. This driver is intended to provide a > secure interface for device access using IOMMU protection for > applications like assignment

Re: [Qemu-devel] [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/25/2012 08:03 PM, Alex Williamson wrote: > +/* > + * Resource setup > + */ > +static void vfio_unmap_bar(VFIODevice *vdev, int nr) > +{ > +VFIOBAR *bar = &vdev->bars[nr]; > +uint64_t size; > + > +if (!memory_region_size(&bar->mem)) { > +return; > +} > + > +size =

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 18:59 +0300, Avi Kivity wrote: > On 07/26/2012 05:56 PM, Alex Williamson wrote: > >> >> Let's use the same syntax as for kvm device assignment. Then we can > >> >> fall back on kvm when vfio is not available. We can also have an > >> >> optional parameter kernel-driver to ex

Re: [Qemu-devel] [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 19:34 +0300, Avi Kivity wrote: > On 07/25/2012 08:03 PM, Alex Williamson wrote: > > > +/* > > + * Resource setup > > + */ > > +static void vfio_unmap_bar(VFIODevice *vdev, int nr) > > +{ > > +VFIOBAR *bar = &vdev->bars[nr]; > > +uint64_t size; > > + > > +if (!memo

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/26/2012 07:40 PM, Alex Williamson wrote: > On Thu, 2012-07-26 at 19:06 +0300, Avi Kivity wrote: >> On 07/26/2012 05:56 PM, Alex Williamson wrote: >> > >> > Both KVM and VFIO do strive to make the device in the guest look as much >> > like it does on bare metal as possible, but we don't guara

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 19:06 +0300, Avi Kivity wrote: > On 07/26/2012 05:56 PM, Alex Williamson wrote: > > > > Both KVM and VFIO do strive to make the device in the guest look as much > > like it does on bare metal as possible, but we don't guarantee they're > > identical and we don't guarantee to

Re: [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Avi Kivity
On 07/26/2012 07:33 PM, Alex Williamson wrote: >> >> In the common case, on x86 (but I'm repeating myself), the iommu group >> includes just one device, yes? Could we make pci-stub an alias for the >> corresponding vfio steps? > > PCI bridges masking devices is not as uncommon as you'd like, tha

Re: [Qemu-devel] [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 19:40 +0300, Avi Kivity wrote: > On 07/26/2012 07:33 PM, Alex Williamson wrote: > >> > >> In the common case, on x86 (but I'm repeating myself), the iommu group > >> includes just one device, yes? Could we make pci-stub an alias for the > >> corresponding vfio steps? > > >

Re: [PATCH] tcm_vhost: Expose ABI version via VHOST_SCSI_GET_ABI_VERSION

2012-07-26 Thread Nicholas A. Bellinger
On Thu, 2012-07-26 at 11:58 +0300, Avi Kivity wrote: > On 07/26/2012 05:34 AM, Nicholas A. Bellinger wrote: > > > > In that case, respinning a -v5 for tcm_vhost to start from ABI=0 and > > will post an updated patch shortly. > > > >> The main thing I would like to confirm is that this only versio

Re: [Android-virt] [PATCH v9 16/16] ARM: KVM: Guest wait-for-interrupts (WFI) support

2012-07-26 Thread Christoffer Dall
On Tue, Jul 3, 2012 at 3:49 PM, Peter Maydell wrote: > On 3 July 2012 14:24, Avi Kivity wrote: >> On 07/03/2012 04:14 PM, Peter Maydell wrote: >>> You could just always wake the cpu when migrating: the >>> architecture allows WFI to return early for any reason >>> it likes including implementatio

Re: [Android-virt] [PATCH v9 00/16] KVM/ARM Implementation

2012-07-26 Thread Christoffer Dall
On Tue, Jul 3, 2012 at 3:51 PM, Peter Maydell wrote: > On 3 July 2012 14:29, Avi Kivity wrote: >> On 07/03/2012 11:59 AM, Christoffer Dall wrote: >>> Additionally a few major milestones are coming up shortly: >>> - Support Thumb MMIO emulation and test MMIO emulation code (under way) >>> - Merg

Re: [Android-virt] [PATCH v9 00/16] KVM/ARM Implementation

2012-07-26 Thread Peter Maydell
On 26 July 2012 22:15, Christoffer Dall wrote: > On Tue, Jul 3, 2012 at 3:51 PM, Peter Maydell > wrote: >> We've gone back and forth on this one, I think. For an A15 guest >> we want to say that userspace GIC isn't permitted (ie you must use >> the in-kernel-irqchip). For an A9 guest you would h

Re: [Android-virt] [PATCH v9 00/16] KVM/ARM Implementation

2012-07-26 Thread Christoffer Dall
On Thu, Jul 26, 2012 at 11:21 PM, Peter Maydell wrote: > On 26 July 2012 22:15, Christoffer Dall wrote: >> On Tue, Jul 3, 2012 at 3:51 PM, Peter Maydell >> wrote: >>> We've gone back and forth on this one, I think. For an A15 guest >>> we want to say that userspace GIC isn't permitted (ie you m

Re: [Qemu-devel] [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Andreas Hartmann
Alex Williamson wrote: [I removed qemu-devel because I'm not registered there] > On Thu, 2012-07-26 at 19:40 +0300, Avi Kivity wrote: >> On 07/26/2012 07:33 PM, Alex Williamson wrote: In the common case, on x86 (but I'm repeating myself), the iommu group includes just one device, y

Re: [PATCH v9 01/16] ARM: add mem_type prot_pte accessor

2012-07-26 Thread Christoffer Dall
On Fri, Jul 20, 2012 at 4:54 PM, Andreas Färber wrote: > Am 03.07.2012 10:59, schrieb Christoffer Dall: >> From: Marc Zyngier >> >> The KVM hypervisor mmu code requires requires access to the > > "code requires access" > thanks, -Christoffer -- To unsubscribe from this list: send the line "unsub

Re: [Qemu-devel] [RFC PATCH] vfio: VFIO PCI driver for Qemu

2012-07-26 Thread Alex Williamson
On Thu, 2012-07-26 at 23:23 +0200, Andreas Hartmann wrote: > Alex Williamson wrote: > > [I removed qemu-devel because I'm not registered there] > > > On Thu, 2012-07-26 at 19:40 +0300, Avi Kivity wrote: > >> On 07/26/2012 07:33 PM, Alex Williamson wrote: > > In the common case, on x86 (

Re: [PATCH 1/2] KVM: PPC: booke: Allow multiple exception types

2012-07-26 Thread Scott Wood
On 07/26/2012 12:32 AM, Bharat Bhushan wrote: > _GLOBAL(kvmppc_handlers_start) > KVM_HANDLER BOOKE_INTERRUPT_CRITICAL SPRN_SPRG_RSCRATCH_CRIT SPRN_CSRR0 > KVM_HANDLER BOOKE_INTERRUPT_MACHINE_CHECK SPRN_SPRG_RSCRATCH_MC SPRN_MCSRR0 > @@ -94,6 +98,7 @@ KVM_HANDLER BOOKE_INTERRUPT_DEBUG SPRN_SPRG_

Re: qemu-kvm-1.1.0 crashing with kernel 3.5.0-rc6

2012-07-26 Thread Chris Clayton
On 07/26/12 13:07, Avi Kivity wrote: On 07/26/2012 02:58 PM, Chris Clayton wrote: It looks like general memory corruption. Is this repeatable? What's the guest uptime when it happens (i.e. is it immediate?) I've just done 10 runs of WinXP SP3 and 5 of them crashed. Three crashed early as XP

[RFC-v5] tcm_vhost: Initial merge for vhost level target fabric driver

2012-07-26 Thread Nicholas A. Bellinger
From: Nicholas Bellinger Hello KVM + QEMU folks, This is -v5 of the in-flight tcm_vhost fabric driver for KVM host virtualized target support using the in-kernel storage stack with for-3.6 code. The changes since -v4 have been pretty minimal. A new GET_ABI_VERSION ioctl has been added as reque

KVM: PPC: Book3S HV: Fix incorrect branch in H_CEDE code

2012-07-26 Thread Paul Mackerras
In handling the H_CEDE hypercall, if this vcpu has already been prodded (with the H_PROD hypercall, which Linux guests don't in fact use), we branch to a numeric label '1f'. Unfortunately there is another '1:' label before the one that we want to jump to. This fixes the problem by using a textual

Re: [PATCH 2/2] KVM: PPC: booke/bookehv: Add guest debug support

2012-07-26 Thread Scott Wood
On 07/26/2012 12:32 AM, Bharat Bhushan wrote: > This patch adds: > 1) KVM debug handler added for e500v2. > 2) Guest debug by qemu gdb stub. Does it make sense for these to both be in the same patch? If there's common code used by both, that could be added first. > Signed-off-by: Liu Yu > Sig

Re: [PATCH V3 3/3] virtio-blk: Add bio-based IO path for virtio-blk

2012-07-26 Thread Rusty Russell
On Fri, 13 Jul 2012 16:38:51 +0800, Asias He wrote: > Add 'virtio_blk.use_bio=1' to kernel cmdline or 'modprobe virtio_blk > use_bio=1' to enable ->make_request_fn() based I/O path. This patch conflicts with Paolo's Bonzini's 'virtio-blk: allow toggling host cache between writeback and writethrou

[PATCH] KVM: PPC: Quieten message about allocating linear regions

2012-07-26 Thread Paul Mackerras
This message is printed once for every RMA or HPT region that gets preallocated. If one preallocates hundreds of such regions (in order to run hundreds of KVM guests), that gets rather painful, so make it a bit quieter. Signed-off-by: Paul Mackerras --- arch/powerpc/kvm/book3s_hv_builtin.c |

Re: [GIT PULL (PATCH 0/4)] VFIO driver for v3.6

2012-07-26 Thread Paul Mackerras
On Wed, Jul 25, 2012 at 08:53:06AM -0600, Alex Williamson wrote: > Hi Linus, > > This series includes the VFIO userspace driver interface for the > 3.6 kernel merge window. This driver is intended to provide a > secure interface for device access using IOMMU protection for > applications like ass

[PATCH] powerpc/kvm: Allow qemu hypercalls to set all regs

2012-07-26 Thread Benjamin Herrenschmidt
Right now, whenever we exit for an hcall, upon return, we fetch some register values from the structure that carries the hcall results and update the vcpu accordingly. However, if the hypercall chooses instead to update the registers itself by calling set_regs, then we end up clobbering those valu