Re: [PATCH] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Marc Zyngier
Hi Drew, On 21/08/2019 20:50, Andrew Jones wrote: > If after an MMIO exit to userspace a VCPU is immediately run with an > immediate_exit request, such as when a signal is delivered or an MMIO > emulation completion is needed, then the VCPU completes the MMIO > emulation and immediately returns to

Re: [PATCH] KVM: arm/arm64: vgic: Allow more than 256 vcpus for KVM_IRQ_LINE

2019-08-22 Thread Auger Eric
Hi Marc, On 8/18/19 4:07 PM, Marc Zyngier wrote: > While parts of the VGIC support a large number of vcpus (we > bravely allow up to 512), other parts are more limited. > > One of these limits is visible in the KVM_IRQ_LINE ioctl, which > only allows 256 vcpus to be signalled when using the CPU o

Re: Can we boot a 512U kvm guest?

2019-08-22 Thread Auger Eric
Hi Zenghui, On 8/13/19 10:50 AM, Zenghui Yu wrote: > Hi folks, > > Since commit e25028c8ded0 ("KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to > 512"), we seemed to be allowed to boot a 512U guest.  But I failed to > start it up with the latest QEMU.  I guess there are at least *two* > reasons (limitati

Re: [PATCH] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Andrew Jones
On Thu, Aug 22, 2019 at 09:30:44AM +0100, Marc Zyngier wrote: > Hi Drew, > > On 21/08/2019 20:50, Andrew Jones wrote: > > If after an MMIO exit to userspace a VCPU is immediately run with an > > immediate_exit request, such as when a signal is delivered or an MMIO > > emulation completion is neede

Re: Can we boot a 512U kvm guest?

2019-08-22 Thread Marc Zyngier
Hi Eric, On 22/08/2019 10:08, Auger Eric wrote: > Hi Zenghui, > > On 8/13/19 10:50 AM, Zenghui Yu wrote: >> Hi folks, >> >> Since commit e25028c8ded0 ("KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to >> 512"), we seemed to be allowed to boot a 512U guest.  But I failed to >> start it up with the latest

Re: [PATCH] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Marc Zyngier
On 22/08/2019 10:25, Andrew Jones wrote: > On Thu, Aug 22, 2019 at 09:30:44AM +0100, Marc Zyngier wrote: >> Hi Drew, >> >> On 21/08/2019 20:50, Andrew Jones wrote: >>> If after an MMIO exit to userspace a VCPU is immediately run with an >>> immediate_exit request, such as when a signal is delivered

Re: Can we boot a 512U kvm guest?

2019-08-22 Thread Auger Eric
Hi Marc, On 8/22/19 11:29 AM, Marc Zyngier wrote: > Hi Eric, > > On 22/08/2019 10:08, Auger Eric wrote: >> Hi Zenghui, >> >> On 8/13/19 10:50 AM, Zenghui Yu wrote: >>> Hi folks, >>> >>> Since commit e25028c8ded0 ("KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to >>> 512"), we seemed to be allowed to boot

Re: Can we boot a 512U kvm guest?

2019-08-22 Thread Marc Zyngier
On 22/08/2019 10:50, Auger Eric wrote: > Hi Marc, > > On 8/22/19 11:29 AM, Marc Zyngier wrote: >> Hi Eric, >> >> On 22/08/2019 10:08, Auger Eric wrote: >>> Hi Zenghui, >>> >>> On 8/13/19 10:50 AM, Zenghui Yu wrote: Hi folks, Since commit e25028c8ded0 ("KVM: arm/arm64: Bump VGIC_V3_M

Re: [PATCH v3 04/10] KVM: Implement kvm_put_guest()

2019-08-22 Thread Jonathan Cameron
On Wed, 21 Aug 2019 16:36:50 +0100 Steven Price wrote: > kvm_put_guest() is analogous to put_user() - it writes a single value to > the guest physical address. The implementation is built upon put_user() > and so it has the same single copy atomic properties. > > Signed-off-by: Steven Price > -

Re: [PATCH v3 04/10] KVM: Implement kvm_put_guest()

2019-08-22 Thread Steven Price
On 22/08/2019 11:29, Jonathan Cameron wrote: > On Wed, 21 Aug 2019 16:36:50 +0100 > Steven Price wrote: > >> kvm_put_guest() is analogous to put_user() - it writes a single value to >> the guest physical address. The implementation is built upon put_user() >> and so it has the same single copy at

Re: [PATCH v3 05/10] KVM: arm64: Support stolen time reporting via shared structure

2019-08-22 Thread Jonathan Cameron
On Wed, 21 Aug 2019 16:36:51 +0100 Steven Price wrote: > Implement the service call for configuring a shared structure between a > VCPU and the hypervisor in which the hypervisor can write the time > stolen from the VCPU's execution time by other tasks on the host. > > The hypervisor allocates m

Re: [PATCH] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Andrew Jones
On Thu, Aug 22, 2019 at 10:38:52AM +0100, Marc Zyngier wrote: > On 22/08/2019 10:25, Andrew Jones wrote: > > On Thu, Aug 22, 2019 at 09:30:44AM +0100, Marc Zyngier wrote: > >> Hi Drew, > >> > >> On 21/08/2019 20:50, Andrew Jones wrote: > >>> If after an MMIO exit to userspace a VCPU is immediately

Re: [PATCH v3 07/10] KVM: arm64: Provide a PV_TIME device to user space

2019-08-22 Thread Jonathan Cameron
On Wed, 21 Aug 2019 16:36:53 +0100 Steven Price wrote: > Allow user space to inform the KVM host where in the physical memory > map the paravirtualized time structures should be located. > > A device is created which provides the base address of an array of > Stolen Time (ST) structures, one for

Re: [PATCH v3 05/10] KVM: arm64: Support stolen time reporting via shared structure

2019-08-22 Thread Steven Price
On 22/08/2019 11:39, Jonathan Cameron wrote: > On Wed, 21 Aug 2019 16:36:51 +0100 > Steven Price wrote: > >> Implement the service call for configuring a shared structure between a >> VCPU and the hypervisor in which the hypervisor can write the time >> stolen from the VCPU's execution time by ot

[PATCH v2] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Andrew Jones
If after an MMIO exit to userspace a VCPU is immediately run with an immediate_exit request, such as when a signal is delivered or an MMIO emulation completion is needed, then the VCPU completes the MMIO emulation and immediately returns to userspace. As the exit_reason does not get changed from KV

Re: [PATCH v3 07/10] KVM: arm64: Provide a PV_TIME device to user space

2019-08-22 Thread Steven Price
On 22/08/2019 11:57, Jonathan Cameron wrote: > On Wed, 21 Aug 2019 16:36:53 +0100 > Steven Price wrote: > >> Allow user space to inform the KVM host where in the physical memory >> map the paravirtualized time structures should be located. >> >> A device is created which provides the base address

Re: [PATCH v3 07/10] KVM: arm64: Provide a PV_TIME device to user space

2019-08-22 Thread Jonathan Cameron
On Thu, 22 Aug 2019 12:11:55 +0100 Steven Price wrote: > On 22/08/2019 11:57, Jonathan Cameron wrote: > > On Wed, 21 Aug 2019 16:36:53 +0100 > > Steven Price wrote: > > > >> Allow user space to inform the KVM host where in the physical memory > >> map the paravirtualized time structures shoul

Re: [PATCH 00/59] KVM: arm64: ARMv8.3 Nested Virtualization support

2019-08-22 Thread Alexandru Elisei
On 8/9/19 11:01 AM, Alexandru Elisei wrote: > On 8/2/19 11:11 AM, Alexandru Elisei wrote: >> Hi, >> >> On 6/21/19 10:37 AM, Marc Zyngier wrote: >> When working on adding support for EL2 to kvm-unit-tests I was able to >> trigger >> the following warning: >> >> # ./lkvm run -f psci.flat -m 128 -c 8

Re: [PATCH v2] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Mark Rutland
On Thu, Aug 22, 2019 at 01:03:05PM +0200, Andrew Jones wrote: > If after an MMIO exit to userspace a VCPU is immediately run with an > immediate_exit request, such as when a signal is delivered or an MMIO > emulation completion is needed, then the VCPU completes the MMIO > emulation and immediately

Re: [PATCH v2] arm64: KVM: Only skip MMIO insn once

2019-08-22 Thread Marc Zyngier
On 22/08/2019 12:03, Andrew Jones wrote: > If after an MMIO exit to userspace a VCPU is immediately run with an > immediate_exit request, such as when a signal is delivered or an MMIO > emulation completion is needed, then the VCPU completes the MMIO > emulation and immediately returns to userspace

Re: [RESEND PATCH] KVM: arm: VGIC: properly initialise private IRQ affinity

2019-08-22 Thread Andre Przywara
On Thu, 22 Aug 2019 01:13:32 +0800 Zenghui Yu wrote: Hi, > On 2019/8/22 1:00, Andre Przywara wrote: > > At the moment we initialise the target *mask* of a virtual IRQ to the > > VCPU it belongs to, even though this mask is only defined for GICv2 and > > quickly runs out of bits for many GICv3 gu

Re: [RESEND PATCH] KVM: arm: VGIC: properly initialise private IRQ affinity

2019-08-22 Thread Marc Zyngier
On 22/08/2019 14:42, Andre Przywara wrote: > On Thu, 22 Aug 2019 01:13:32 +0800 > Zenghui Yu wrote: > > Hi, > >> On 2019/8/22 1:00, Andre Przywara wrote: >>> At the moment we initialise the target *mask* of a virtual IRQ to the >>> VCPU it belongs to, even though this mask is only defined for GI

Re: [PATCH v3 04/10] KVM: Implement kvm_put_guest()

2019-08-22 Thread Sean Christopherson
On Wed, Aug 21, 2019 at 04:36:50PM +0100, Steven Price wrote: > kvm_put_guest() is analogous to put_user() - it writes a single value to > the guest physical address. The implementation is built upon put_user() > and so it has the same single copy atomic properties. What you mean by "single copy a

Re: [PATCH 00/59] KVM: arm64: ARMv8.3 Nested Virtualization support

2019-08-22 Thread Alexandru Elisei
On 8/22/19 12:57 PM, Alexandru Elisei wrote: > [..] > I tried to fix it with the following patch, inject_undef64 was similarly > broken: > > diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c > index fac962b467bd..aee8a9ef36d5 100644 > --- a/arch/arm64/kvm/inject_fault.c >

Re: [PATCH v3 04/10] KVM: Implement kvm_put_guest()

2019-08-22 Thread Steven Price
On 22/08/2019 16:28, Sean Christopherson wrote: > On Wed, Aug 21, 2019 at 04:36:50PM +0100, Steven Price wrote: >> kvm_put_guest() is analogous to put_user() - it writes a single value to >> the guest physical address. The implementation is built upon put_user() >> and so it has the same single cop

Re: [PATCH v3 04/10] KVM: Implement kvm_put_guest()

2019-08-22 Thread Sean Christopherson
On Thu, Aug 22, 2019 at 04:46:10PM +0100, Steven Price wrote: > On 22/08/2019 16:28, Sean Christopherson wrote: > > On Wed, Aug 21, 2019 at 04:36:50PM +0100, Steven Price wrote: > >> kvm_put_guest() is analogous to put_user() - it writes a single value to > >> the guest physical address. The implem

[PATCH v2] KVM: arm: VGIC: properly initialise private IRQ affinity

2019-08-22 Thread Andre Przywara
At the moment we initialise the target *mask* of a virtual IRQ to the VCPU it belongs to, even though this mask is only defined for GICv2 and quickly runs out of bits for many GICv3 guests. This behaviour triggers an UBSAN complaint for more than 32 VCPUs: -- [ 5659.462377] UBSAN: Undefined beh

Re: [PATCH v2] KVM: arm: VGIC: properly initialise private IRQ affinity

2019-08-22 Thread Marc Zyngier
On Thu, 22 Aug 2019 18:05:10 +0100 Andre Przywara wrote: > At the moment we initialise the target *mask* of a virtual IRQ to the > VCPU it belongs to, even though this mask is only defined for GICv2 and > quickly runs out of bits for many GICv3 guests. > This behaviour triggers an UBSAN complaint

Re: Can we boot a 512U kvm guest?

2019-08-22 Thread Zenghui Yu
Hi Eric, On 2019/8/22 17:08, Auger Eric wrote: Hi Zenghui, On 8/13/19 10:50 AM, Zenghui Yu wrote: Hi folks, Since commit e25028c8ded0 ("KVM: arm/arm64: Bump VGIC_V3_MAX_CPUS to 512"), we seemed to be allowed to boot a 512U guest.  But I failed to start it up with the latest QEMU.  I guess the