Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Jan Kiszka
On 2015-06-25 11:25, Claudio Fontana wrote: > On 25.06.2015 11:10, Peter Maydell wrote: >> On 25 June 2015 at 09:59, Claudio Fontana wrote: >>> Once the VM is created, I think QEMU should not request kvm to >>> change the virtual offset of the VM anymore: maybe an unexpected >>> consequence of QEM

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

2015-06-25 Thread Andrew Jones
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. Adding a light weight inlined check vs. a com

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

2015-06-25 Thread Andrew Jones
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, and the function all together. Signed-off-by: And

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

2015-06-25 Thread Andrew Jones
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. Signed-off-by: Andrew Jones --- arm/cstart.S | 9 ++

[PATCH 0/3] arm/arm64: rework mmu_enabled, for spinlock speedup

2015-06-25 Thread Andrew Jones
Andrew Jones (3): arm/arm64: Introduce mmu_disable arm/arm64: drop mmu_set_enabled arm/arm64: speed up spinlocks and atomic ops arm/cstart.S | 9 + arm/cstart64.S| 8 lib/arm/asm/mmu-api.h | 9 +++-- lib/arm/mmu.c | 32 ++-

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

2015-06-25 Thread Andrew Jones
On Thu, Jun 25, 2015 at 06:23:48PM +0200, Paolo Bonzini wrote: > > > On 25/06/2015 18:12, 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 just

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

2015-06-25 Thread Paolo Bonzini
On 25/06/2015 18:12, 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 just hard code > mmu_enabled() to true. Tests that want to play with the MMU ca

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

2015-06-25 Thread Andrew Jones
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 just hard code mmu_enabled() to true. Tests that want to play with the MMU can be compiled with CONFIG_MAY_DISABLE_MMU to get th

[PATCH 3/3] arm/arm64: allow building a single test

2015-06-25 Thread Andrew Jones
This is mostly useful for building new tests that don't yet (and may never) have entries in the makefiles (config-arm*.mak). Of course it can be used to build tests that do have entries as well, in order to avoid building all tests, if the plan is to run just the one. Just do 'make TEST=some-test'

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

2015-06-25 Thread Andrew Jones
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 spin_unlock, i.e. ensure what we did in the critical se

[PATCH 0/3] arm/arm64: tcg_baremetal_tests inspired patches

2015-06-25 Thread Andrew Jones
While porting the test in virtualopensystems' tcg_baremetal_tests to kvm-unit-tests, I found a couple places to improve the spinlock implementation. I also added a way to build a single test that doesn't necessary have an entry in the makefile, which should be handy for experimental tests. Andrew

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

2015-06-25 Thread Peter Maydell
On 25 June 2015 at 14:44, Marc Zyngier wrote: > It should always be possible to emulate a "known" CPU on a generic host, > and it should be able to migrate. The case we can't migrate is when we > let the guest be generic (which I guess should really be unknown, and > not generic). > > So if the us

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

2015-06-25 Thread Marc Zyngier
On 25/06/15 13:40, Marc Zyngier wrote: > On 25/06/15 13:30, Christoffer Dall wrote: >> On Wed, Jun 24, 2015 at 10:32:38AM +0100, Marc Zyngier wrote: >>> Hi Christoffer, >>> >>> On 24/06/15 09:51, Christoffer Dall wrote: On Wed, Jun 24, 2015 at 09:29:56AM +0100, Marc Zyngier wrote: > On 22/

Re: should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus?

2015-06-25 Thread Peter Maydell
On 25 June 2015 at 13:41, Christoffer Dall wrote: > On Thu, Jun 25, 2015 at 10:06:20AM +0100, Peter Maydell wrote: >> I agree it's not very likely anybody cares about the specific cluster >> topology. However if we don't want to support arbitrary topologies >> then QEMU is going to end up in the b

Re: should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus?

2015-06-25 Thread Christoffer Dall
On Thu, Jun 25, 2015 at 10:06:20AM +0100, Peter Maydell wrote: > On 25 June 2015 at 09:00, Christoffer Dall > wrote: > > Of course, KVM can deny an unsupported configuration, but I am wondering > > if we really think anybody will care about the 'model such specific > > hardware' aspect with KVM,

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

2015-06-25 Thread Marc Zyngier
On 25/06/15 13:30, Christoffer Dall wrote: > On Wed, Jun 24, 2015 at 10:32:38AM +0100, Marc Zyngier wrote: >> Hi Christoffer, >> >> On 24/06/15 09:51, Christoffer Dall wrote: >>> On Wed, Jun 24, 2015 at 09:29:56AM +0100, Marc Zyngier wrote: On 22/06/15 09:44, Peter Maydell wrote: > On 17 J

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

