Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-11 Thread Oleg Nesterov
On 02/10, Jeremy Fitzhardinge wrote: On 02/10/2015 05:26 AM, Oleg Nesterov wrote: On 02/10, Raghavendra K T wrote: Unfortunately xadd could result in head overflow as tail is high. The other option was repeated cmpxchg which is bad I believe. Any suggestions? Stupid question... what

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-11 Thread Raghavendra K T
On 02/11/2015 11:08 PM, Oleg Nesterov wrote: On 02/11, Raghavendra K T wrote: On 02/10/2015 06:56 PM, Oleg Nesterov wrote: In this case __ticket_check_and_clear_slowpath() really needs to cmpxchg the whole .head_tail. Plus obviously more boring changes. This needs a separate patch even _if_

[PATCH -v5 6/5] context_tracking: fix exception_enter when already in IN_KERNEL

2015-02-11 Thread Rik van Riel
If exception_enter happens when already in IN_KERNEL state, the code still calls context_tracking_exit, which ends up in rcu_eqs_exit_common, which explodes with a WARN_ON when it is called in a situation where dynticks are not enabled. This can be avoided by having exception_enter only switch to

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-11 Thread Oleg Nesterov
On 02/11, Raghavendra K T wrote: On 02/10/2015 06:56 PM, Oleg Nesterov wrote: In this case __ticket_check_and_clear_slowpath() really needs to cmpxchg the whole .head_tail. Plus obviously more boring changes. This needs a separate patch even _if_ this can work. Correct, but apart from

nSVM: Booting L2 results in L1 hang and a skip_emulated_instruction

2015-02-11 Thread Kashyap Chamarthy
Hi, This was tested with kernel-3.19.0-1.fc22) and QEMU (qemu-2.2.0-5.fc22) on L0 L1. Description --- Inside L1, boot a nested KVM guest (L2) . Instead of a full blown guest, let's use `qemu-sanity-check` with KVM: $ qemu-sanity-check --accel=kvm Wwich gives you this CLI (run

Re: [PATCH -v5 6/5] context_tracking: fix exception_enter when already in IN_KERNEL

2015-02-11 Thread Paul E. McKenney
On Wed, Feb 11, 2015 at 02:43:19PM -0500, Rik van Riel wrote: If exception_enter happens when already in IN_KERNEL state, the code still calls context_tracking_exit, which ends up in rcu_eqs_exit_common, which explodes with a WARN_ON when it is called in a situation where dynticks are not

Re: [PATCH] virtual: Documentation: simplify and generalize paravirt_ops.txt

2015-02-11 Thread Rusty Russell
Luis R. Rodriguez mcg...@do-not-panic.com writes: From: Luis R. Rodriguez mcg...@suse.com The general documentation we have for pv_ops is currenty present on the IA64 docs, but since this documentation covers IA64 xen enablement and IA64 Xen support got ripped out a while ago through commit

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-11 Thread Jeremy Fitzhardinge
On 02/11/2015 09:24 AM, Oleg Nesterov wrote: I agree, and I have to admit I am not sure I fully understand why unlock uses the locked add. Except we need a barrier to avoid the race with the enter_slowpath() users, of course. Perhaps this is the only reason? Right now it needs to be a locked

[RFC v2 2/4] KVM: arm: vgic: fix state machine for forwarded IRQ

2015-02-11 Thread Eric Auger
Fix multiple injection of level sensitive forwarded IRQs. With current code, the second injection fails since the state bitmaps are not reset (process_maintenance is not called anymore). New implementation follows those principles: - A forwarded IRQ only can be sampled when it is pending - when

[RFC v2 4/4] KVM: arm: vgic: cleanup forwarded IRQs on destroy

2015-02-11 Thread Eric Auger
When the VGIC is destroyed it must take care of - restoring the forwarded IRQs in non forwarded state, - deactivating the IRQ in case the guest left without doing it - cleaning nodes of the phys_map rbtree Signed-off-by: Eric Auger eric.au...@linaro.org --- v1 - v2: - remove

[RFC v2 3/4] KVM: arm: vgic: add forwarded irq rbtree lock

2015-02-11 Thread Eric Auger
Add a lock related to the rb tree manipulation. The rb tree can be searched in one thread (irqfd handler for instance) and map/unmap may happen in another. Signed-off-by: Eric Auger eric.au...@linaro.org --- v2 - v3: re-arrange lock sequence in vgic_map_phys_irq --- include/kvm/arm_vgic.h | 1

[RFC v2 1/4] chip.c: complete the forwarded IRQ in case the handler is not reached

