[kvm-unit-tests PATCH 7/7] arm/run: add --debug option

2015-07-03 Thread Alex Bennée
This allows you to pass debug options through to the QEMU command line. e.g.: ./arm/run --debug -name debug-threads=on -- arm/vos-spinlock-test.flat -smp 4 Signed-off-by: Alex Bennée alex.ben...@linaro.org --- arm/run | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Eric Auger
Hi Paolo, On 07/02/2015 03:40 PM, Paolo Bonzini wrote: On 02/07/2015 15:17, Eric Auger wrote: - new fields are added on producer side: linux irq, vfio_device handle, active which reflects whether the source is active (at interrupt controller level or at VFIO level - automasked -) and

Re: [PATCH] KVM: VMX: fix vmwrite to invalid VMCS

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 15:49, Radim Krčmář wrote: fpu_activate is called outside of vcpu_load(), which means it should not touch VMCS, but fpu_activate needs to. Avoid the call by moving it to a point where we know that the guest needs eager FPU and VMCS is loaded. This will get rid of the

[kvm-unit-tests PATCH 6/7] arm/run: introduce basic option parsing

2015-07-03 Thread Alex Bennée
So far this simple option parsing loop allows us to --force-tcg even when running on ARM hardware. Signed-off-by: Alex Bennée alex.ben...@linaro.org --- arm/run | 17 + 1 file changed, 17 insertions(+) diff --git a/arm/run b/arm/run index a3a33b3..43d7508 100755 --- a/arm/run

[kvm-unit-tests PATCH 4/7] run/arm: introduce usingkvm var and use it

2015-07-03 Thread Alex Bennée
This makes it easier to force KVM off in later patches. Signed-off-by: Alex Bennée alex.ben...@linaro.org --- arm/run | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arm/run b/arm/run index 6b42a2e..493ce0d 100755 --- a/arm/run +++ b/arm/run @@ -8,6 +8,16 @@ fi

[kvm-unit-tests PATCH 1/7] READ: add some CONTRIBUTING notes

2015-07-03 Thread Alex Bennée
Signed-off-by: Alex Bennée alex.ben...@linaro.org --- README | 22 ++ 1 file changed, 22 insertions(+) diff --git a/README b/README index e9869d1..4001456 100644 --- a/README +++ b/README @@ -25,3 +25,25 @@ Directory structure: ./ARCH: the sources of the tests and the

[kvm-unit-tests PATCH 5/7] arm/run: clean-up setting of accel options

2015-07-03 Thread Alex Bennée
It would be nice to use --no-kvm but that flags a warning on pure-TCG builds. We echo the fact we are using TCG for the benefit of interactive use. Signed-off-by: Alex Bennée alex.ben...@linaro.org --- arm/run | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arm/run

[kvm-unit-tests PATCH 2/7] configure: emit HOST=$host to config.mak

2015-07-03 Thread Alex Bennée
This is useful information for the run scripts to know, especially if they want to drop to using TCG. Signed-off-by: Alex Bennée alex.ben...@linaro.org --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index b2ad32a..078b70c 100755 --- a/configure +++

[kvm-unit-tests PATCH 3/7] arm/run: set indentation defaults for emacs

2015-07-03 Thread Alex Bennée
Signed-off-by: Alex Bennée alex.ben...@linaro.org --- arm/run | 1 + 1 file changed, 1 insertion(+) diff --git a/arm/run b/arm/run index 662a856..6b42a2e 100755 --- a/arm/run +++ b/arm/run @@ -1,4 +1,5 @@ #!/bin/bash +# -*- sh-basic-offset:8 indent-tabs-mode: t -*- if [ ! -f config.mak ];

[kvm-unit-tests PATCH 0/7] A number of small arm/run fixes

2015-07-03 Thread Alex Bennée
Following on from yesterdays comments I've re-spun the changes as suggested. I've also added a very simple opt parsing for arm/run to allow us to --force-tcg and --debug more qemu cmdline. As a bonus I've codified some notes for contributing into the README. Alex Bennée (7): READ: add some

[Bug 100671] vmwrite error in vmx_vcpu_run