2015-06-25 Thread Christoffer Dall
On Wed, Jun 24, 2015 at 10:32:38AM +0100, Marc Zyngier wrote: > Hi Christoffer, > > On 24/06/15 09:51, Christoffer Dall wrote: > > On Wed, Jun 24, 2015 at 09:29:56AM +0100, Marc Zyngier wrote: > >> On 22/06/15 09:44, Peter Maydell wrote: > >>> On 17 June 2015 at 10:00, Suzuki K. Poulose > >>> wr

Re: [PATCH v6 10/12] KVM: arm64: guest debug, HW assisted debug support

2015-06-25 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Jun 25, 2015 at 07:38:33AM +0100, Alex Bennée wrote: >> >> Christoffer Dall writes: >> >> > On Fri, Jun 19, 2015 at 01:23:48PM +0100, Alex Bennée wrote: >> >> This adds support for userspace to control the HW debug registers for >> >> guest debug. In the deb

Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Claudio Fontana
On 25.06.2015 11:10, Peter Maydell wrote: > On 25 June 2015 at 09:59, Claudio Fontana wrote: >> Once the VM is created, I think QEMU should not request kvm to >> change the virtual offset of the VM anymore: maybe an unexpected >> consequence of QEMU's target-arm/kvm64.c::kvm_arch_put_registers ? >

Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Peter Maydell
On 25 June 2015 at 09:59, Claudio Fontana wrote: > Once the VM is created, I think QEMU should not request kvm to > change the virtual offset of the VM anymore: maybe an unexpected > consequence of QEMU's target-arm/kvm64.c::kvm_arch_put_registers ? Hmm. In general we assume that we can: * stop

Re: should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus?

2015-06-25 Thread Peter Maydell
On 25 June 2015 at 09:00, Christoffer Dall wrote: > Of course, KVM can deny an unsupported configuration, but I am wondering > if we really think anybody will care about the 'model such specific > hardware' aspect with KVM, or if we should only consider the 'I want a > VM with x VCPUs' scenario, i

Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Claudio Fontana
Hi Christoffer, On 25.06.2015 10:04, Christoffer Dall wrote: > On Wed, Jun 24, 2015 at 03:54:57PM +0100, Marc Zyngier wrote: >> Userspace is allowed to set the guest's view of CNTVCT, which turns >> into setting CNTVOFF for the whole VM. One thing userspace is not supposed >> to do is to update th

Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Marc Zyngier
Hi Christoffer, On 25/06/15 09:04, Christoffer Dall wrote: > On Wed, Jun 24, 2015 at 03:54:57PM +0100, Marc Zyngier wrote: >> Userspace is allowed to set the guest's view of CNTVCT, which turns >> into setting CNTVOFF for the whole VM. One thing userspace is not supposed >> to do is to update that

RE: [RFC 0/6] KVM: arm/arm64: gsi routing support

2015-06-25 Thread Pavel Fedin
Hi! > But personally I would prefer we > check irqchip routing entries have flat mapping, ie gsi = irqchip.pin > since in any case we don't want/expect the userspace to play with that. Why? On x86 userspace perfectly can play with it. We can imagine some very new qemu version in future which h

Re: [RFC PATCH] KVM: arm/arm64: Don't let userspace update CNTVOFF once guest is running

2015-06-25 Thread Christoffer Dall
On Wed, Jun 24, 2015 at 03:54:57PM +0100, Marc Zyngier wrote: > Userspace is allowed to set the guest's view of CNTVCT, which turns > into setting CNTVOFF for the whole VM. One thing userspace is not supposed > to do is to update that register while the guest is running. Time will > either move for

Re: should KVM or userspace be the one which decides what MIPIDR/affinity values to assign to vcpus?

2015-06-25 Thread Christoffer Dall
Hi, [sorry for reviving this thread late] On Tue, Jun 09, 2015 at 12:24:13PM +0100, Peter Maydell wrote: > On 9 June 2015 at 11:52, Marc Zyngier wrote: > > On 08/06/15 11:52, Peter Maydell wrote: > >> On 8 June 2015 at 11:32, Igor Mammedov wrote: > >>> On Thu, 4 Jun 2015 18:17:39 +0100 > >>> Pe

Re: [PATCH v6 10/12] KVM: arm64: guest debug, HW assisted debug support

2015-06-25 Thread Christoffer Dall
On Thu, Jun 25, 2015 at 07:38:33AM +0100, Alex Bennée wrote: > > Christoffer Dall writes: > > > On Fri, Jun 19, 2015 at 01:23:48PM +0100, Alex Bennée wrote: > >> This adds support for userspace to control the HW debug registers for > >> guest debug. In the debug ioctl we copy the IMPDEF defined

Re: [PATCH v6 09/12] KVM: arm64: introduce vcpu->arch.debug_ptr

2015-06-25 Thread Christoffer Dall
On Thu, Jun 25, 2015 at 07:32:27AM +0100, Alex Bennée wrote: > > Christoffer Dall writes: > > > On Fri, Jun 19, 2015 at 01:23:47PM +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