2015-02-11 Thread Eric Auger
With current handle_fasteoi_irq implementation, in case irqd_irq_disabled is true (disable_irq was called) or !irq_may_run, the IRQ is not completed. Only the running priority is dropped. IN those cases, the IRQ will never be forwarded and hence will never be deactivated by anyone else.

[RFC v2 0/4] chip/vgic adaptations for forwarded irq

2015-02-11 Thread Eric Auger
This series proposes some fixes that appeared to be necessary to integrate IRQ forwarding in KVM/VFIO. - deactivation of the forwarded IRQ in irq_disabled case - a specific handling of forwarded IRQ into the VGIC state machine. - deactivation of physical IRQ and unforwarding on vgic destruction -

[RFC v4 04/13] KVM: kvm-vfio: User API for IRQ forwarding

2015-02-11 Thread Eric Auger
This patch adds and documents a new KVM_DEV_VFIO_DEVICE group and 2 device attributes: KVM_DEV_VFIO_DEVICE_FORWARD_IRQ, KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ. The purpose is to be able to set a VFIO device IRQ as forwarded or not forwarded. the command takes as argument a handle to a new struct named

[RFC v4 11/13] kvm: arm: implement kvm_arch_halt_guest and kvm_arch_resume_guest

2015-02-11 Thread Eric Auger
This patch defines __KVM_HAVE_ARCH_HALT_GUEST and implements kvm_arch_halt_guest and kvm_arch_resume_guest for ARM. On halt, the guest is forced to exit and prevented from being re-entered. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/include/asm/kvm_host.h | 4

[RFC v4 03/13] VFIO: platform: single handler using function pointer

2015-02-11 Thread Eric Auger
A single handler now is registered whatever the use case: automasked or not. A function pointer is set according to the wished behavior and the handler calls this function. The irq lock is taken/released in the root handler. eventfd_signal can be called in regions not allowed to sleep.

[RFC v4 02/13] VFIO: platform: test forwarded state when selecting IRQ handler

2015-02-11 Thread Eric Auger
In case the IRQ is forwarded, the VFIO platform IRQ handler does not need to disable the IRQ anymore. When setting the IRQ handler we now also test the forwarded state. In case the IRQ is forwarded we select the vfio_irq_handler. Signed-off-by: Eric Auger eric.au...@linaro.org --- v3 - v4: -

[RFC v4 13/13] KVM: arm: vgic: forwarding control

2015-02-11 Thread Eric Auger
This patch sets __KVM_HAVE_ARCH_KVM_VFIO_FORWARD and implements kvm_arch_set_forward for ARM. As a result the KVM-VFIO device now allows to forward/unforward a VFIO device IRQ on ARM. kvm_arch_set_forward and kvm_arch_unset_forward mostly take care of VGIC programming: physical IRQ/guest IRQ

[RFC v4 06/13] VFIO: platform: add vfio_external_{mask|is_active|set_automasked}

2015-02-11 Thread Eric Auger
Introduces 3 new external functions aimed at doining some actions on VFIO platform devices: - mask a VFIO IRQ - get the active status of a VFIO IRQ (active at interrupt controller level or masked by the level-sensitive automasking). - change the automasked property and the VFIO handler Note

[RFC v4 05/13] VFIO: external user API for interaction with vfio devices

2015-02-11 Thread Eric Auger
The VFIO external user API is enriched with 3 new functions that allows a kernel user external to VFIO to retrieve some information from a VFIO device. - vfio_device_get_external_user enables to get a vfio device from its fd and increments its reference counter - vfio_device_put_external_user

[RFC v4 12/13] KVM: kvm-vfio: generic forwarding control

2015-02-11 Thread Eric Auger
This patch introduces a new KVM_DEV_VFIO_DEVICE group. This is a new control channel which enables KVM to cooperate with viable VFIO devices. The patch introduces 2 attributes for this group: KVM_DEV_VFIO_DEVICE_FORWARD_IRQ, KVM_DEV_VFIO_DEVICE_UNFORWARD_IRQ. Their purpose is to turn a VFIO

[RFC v4 07/13] KVM: kvm-vfio: wrappers to VFIO external API device helpers

2015-02-11 Thread Eric Auger
Provide wrapper functions that allow KVM-VFIO device code to interact with a vfio device: - kvm_vfio_device_get_external_user gets a handle to a struct vfio_device from the vfio device file descriptor and increments its reference counter, - kvm_vfio_device_put_external_user decrements the

[RFC v4 10/13] kvm: introduce kvm_arch_halt_guest and kvm_arch_resume_guest