2015-07-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=100671 Andrey Smetanin asmeta...@virtuozzo.com changed: What|Removed |Added CC|

Re: [PATCH] arm/run: don't enable KVM if system can't do it

2015-07-03 Thread Alex Bennée
Andrew Jones drjo...@redhat.com writes: On Thu, Jul 02, 2015 at 03:45:17PM +0200, Paolo Bonzini wrote: On 02/07/2015 13:51, Andrew Jones wrote: 4) I recently mentioned[*] it might be nice to add a '-force-tcg' type of arm/run command line option, allowing tcg to be used even if

Re: [PATCH] arm/run: don't enable KVM if system can't do it

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 14:24, Alex Bennée wrote: Andrew Jones drjo...@redhat.com writes: On Thu, Jul 02, 2015 at 03:45:17PM +0200, Paolo Bonzini wrote: On 02/07/2015 13:51, Andrew Jones wrote: 4) I recently mentioned[*] it might be nice to add a '-force-tcg' type of arm/run command line

[PATCH] KVM: VMX: fix vmwrite to invalid VMCS

2015-07-03 Thread Radim Krčmář
fpu_activate is called outside of vcpu_load(), which means it should not touch VMCS, but fpu_activate needs to. Avoid the call by moving it to a point where we know that the guest needs eager FPU and VMCS is loaded. This will get rid of the following trace vmwrite error: reg 6800 value 0 (err

RE: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-03 Thread Pavel Fedin
Hi! OK so both of you say the same thing. Will respin accordingly You may also want to add this: Tested-by: Pavel Fedin p.fe...@samsung.com Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia -- To unsubscribe from this list: send the line unsubscribe kvm in

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-03 Thread Andre Przywara
Hi, On 03/07/15 10:05, Andre Przywara wrote: Hi Pavel, On 02/07/15 08:26, Pavel Fedin wrote: Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com;

Re: [PATCH 3/3] arm/arm64: speed up spinlocks and atomic ops

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: spinlock torture tests made it clear that checking mmu_enabled() every time we call spin_lock is a bad idea. As most tests will want the MMU enabled the entire time, then we can inline a light weight nobody disabled the mmu check, and bail out early.

Re: [PATCH v7 09/11] KVM: arm64: guest debug, HW assisted debug support

2015-07-03 Thread Alex Bennée
Will Deacon will.dea...@arm.com writes: Hi Alex, On Thu, Jul 02, 2015 at 02:50:33PM +0100, Alex Bennée wrote: Are you happy with this?: [...] +/** + * kvm_arch_dev_ioctl_check_extension + * + * We currently assume that the number of HW registers is uniform + * across all CPUs (see

Re: [PATCH 11/13] KVM: arm64: implement ITS command queue command handlers

2015-07-03 Thread Andre Przywara
Hi Christoffer, + +static struct its_collection *vits_new_collection(struct kvm *kvm, u32 coll_id) +{ +struct its_collection *collection; + +collection = kmalloc(sizeof(struct its_collection), GFP_KERNEL); If I manage to understand the structure here, you're calling all

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Eric Auger
On 07/03/2015 07:20 PM, Paolo Bonzini wrote: On 03/07/2015 15:12, Eric Auger wrote: Linux IRQ and active should be okay. As to the vfio_device handle, you should link it from the vfio_platform_device instead. And for the vfio_platform_device, you can link it from the vfio_platform_irq

[Bug 100671] vmwrite error in vmx_vcpu_run

2015-07-03 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=100671 --- Comment #4 from Andrey Smetanin asmeta...@virtuozzo.com --- Created attachment 181781 -- https://bugzilla.kernel.org/attachment.cgi?id=181781action=edit With this patch(commit revert) the bug disappears Added patch - revert of commit

Re: [PATCH v3 1/2] arm64: KVM: Optimize arm64 skip 30-50% vfp/simd save/restore on exits

2015-07-03 Thread Mario Smarduch
On 07/03/2015 04:53 AM, Christoffer Dall wrote: On Thu, Jul 02, 2015 at 02:51:57PM -0700, Mario Smarduch wrote: On 07/01/2015 06:46 AM, Christoffer Dall wrote: On Wed, Jun 24, 2015 at 05:04:11PM -0700, Mario Smarduch wrote: This patch only saves and restores FP/SIMD registers on Guest access.

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-03 Thread Eric Auger
On 07/03/2015 05:29 PM, Pavel Fedin wrote: Hi! OK so both of you say the same thing. Will respin accordingly You may also want to add this: Tested-by: Pavel Fedin p.fe...@samsung.com Thanks Pavel for the intent. However since I am going to change the uapi and correct the bug you spotted

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 15:12, Eric Auger wrote: Linux IRQ and active should be okay. As to the vfio_device handle, you should link it from the vfio_platform_device instead. And for the vfio_platform_device, you can link it from the vfio_platform_irq instead. For this last one, I don't think this

Re: [PATCH 2/3] arm/arm64: drop mmu_set_enabled

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: The mmu is enabled automatically for all cpus, they must disable it themselves if they don't want it on. Switch from managing a cpumask of enabled cpus to one of disabled cpus. This allows us to remove the mmu_set_enabled call from secondary_cinit,

Re: [PATCH 1/3] arm/arm64: spinlocks: fix memory barriers

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 18:12, Andrew Jones wrote: It shouldn't be necessary to use a barrier on the way into spin_lock. We'll be focused on a single address until we get it (exclusively) set, and then we'll do a barrier on the way out. Also, it does make sense to do a barrier on the way in to

Re: [PATCH 1/3] arm/arm64: Introduce mmu_disable

2015-07-03 Thread Paolo Bonzini
On 25/06/2015 20:45, Andrew Jones wrote: Allow unit test cpus to disable the MMU. Why not? We want the test framework to be as flexible as possible. Callers will have to deal with the cache coherency fallout... Cache flush support is still forthcoming to the framework though.

Re: [PATCH v7 08/11] KVM: arm64: introduce vcpu-arch.debug_ptr

2015-07-03 Thread Christoffer Dall
On Wed, Jul 01, 2015 at 07:29:00PM +0100, Alex Bennée wrote: This introduces a level of indirection for the debug registers. Instead of using the sys_regs[] directly we store registers in a structure in the vcpu. The new kvm_arm_reset_debug_ptr() sets the debug ptr to the guest context.

Re: [PULL] virtio/vhost: cross endian support

2015-07-03 Thread Linus Torvalds
On Fri, Jul 3, 2015 at 12:59 AM, Michael S. Tsirkin m...@redhat.com wrote: Linus, could you please clarify whether making the feature depend on the cross-endian guest support would address your comment, and whether you think this can be merged as is, and the dependency added after -rc1?

Re: [PATCH 11/13] KVM: arm64: implement ITS command queue command handlers

2015-07-03 Thread Christoffer Dall
On Fri, Jul 03, 2015 at 04:57:04PM +0100, Andre Przywara wrote: Hi Christoffer, + +static struct its_collection *vits_new_collection(struct kvm *kvm, u32 coll_id) +{ + struct its_collection *collection; + + collection = kmalloc(sizeof(struct its_collection),

Re: [PATCH v3 09/11] KVM: arm: implement lazy world switch for debug registers

2015-07-03 Thread Christoffer Dall
On Fri, Jul 03, 2015 at 06:06:48PM +0800, Zhichao Huang wrote: On June 30, 2015 9:15:22 PM GMT+08:00, Christoffer Dall christoffer.d...@linaro.org wrote: On Mon, Jun 22, 2015 at 06:41:32PM +0800, Zhichao Huang wrote: Implement switching of the debug registers. While the number of

Re: [PATCH v7 08/11] KVM: arm64: introduce vcpu-arch.debug_ptr

2015-07-03 Thread Christoffer Dall
On Fri, Jul 03, 2015 at 08:14:52AM +0100, Alex Bennée wrote: Christoffer Dall christoffer.d...@linaro.org writes: On Wed, Jul 01, 2015 at 07:29:00PM +0100, Alex Bennée wrote: This introduces a level of indirection for the debug registers. Instead of using the sys_regs[] directly we

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 09:00, Wu, Feng wrote: struct irq_bypass_consumer { struct list_head node; void *token; + unsigned irq;/*got from producer when registered*/ void (*add_producer)(struct irq_bypass_producer *, struct

Re: [PATCH v7 08/11] KVM: arm64: introduce vcpu-arch.debug_ptr

2015-07-03 Thread Alex Bennée
Christoffer Dall christoffer.d...@linaro.org writes: On Wed, Jul 01, 2015 at 07:29:00PM +0100, Alex Bennée wrote: This introduces a level of indirection for the debug registers. Instead of using the sys_regs[] directly we store registers in a structure in the vcpu. The new

RE: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Wu, Feng
-Original Message- From: Paolo Bonzini [mailto:pbonz...@redhat.com] Sent: Friday, July 03, 2015 3:06 PM To: Wu, Feng; Eric Auger; eric.au...@st.com; linux-arm-ker...@lists.infradead.org; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org; christoffer.d...@linaro.org;

Re: [PATCH] arm64/kvm: Add generic v8 KVM target

2015-07-03 Thread Marc Zyngier
On 02/07/15 21:29, Chalamarla, Tirumalesh wrote: is there a chance that this get merged in to 4.2? if not is it possible to accept the other patches like adding implementations explicitly(like Thunder). We first need to reach a conclusion on this. Until then, I don't plan to get anything in.

Re: [PATCH] arm64/kvm: Add generic v8 KVM target

2015-07-03 Thread Marc Zyngier
On 03/07/15 09:12, Peter Maydell wrote: On 3 July 2015 at 09:08, Marc Zyngier marc.zyng...@arm.com wrote: On 02/07/15 21:29, Chalamarla, Tirumalesh wrote: is there a chance that this get merged in to 4.2? if not is it possible to accept the other patches like adding implementations

Re: [PULL] virtio/vhost: cross endian support

2015-07-03 Thread Michael S. Tsirkin
On Thu, Jul 02, 2015 at 08:01:28AM +0200, Michael S. Tsirkin wrote: On Wed, Jul 01, 2015 at 12:02:50PM -0700, Linus Torvalds wrote: On Wed, Jul 1, 2015 at 2:31 AM, Michael S. Tsirkin m...@redhat.com wrote: virtio/vhost: cross endian support Ugh. Does this really have to be dynamic?

Re: [PATCH] arm64/kvm: Add generic v8 KVM target

2015-07-03 Thread Peter Maydell
On 3 July 2015 at 09:08, Marc Zyngier marc.zyng...@arm.com wrote: On 02/07/15 21:29, Chalamarla, Tirumalesh wrote: is there a chance that this get merged in to 4.2? if not is it possible to accept the other patches like adding implementations explicitly(like Thunder). We first need to reach

Re: [RFC PATCH 6/6] powerpc/kvm: change the condition of identifying hugetlb vm

2015-07-03 Thread wenwei tao
Hi Scott Thank you for your comments. Kernel already has that function: is_vm_hugetlb_page() , but the original code didn't use it, in order to keep the coding style of the original code, I didn't use it either. For the sentence like: vma-vm_flags VM_HUGETLB , hiding it behind

Re: [RFC PATCH 6/6] powerpc/kvm: change the condition of identifying hugetlb vm

2015-07-03 Thread wenwei tao
Hi Scott Thank you for your comments. Kernel already has that function: is_vm_hugetlb_page() , but the original code didn't use it, in order to keep the coding style of the original code, I didn't use it either. For the sentence like: vma-vm_flags VM_HUGETLB , hiding it behind

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 08:54, Eric Auger wrote: Oh... we can get gsi from irq_bypass_consumer - _irqfd - gsi, so it is not needed in irq_bypass_consumer. Got it! :) The issue I have is that struct _irqfd is local to eventfd.c so it cannot be used in archi specific code. Is it acceptable to move it

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 02/07/2015 15:17, Eric Auger wrote: + void (*stop_producer)(struct irq_bypass_producer *); + void (*resume_producer)(struct irq_bypass_producer *); Also, can you call these just stop/resume ... + void (*add_consumer)(struct irq_bypass_producer *, +

RE: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Wu, Feng
-Original Message- From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo Bonzini Sent: Friday, July 03, 2015 2:52 PM To: Wu, Feng; Eric Auger; eric.au...@st.com; linux-arm-ker...@lists.infradead.org; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org;

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 04:43, Wu, Feng wrote: struct irq_bypass_consumer { struct list_head node; void *token; + unsigned irq; /*got from producer when registered*/ void (*add_producer)(struct irq_bypass_producer *, struct irq_bypass_consumer

Re: [RFC 12/17] irq: bypass: Extend skeleton for ARM forwarding control

2015-07-03 Thread Eric Auger
Paolo, On 07/03/2015 04:24 AM, Wu, Feng wrote: -Original Message- From: Wu, Feng Sent: Friday, July 03, 2015 10:20 AM To: Paolo Bonzini; Eric Auger; eric.au...@st.com; linux-arm-ker...@lists.infradead.org; kvm...@lists.cs.columbia.edu; kvm@vger.kernel.org;

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-03 Thread Andre Przywara
Hi Pavel, On 02/07/15 08:26, Pavel Fedin wrote: Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com; eric.au...@linaro.org;

Re: [PATCH] arm64/kvm: Add generic v8 KVM target

2015-07-03 Thread Peter Maydell
On 3 July 2015 at 09:28, Marc Zyngier marc.zyng...@arm.com wrote: On 03/07/15 09:12, Peter Maydell wrote: I would still like to see the proponents of this patch say what their model is for userspace support of cross-host migration, if we're abandoning the model the current API envisages. I

Re: [PATCH] arm64/kvm: Add generic v8 KVM target

2015-07-03 Thread Marc Zyngier
On 03/07/15 10:34, Peter Maydell wrote: On 3 July 2015 at 09:28, Marc Zyngier marc.zyng...@arm.com wrote: On 03/07/15 09:12, Peter Maydell wrote: I would still like to see the proponents of this patch say what their model is for userspace support of cross-host migration, if we're abandoning

[[PATCH 2/2] kvm: enable preemption to register/unregister preempt notifier

2015-07-03 Thread Tiejun Chen
After commit 1cde2930e154 (sched/preempt: Add static_key() to preempt_notifiers) is introduced, preempt_notifier_{register, unregister} always hold a mutex, jump_label_mutex. So in current case this shouldn't work further under the circumstance of disabled preemption, and its also safe since we're

[[PATCH 1/2] kvm: make preempt_notifier free out CONFIG_PREEMPT_NOTIFIERS

2015-07-03 Thread Tiejun Chen
In any cases CONFIG_KVM always means CONFIG_PREEMPT_NOTIFIERS is enabled unconditionally so its really pointless. CC: Gleb Natapov g...@kernel.org CC: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Tiejun Chen tiejun.c...@intel.com --- include/linux/kvm_host.h | 2 -- 1 file changed, 2

Re: [PATCH v7 09/11] KVM: arm64: guest debug, HW assisted debug support

2015-07-03 Thread Will Deacon
Hi Alex, On Thu, Jul 02, 2015 at 02:50:33PM +0100, Alex Bennée wrote: Are you happy with this?: [...] +/** + * kvm_arch_dev_ioctl_check_extension + * + * We currently assume that the number of HW registers is uniform + * across all CPUs (see cpuinfo_sanity_check). + */ int

Re: [PATCH 05/10] KVM: arm/arm64: vgic: Relax vgic_can_sample_irq for edge IRQs

2015-07-03 Thread Marc Zyngier
On 02/07/15 17:23, Christoffer Dall wrote: On Wed, Jul 01, 2015 at 07:18:40PM +0100, Marc Zyngier wrote: On 01/07/15 12:58, Christoffer Dall wrote: On Wed, Jul 01, 2015 at 10:17:52AM +0100, Marc Zyngier wrote: On 30/06/15 21:19, Christoffer Dall wrote: On Mon, Jun 08, 2015 at 06:04:00PM

Re: [PATCH v3 08/11] KVM: arm: implement dirty bit mechanism for debug registers

2015-07-03 Thread Zhichao Huang
On June 30, 2015 5:20:20 PM GMT+08:00, Christoffer Dall christoffer.d...@linaro.org wrote: On Mon, Jun 22, 2015 at 06:41:31PM +0800, Zhichao Huang wrote: The trapping code keeps track of the state of the debug registers, allowing for the switch code to implement a lazy switching strategy.

Re: [PATCH 05/10] KVM: arm/arm64: vgic: Relax vgic_can_sample_irq for edge IRQs

2015-07-03 Thread Peter Maydell
On 3 July 2015 at 10:50, Marc Zyngier marc.zyng...@arm.com wrote: On 02/07/15 17:23, Christoffer Dall wrote: If we had a different *shared* device than the timer which is edge-triggered, don't we then also need to capture the physical distributor's pending state along with the state of the

[PATCH v5 02/10] AArch{32,64}: use KVM_CREATE_DEVICE co to instanciate the GIC

2015-07-03 Thread Andre Przywara
From: Marc Zyngier marc.zyng...@arm.com As of 3.14, KVM/arm supports the creation/configuration of the GIC through a more generic device API, which is now the preferred way to do so. Plumb the new API in, and allow the old code to be used as a fallback. [Andre: Rename some functions on the way

[PATCH v5 03/10] irq: add irq__get_nr_allocated_lines

2015-07-03 Thread Andre Przywara
From: Marc Zyngier marc.zyng...@arm.com The ARM GIC emulation needs to be told the number of interrupts it has to support. As commit 1c262fa1dc7bc (kvm tools: irq: make irq__alloc_line generic) made the interrupt counter private, add a new accessor returning the number of interrupt lines we've

[PATCH v5 00/10] kvmtool: arm64: GICv3 guest support

2015-07-03 Thread Andre Przywara
Hi, only very minor changes (patch 7 and 10) compared to v4: Any failure in instantiating a VCPU now makes kvmtool abort, so requesting more VCPUs than the selected kernel's VGIC emulation can handle will let the user know immediately ;-) Also I removed the unneeded initialization of the irqchip

[PATCH v5 01/10] AArch64: Reserve two 64k pages for GIC CPU interface

2015-07-03 Thread Andre Przywara
From: Marc Zyngier marc.zyng...@arm.com On AArch64 system with a GICv2, the GICC range can be aligned to the last 4k block of a 64k page, ending up straddling two 64k pages. In order not to conflict with the distributor mapping, allocate two 64k pages to the CPU interface. Signed-off-by: Marc

[PATCH v5 09/10] arm: add support for supplying GICv3 redistributor addresses

2015-07-03 Thread Andre Przywara
Instead of the GIC virtual CPU interface an emulated GICv3 needs to have accesses to its emulated redistributors trapped in the guest. Add code to tell the kernel about the mapping if a GICv3 emulation was requested by the user. This contains some defines which are not (yet) in the (32 bit)

[PATCH v5 04/10] AArch{32,64}: dynamically configure the number of GIC interrupts

2015-07-03 Thread Andre Przywara
From: Marc Zyngier marc.zyng...@arm.com In order to reduce the memory usage of large guests (as well as improve performance), tell KVM about the number of interrupts we require. To avoid synchronization with the various device creation, use a late_init callback to compute the GIC configuration.

[PATCH v5 06/10] arm: simplify MMIO dispatching

2015-07-03 Thread Andre Przywara
Currently we separate any incoming MMIO request into one of the ARM memory map regions and take care to spare the GIC. It turns out that this is unnecessary, as we only have one special region (the IO port area in the first 64 KByte). The MMIO rbtree takes care about unhandled MMIO ranges, so we

[PATCH v5 10/10] arm: use new irqchip parameter to create different vGIC types

2015-07-03 Thread Andre Przywara
Currently we unconditionally create a virtual GICv2 in the guest. Add a --irqchip= parameter to let the user specify a different GIC type for the guest, when omitting this parameter it still defaults to --irqchip=gicv2. For now the only other supported type is --irqchip=gicv3 Signed-off-by: Andre

[PATCH v5 07/10] limit number of VCPUs on demand

2015-07-03 Thread Andre Przywara
Currently the ARM GIC checks the number of VCPUs against a fixed limit, which is GICv2 specific. Don't pretend we know better than the kernel and let's get rid of that explicit check. We now fail if the number of requested VCPUs could not be instantiated instead of limiting the number of VCPUs.

[PATCH v5 08/10] arm: prepare for instantiating different IRQ chip devices

2015-07-03 Thread Andre Przywara
Extend the vGIC handling code to potentially deal with different IRQ chip devices instead of hard-coding the GICv2 in. We extend most vGIC functions to take a type parameter, but still put GICv2 in at the top for the time being. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by:

[PATCH v5 05/10] arm: finish VGIC initialisation explicitly

2015-07-03 Thread Andre Przywara
Since Linux 3.19-rc1 there is a new API to explicitly initialise the in-kernel GIC emulation by a userland KVM device call. Use that to tell the kernel we are finished with the GIC initialisation, since the automatic GIC init will only be provided as a legacy functionality in the future.

Re: [PATCH v3 09/11] KVM: arm: implement lazy world switch for debug registers

2015-07-03 Thread Zhichao Huang
On June 30, 2015 9:15:22 PM GMT+08:00, Christoffer Dall christoffer.d...@linaro.org wrote: On Mon, Jun 22, 2015 at 06:41:32PM +0800, Zhichao Huang wrote: Implement switching of the debug registers. While the number of registers is massive, CPUs usually don't implement them all (A15 has 6

Re: [[PATCH 2/2] kvm: enable preemption to register/unregister preempt notifier

2015-07-03 Thread Paolo Bonzini
On 03/07/2015 10:56, Tiejun Chen wrote: After commit 1cde2930e154 (sched/preempt: Add static_key() to preempt_notifiers) is introduced, preempt_notifier_{register, unregister} always hold a mutex, jump_label_mutex. So in current case this shouldn't work further under the circumstance of

Re: [PATCH v3 1/2] arm64: KVM: Optimize arm64 skip 30-50% vfp/simd save/restore on exits

2015-07-03 Thread Christoffer Dall
On Thu, Jul 02, 2015 at 02:51:57PM -0700, Mario Smarduch wrote: On 07/01/2015 06:46 AM, Christoffer Dall wrote: On Wed, Jun 24, 2015 at 05:04:11PM -0700, Mario Smarduch wrote: This patch only saves and restores FP/SIMD registers on Guest access. To do this cptr_el2 FP/SIMD trap is set on

Re: [RFC 08/17] kvm: arm/arm64: implement kvm_arm_[halt,resume]_guest

2015-07-03 Thread Eric Auger
Christoffer, Marc, On 07/02/2015 03:17 PM, Eric Auger wrote: On halt, the guest is forced to exit and prevented from being re-entered. This is synchronous. Those two operations will be needed for IRQ forwarding setting. Signed-off-by: Eric Auger eric.au...@linaro.org would you agree to

Re: [PATCH v3 08/11] KVM: arm: implement dirty bit mechanism for debug registers

2015-07-03 Thread Christoffer Dall
On Fri, Jul 03, 2015 at 05:54:47PM +0800, Zhichao Huang wrote: On June 30, 2015 5:20:20 PM GMT+08:00, Christoffer Dall christoffer.d...@linaro.org wrote: On Mon, Jun 22, 2015 at 06:41:31PM +0800, Zhichao Huang wrote: The trapping code keeps track of the state of the debug registers,

[PATCH 5/12] kvm: added KVM_REQ_HV_CRASH value to notify qemu about hyper-v crash

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Added KVM_REQ_HV_CRASH - vcpu request used for notify user space(QEMU) about Hyper-V crash. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org Reviewed-by: Peter Hornyack peterhorny...@google.com CC:

[PATCH v6 0/12] HyperV equivalent of pvpanic driver

2015-07-03 Thread Denis V. Lunev
Windows 2012 guests can notify hypervisor about occurred guest crash (Windows bugcheck(BSOD)) by writing specific Hyper-V msrs. This patch does handling of this MSR's by KVM and sending notification to user space that allows to gather Windows guest crash dump by QEMU/LIBVIRT. The idea is to

[PATCH 1/12] kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com This patch introduce Hyper-V related source code file - hyperv.c and per vm and per vcpu hyperv context structures. All Hyper-V MSR's and hypercall code moved into hyperv.c. All Hyper-V kvm/vcpu fields moved into appropriate hyperv context structures.

[PATCH 10/12] kvm: Add kvm system event crash handler

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com KVM kernel can send guest crash events into userspace. Appropriate guest crash handler is called when kernel guest crash event received. Guest crash event recognized by a KVM_SYSTEM_EVENT_CRASH type of system event. Signed-off-by: Andrey Smetanin

[PATCH 3/12] kvm: add hyper-v crash msrs values

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Added Hyper-V crash msrs values - HV_X64_MSR_CRASH*. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org Reviewed-by: Peter Hornyack peterhorny...@google.com CC: Paolo Bonzini pbonz...@redhat.com CC:

[PATCH 09/12] Added generic panic handler qemu_system_guest_panicked()

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com There are pieces of guest panic handling code that can be shared in one generic function. These code replaced by call qemu_system_guest_panicked(). Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org

[PATCH 12/12] i386/kvm: Hyper-v crash msrs set/get'ers and migration

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com KVM Hyper-V based guests can notify hypervisor about occurred guest crash by writing into Hyper-V crash MSR's. This patch does handling and migration of HV_X64_MSR_CRASH_P0-P4, HV_X64_MSR_CRASH_CTL msrs. User can enable these MSR's by 'hv-crash'

[PATCH 4/12] kvm/x86: added hyper-v crash msrs into kvm hyperv context

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Added kvm Hyper-V context hv crash variables as storage of Hyper-V crash msrs. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org Reviewed-by: Peter Hornyack peterhorny...@google.com CC: Paolo Bonzini

[PATCH 11/12] cpu: Add crash_occurred flag into CPUState

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com CPUState::crash_occurred field inside CPUState marks that guest crash occurred. This value is added into cpu common migration subsection. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org CC: Paolo

[PATCH 6/12] kvm/x86: mark hyper-v crash msrs as partition wide

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Hyper-V crash msr's are per vm, aren't per vcpu, so mark them as partition wide. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org Reviewed-by: Peter Hornyack peterhorny...@google.com CC: Paolo

[PATCH 2/12] kvm: introduce vcpu_debug = kvm_debug + vcpu context

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com vcpu_debug is useful macro like kvm_debug but additionally includes vcpu context inside output. Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com Signed-off-by: Denis V. Lunev d...@openvz.org Reviewed-by: Peter Hornyack peterhorny...@google.com

[PATCH 7/12] kvm/x86: added hyper-v crash data and ctl msr's get/set'ers

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Added hyper-v crash msr's(HV_X64_MSR_CRASH*) data and control geters and setters. Userspace should check that such msr's available by check of KVM_CAP_HYPERV_MSR_CRASH capability. User space allowed to setup Hyper-V crash ctl msr. This msr should be

[PATCH 8/12] kvm/x86: add sending hyper-v crash notification to user space

2015-07-03 Thread Denis V. Lunev
From: Andrey Smetanin asmeta...@virtuozzo.com Sending of notification is done by exiting vcpu to user space if KVM_REQ_HV_CRASH is enabled for vcpu. At exit to user space the kvm_run structure contains system_event with type KVM_SYSTEM_EVENT_CRASH to notify about guest crash occurred.

Re: [RFC 08/17] kvm: arm/arm64: implement kvm_arm_[halt,resume]_guest

2015-07-03 Thread Marc Zyngier
On 03/07/15 12:55, Eric Auger wrote: Christoffer, Marc, On 07/02/2015 03:17 PM, Eric Auger wrote: On halt, the guest is forced to exit and prevented from being re-entered. This is synchronous. Those two operations will be needed for IRQ forwarding setting. Signed-off-by: Eric Auger