Re: [PATCH v2 2/5] KVM: arm/arm64: Add ARM user space interrupt signaling ABI

2017-04-04 Thread Alexander Graf
On 21.02.17 12:41, Christoffer Dall wrote: Hi Alex, On Fri, Feb 03, 2017 at 05:51:18PM +, Peter Maydell wrote: On 3 February 2017 at 14:56, Christoffer Dall wrote: From: Christoffer Dall We have 2 modes for dealing with interrupts in the

Re: [PATCH] KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory

2017-04-04 Thread gengdongjiu
Hi James, thanks for the patch, have you consider to told Qemu or KVM tools the reason for this bus error(SEA/SEI)? when Qemu or KVM tools get this SIGBUS signal, it do not know receive this SIGBUS due to SEA or SEI. OR KVM only send this SIGBUS when encounter SEA? if so, for the SEI case, how

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 21:04, Christoffer Dall wrote: > - (On a related work, I suddenly felt it weird that >kvm_make_all_cpus_request() doesn't wake up sleeping VCPUs, but only >sends an IPI; does this mean that calling this function should be >followed by a kick() for each VCPU? Maybe

Re: [PATCH v2 9/9] KVM: arm/arm64: avoid race by caching MPIDR

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:58PM +0200, Andrew Jones wrote: > Cache the MPIDR in the vcpu structure to fix potential races that > can arise between vcpu reset and the extraction of the MPIDR from > the sys-reg array. I don't understand the race, sorry. Can you be more specific in where this

Re: [PATCH v2 8/9] KVM: arm/arm64: fix race in kvm_psci_vcpu_on

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:57PM +0200, Andrew Jones wrote: > From: Levente Kurusa > > When two vcpus issue PSCI_CPU_ON on the same core at the same time, > then it's possible for them to both enter the target vcpu's setup > at the same time. This results in unexpected

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 20:18, Andrew Jones wrote: >> My understanding is that KVM-ARM is using KVM_REQ_VCPU_EXIT simply to >> reuse the smp_call_function_many code in kvm_make_all_cpus_request. >> Once you add EXITING_GUEST_MODE, ARM can just add a new function >> kvm_kick_all_cpus and use it for both

Re: [PATCH v2 6/9] KVM: arm/arm64: use a vcpu request on irq injection

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 19:42, Christoffer Dall wrote: > > this is not going to be called when we don't have the vgic, which means > that if vcpu_interrupt_line() is used as you modify it above, the > request will never get cleared. Heh, I'll stop pretending I can give positive reviews of ARM patches

Re: [PATCH v2 6/9] KVM: arm/arm64: use a vcpu request on irq injection

2017-04-04 Thread Paolo Bonzini
On 31/03/2017 18:06, Andrew Jones wrote: > Don't use request-less VCPU kicks when injecting IRQs, as a VCPU > kick meant to trigger the interrupt injection could be sent while > the VCPU is outside guest mode, which means no IPI is sent, and > after it has called kvm_vgic_flush_hwstate(),

Re: [PATCH v2 7/9] KVM: arm/arm64: PMU: remove request-less vcpu kick

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 07:46:12PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:56PM +0200, Andrew Jones wrote: > > Refactor PMU overflow handling in order to remove the request-less > > vcpu kick. Now, since kvm_vgic_inject_irq() uses vcpu requests, > > there should be no

Re: [PATCH v2 6/9] KVM: arm/arm64: use a vcpu request on irq injection

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 07:42:08PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:55PM +0200, Andrew Jones wrote: > > Don't use request-less VCPU kicks when injecting IRQs, as a VCPU > > kick meant to trigger the interrupt injection could be sent while > > the VCPU is outside guest

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 07:35:11PM +0200, Paolo Bonzini wrote: > > > On 04/04/2017 19:19, Christoffer Dall wrote: > > On Tue, Apr 04, 2017 at 06:24:36PM +0200, Paolo Bonzini wrote: > >> > >> > >> On 04/04/2017 18:04, Christoffer Dall wrote: > For pause, only the requester should do the

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 06:04:17PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:53PM +0200, Andrew Jones wrote: > > This not only ensures visibility of changes to pause by using > > atomic ops, but also plugs a small race where a vcpu could get its > > pause state enabled just

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Christoffer Dall
On Tue, Apr 04, 2017 at 07:35:11PM +0200, Paolo Bonzini wrote: > > > On 04/04/2017 19:19, Christoffer Dall wrote: > > On Tue, Apr 04, 2017 at 06:24:36PM +0200, Paolo Bonzini wrote: > >> > >> > >> On 04/04/2017 18:04, Christoffer Dall wrote: > For pause, only the requester should do the

Re: [PATCH v2 6/9] KVM: arm/arm64: use a vcpu request on irq injection

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:55PM +0200, Andrew Jones wrote: > Don't use request-less VCPU kicks when injecting IRQs, as a VCPU > kick meant to trigger the interrupt injection could be sent while > the VCPU is outside guest mode, which means no IPI is sent, and > after it has called

Re: [PATCH v2 5/9] KVM: arm/arm64: replace vcpu->arch.power_off with a vcpu request

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:54PM +0200, Andrew Jones wrote: > Like pause, replacing power_off with a vcpu request ensures > visibility of changes and avoids the final race before entering > the guest. I think it's worth explaining the race in the commit message first, just briefly. > >

Re: [PATCH v2 2/9] KVM: Add documentation for VCPU requests

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 19:23, Christoffer Dall wrote: >> I think all !IN_GUEST_MODE should behave the same, so I was avoiding >> the use of EXITING_GUEST_MODE and OUTSIDE_GUEST_MODE, which wouldn't be >> hard to address, but then I'd also have to address >> READING_SHADOW_PAGE_TABLES, which may

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 19:19, Christoffer Dall wrote: > On Tue, Apr 04, 2017 at 06:24:36PM +0200, Paolo Bonzini wrote: >> >> >> On 04/04/2017 18:04, Christoffer Dall wrote: For pause, only the requester should do the clearing. >> >> This suggests that maybe this should not be a request. The request

Re: [PATCH v2 2/9] KVM: Add documentation for VCPU requests

2017-04-04 Thread Christoffer Dall
On Tue, Apr 04, 2017 at 07:06:00PM +0200, Andrew Jones wrote: > On Tue, Apr 04, 2017 at 05:24:03PM +0200, Christoffer Dall wrote: > > Hi Drew, > > > > On Fri, Mar 31, 2017 at 06:06:51PM +0200, Andrew Jones wrote: > > > Signed-off-by: Andrew Jones > > > --- > > >

Re: [PATCH 00/15] arm64/kvm: use common sysreg definitions

2017-04-04 Thread Catalin Marinas
On Wed, Mar 29, 2017 at 09:41:47AM +0100, Will Deacon wrote: > On Tue, Mar 28, 2017 at 10:29:31PM +0200, Christoffer Dall wrote: > > On Tue, Mar 28, 2017 at 07:48:28PM +0100, Mark Rutland wrote: > > > On Wed, Mar 22, 2017 at 06:35:13PM +, Mark Rutland wrote: > > > > On Fri, Mar 10, 2017 at

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 04:51:40PM +0200, Paolo Bonzini wrote: > > > On 04/04/2017 16:47, Andrew Jones wrote: > >>> -#define KVM_REQ_VCPU_EXIT8 > >>> +#define KVM_REQ_PAUSE8 > >> Small nit: can we have a #define for this 8? KVM_REQ_ARCH_BASE, or > >> something along those

Re: [PATCH v2 3/9] KVM: arm/arm64: prepare to use vcpu requests

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 05:34:01PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:52PM +0200, Andrew Jones wrote: > > Make sure we don't leave vcpu requests we don't intend to > > handle later set in the request bitmap. If we don't clear > > them, then kvm_request_pending() may

Re: [PATCH v2 2/9] KVM: Add documentation for VCPU requests

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 05:24:03PM +0200, Christoffer Dall wrote: > Hi Drew, > > On Fri, Mar 31, 2017 at 06:06:51PM +0200, Andrew Jones wrote: > > Signed-off-by: Andrew Jones > > --- > > Documentation/virtual/kvm/vcpu-requests.rst | 114 > > > >

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 05:30:14PM +0200, Christoffer Dall wrote: > On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: > > From: Radim Krčmář > > > > A first step in vcpu->requests encapsulation. > > Could we have a note here on why we need to access

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 18:04, Christoffer Dall wrote: >> For pause, only the requester should do the clearing. This suggests that maybe this should not be a request. The request would be just the need to act on a GIC command, exactly as before this patch. What I don't understand is: >> With this

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:53PM +0200, Andrew Jones wrote: > This not only ensures visibility of changes to pause by using > atomic ops, but also plugs a small race where a vcpu could get its > pause state enabled just after its last check before entering the > guest. With this patch, while the

Re: [PATCH v2 3/9] KVM: arm/arm64: prepare to use vcpu requests

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:52PM +0200, Andrew Jones wrote: > Make sure we don't leave vcpu requests we don't intend to > handle later set in the request bitmap. If we don't clear > them, then kvm_request_pending() may return true when we > don't want it to. > > Signed-off-by: Andrew Jones

Re: [PATCH v2 1/9] KVM: add kvm_request_pending

2017-04-04 Thread Christoffer Dall
On Fri, Mar 31, 2017 at 06:06:50PM +0200, Andrew Jones wrote: > From: Radim Krčmář > > A first step in vcpu->requests encapsulation. Could we have a note here on why we need to access vcpu->requests using READ_ONCE now? Thanks, -Christoffer > > Signed-off-by: Radim Krčmář

Re: [PATCH v2 2/9] KVM: Add documentation for VCPU requests

2017-04-04 Thread Christoffer Dall
Hi Drew, On Fri, Mar 31, 2017 at 06:06:51PM +0200, Andrew Jones wrote: > Signed-off-by: Andrew Jones > --- > Documentation/virtual/kvm/vcpu-requests.rst | 114 > > 1 file changed, 114 insertions(+) > create mode 100644

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Marc Zyngier
On 04/04/17 15:51, Paolo Bonzini wrote: > > > On 04/04/2017 16:47, Andrew Jones wrote: -#define KVM_REQ_VCPU_EXIT 8 +#define KVM_REQ_PAUSE 8 >>> Small nit: can we have a #define for this 8? KVM_REQ_ARCH_BASE, or >>> something along those lines? >> Sounds good to me. Should

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Paolo Bonzini
On 04/04/2017 16:47, Andrew Jones wrote: >>> -#define KVM_REQ_VCPU_EXIT 8 >>> +#define KVM_REQ_PAUSE 8 >> Small nit: can we have a #define for this 8? KVM_REQ_ARCH_BASE, or >> something along those lines? > Sounds good to me. Should I even do something like > > #define

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Andrew Jones
On Tue, Apr 04, 2017 at 02:39:19PM +0100, Marc Zyngier wrote: > On 31/03/17 17:06, Andrew Jones wrote: > > This not only ensures visibility of changes to pause by using > > atomic ops, but also plugs a small race where a vcpu could get its > > pause state enabled just after its last check before

Re: [PATCH v2 4/9] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu request

2017-04-04 Thread Marc Zyngier
On 31/03/17 17:06, Andrew Jones wrote: > This not only ensures visibility of changes to pause by using > atomic ops, but also plugs a small race where a vcpu could get its > pause state enabled just after its last check before entering the > guest. With this patch, while the vcpu will still

Re: [PATCH v3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-04-04 Thread Christoffer Dall
On Tue, Apr 04, 2017 at 11:35:35AM +0100, Suzuki K Poulose wrote: > Hi Christoffer, > > On 04/04/17 11:13, Christoffer Dall wrote: > >Hi Suzuki, > > > >On Mon, Apr 03, 2017 at 03:12:43PM +0100, Suzuki K Poulose wrote: > >>In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling >

Re: [PATCH v5 00/34] arm/arm64: KVM: Rework the hyp-stub API

2017-04-04 Thread Christoffer Dall
Hi Marc, On Mon, Apr 03, 2017 at 07:37:33PM +0100, Marc Zyngier wrote: > As noticed by RMK in this thread[1], the hyp-stub API on 32bit ARM > could do with some TLC (it cannot perform a soft-restart at HYP, and > has holes in the hyp-stub support in a number of places). In general, > it would be

Re: [kvmarm:master 1/3] arch/arm/kvm/mmu.c:302:14: error: 'S2_PUD_SIZE' undeclared

2017-04-04 Thread Christoffer Dall
On Tue, Apr 04, 2017 at 11:28:09AM +0100, Marc Zyngier wrote: > On 04/04/17 11:14, Suzuki K Poulose wrote: > > On 03/04/17 22:15, kbuild test robot wrote: > >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git > >> master > >> head:

Re: [PATCH v3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-04-04 Thread Suzuki K Poulose
Hi Christoffer, On 04/04/17 11:13, Christoffer Dall wrote: Hi Suzuki, On Mon, Apr 03, 2017 at 03:12:43PM +0100, Suzuki K Poulose wrote: In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling unmap_stage2_range() on the entire memory range for the guest. This could cause

Re: [kvmarm:master 1/3] arch/arm/kvm/mmu.c:302:14: error: 'S2_PUD_SIZE' undeclared

2017-04-04 Thread Suzuki K Poulose
On 03/04/17 22:15, kbuild test robot wrote: tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git master head: 1f1c45c6f66a586ca420ca02cbd93a35690394f9 commit: f9d9eb7f7a2c7e388861fe1cdb253f63e63555fe [1/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd config:

Re: [PATCH v3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-04-04 Thread Christoffer Dall
Hi Suzuki, On Mon, Apr 03, 2017 at 03:12:43PM +0100, Suzuki K Poulose wrote: > In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling > unmap_stage2_range() on the entire memory range for the guest. This could > cause problems with other callers (e.g, munmap on a memslot) trying

Re: [PATCH v4 19/28] ARM: KVM: Allow the main HYP code to use the init hyp stub implementation

2017-04-04 Thread Christoffer Dall
On Mon, Apr 03, 2017 at 06:51:02PM +0100, Marc Zyngier wrote: > On 03/04/17 18:32, Christoffer Dall wrote: > > On Fri, Mar 24, 2017 at 03:01:23PM +, Marc Zyngier wrote: > >> On 24/03/17 14:34, Christoffer Dall wrote: > >>> On Tue, Mar 21, 2017 at 07:20:49PM +, Marc Zyngier wrote: > We

Re: [PATCH v2 0/9] KVM: arm/arm64: race fixes and vcpu requests

2017-04-04 Thread Andrew Jones
On Mon, Apr 03, 2017 at 05:28:45PM +0200, Christoffer Dall wrote: > Hi Drew, > > On Fri, Mar 31, 2017 at 06:06:49PM +0200, Andrew Jones wrote: > > This series fixes some hard to produce races by introducing the use of > > vcpu requests. It also fixes a couple easier to produce races, ones > >

[kvmarm:master 1/3] arch/arm/kvm/mmu.c:302:14: error: 'S2_PUD_SIZE' undeclared

2017-04-04 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git master head: 1f1c45c6f66a586ca420ca02cbd93a35690394f9 commit: f9d9eb7f7a2c7e388861fe1cdb253f63e63555fe [1/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd config: arm-axm55xx_defconfig (attached as .config)