2015-02-11 Thread Eric Auger
This API allows to - exit the guest and avoid re-entering it - resume the guest execution Signed-off-by: Eric Auger eric.au...@linaro.org --- include/linux/kvm_host.h | 12 1 file changed, 12 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index

[RFC v4 09/13] KVM: arm: rename pause into power_off

2015-02-11 Thread Eric Auger
The kvm_vcpu_arch pause field is renamed into power_off to prepare for the introduction of a new pause field. Signed-off-by: Eric Auger eric.au...@linaro.org --- arch/arm/include/asm/kvm_host.h | 4 ++-- arch/arm/kvm/arm.c | 10 +- arch/arm/kvm/psci.c | 10

[RFC v4 08/13] KVM: kvm-vfio: wrappers for vfio_external_{mask|is_active|set_automasked}

2015-02-11 Thread Eric Auger
Those 3 new wrapper functions call the respective VFIO external functions. Signed-off-by: Eric Auger eric.au...@linaro.org --- v4: creation --- include/linux/vfio.h | 8 +++- virt/kvm/vfio.c | 44 2 files changed, 47 insertions(+), 5

[RFC v4 01/13] KVM: arm/arm64: Enable the KVM-VFIO device

2015-02-11 Thread Eric Auger
From: Kim Phillips kim.phill...@linaro.org The KVM-VFIO device is used by the QEMU VFIO device. It is used to record the list of in-use VFIO groups so that KVM can manipulate them. With this series, it will also be used to record the forwarded IRQs. Signed-off-by: Kim Phillips

[RFC v4 00/13] KVM-VFIO IRQ forward control

2015-02-11 Thread Eric Auger
This series proposes an integration of ARM: Forwarding physical interrupts to a guest VM (http://lwn.net/Articles/603514/) in KVM. It enables to set/unset forwarding for a VFIO platform device IRQ. A forwarded IRQ is deactivated by the guest and not by the host. When the guest deactivates the

Re: [PATCH] x86 spinlock: Fix memory corruption on completing completions

2015-02-11 Thread Raghavendra K T
On 02/10/2015 06:56 PM, Oleg Nesterov wrote: On 02/10, Raghavendra K T wrote: On 02/10/2015 06:23 AM, Linus Torvalds wrote: add_smp(lock-tickets.head, TICKET_LOCK_INC); if (READ_ONCE(lock-tickets.tail) TICKET_SLOWPATH_FLAG) .. into something like val =

[PATCH kvm-unit-tests] x86: cmpxchg8b: new 32-bit only testcase

2015-02-11 Thread Paolo Bonzini
This is similar to emulator.c, that does not run on 32-bit systems. This bug happens (due to kvm_mmu_page_fault's call to the emulator) during Windows 7 boot. Reported-by: Erik Rull erik.r...@rdsoftware.de Signed-off-by: Paolo Bonzini pbonz...@redhat.com --- config/config-i386.mak | 4 +++-

[Bug 92291] kvm/guest crashes when smp 1 with AMD FX8300; with host kernel oops from abrt as well

2015-02-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=92291 --- Comment #8 from Mark kernelbugzilla.org.mark...@dfgh.net --- Created attachment 166461 -- https://bugzilla.kernel.org/attachment.cgi?id=166461action=edit dmesg -- You are receiving this mail because: You are watching the assignee of the

[Bug 92291] kvm/guest crashes when smp 1 with AMD FX8300; with host kernel oops from abrt as well

2015-02-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=92291 --- Comment #9 from Mark kernelbugzilla.org.mark...@dfgh.net --- I'll try both of your suggestions, thanks -- You are receiving this mail because: You are watching the assignee of the bug. -- To unsubscribe from this list: send the line

Re: nSVM: Booting L2 results in L1 hang and a skip_emulated_instruction

2015-02-11 Thread Jan Kiszka
On 2015-02-11 19:12, Kashyap Chamarthy wrote: Hi, This was tested with kernel-3.19.0-1.fc22) and QEMU (qemu-2.2.0-5.fc22) on L0 L1. Description --- Inside L1, boot a nested KVM guest (L2) . Instead of a full blown guest, let's use `qemu-sanity-check` with KVM: $

[PATCH] KVM: fix possible coalesced_mmio_ring page leaks.

2015-02-11 Thread Xiubo Li
It forgets to free coalesced_mmio_ring page after the anon_inode_getfd fails. Signed-off-by: Xiubo Li lixi...@cmss.chinamobile.com --- virt/kvm/kvm_main.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index