Re: [PATCH] KVM: selftests: Rename vm_handle_exception in evmcs test

2021-06-04 Thread Ricardo Koller
On Fri, Jun 04, 2021 at 09:26:54PM +, Sean Christopherson wrote: > On Fri, Jun 04, 2021, Ricardo Koller wrote: > > Kernel test robot reports this: > > > > > /usr/bin/ld: tools/testing/selftests/kvm/x86_64/evmcs_test.c:157: > > > undefined reference to `vm_handle_exception' > > > /usr/bin/ld:

[PATCH] KVM: selftests: Rename vm_handle_exception in evmcs test

2021-06-04 Thread Ricardo Koller
Kernel test robot reports this: > /usr/bin/ld: tools/testing/selftests/kvm/x86_64/evmcs_test.c:157: undefined > reference to `vm_handle_exception' > /usr/bin/ld: tools/testing/selftests/kvm/x86_64/evmcs_test.c:158: undefined > reference to `vm_handle_exception' > collect2: error: ld returned 1 e

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Catalin Marinas
On Fri, Jun 04, 2021 at 02:09:50PM +0100, Steven Price wrote: > On 04/06/2021 12:42, Catalin Marinas wrote: > > On Fri, Jun 04, 2021 at 12:15:56PM +0100, Steven Price wrote: > >> On 03/06/2021 18:13, Catalin Marinas wrote: > >>> On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: > d

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Sergey Senozhatsky
On (21/06/04 09:24), Paolo Bonzini wrote: > On 04/06/21 09:21, Vitaly Kuznetsov wrote: > > > preempt_notifier_inc(); > > > + kvm_init_pm_notifier(kvm); > > You've probably thought it through and I didn't but wouldn't it be > > easier to have one global pm_notifier call for KVM which would

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Sergey Senozhatsky
On (21/06/04 09:46), Marc Zyngier wrote: [..] > > +void kvm_arch_pm_notifier(struct kvm *kvm) > > +{ > > +#ifdef CONFIG_PM > > + int c; > > + > > + mutex_lock(&kvm->lock); > > + for (c = 0; c < kvm->created_vcpus; c++) { > > + struct kvm_vcpu *vcpu = kvm->vcpus[c]; > > + i

Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)

2021-06-04 Thread Marc Zyngier
On Fri, 04 Jun 2021 15:51:29 +0100, Shameerali Kolothum Thodi wrote: > > Hi Marc, > > > -Original Message- > > From: Marc Zyngier [mailto:m...@kernel.org] > > Sent: 04 June 2021 14:55 > > To: Shameerali Kolothum Thodi > > Cc: linux-arm-ker...@lists.infradead.org; kvmarm@lists.cs.columbi

RE: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)

2021-06-04 Thread Shameerali Kolothum Thodi
Hi Marc, > -Original Message- > From: Marc Zyngier [mailto:m...@kernel.org] > Sent: 04 June 2021 14:55 > To: Shameerali Kolothum Thodi > Cc: linux-arm-ker...@lists.infradead.org; kvmarm@lists.cs.columbia.edu; > linux-ker...@vger.kernel.org; w...@kernel.org; catalin.mari...@arm.com; > jame

Re: [RFC PATCH 4/4] KVM: arm64: Introduce KVM_CAP_ARM_PROTECTED_VM

2021-06-04 Thread Mark Rutland
On Thu, Jun 03, 2021 at 07:33:47PM +0100, Will Deacon wrote: > Introduce a new VM capability, KVM_CAP_ARM_PROTECTED_VM, which can be > used to isolate guest memory from the host. For now, the EL2 portion is > missing, so this documents and exposes the user ABI for the host. > > Signed-off-by: Will

Re: [PATCH 3/4] KVM: arm64: Parse reserved-memory node for pkvm guest firmware region

2021-06-04 Thread Mark Rutland
On Thu, Jun 03, 2021 at 07:33:46PM +0100, Will Deacon wrote: > Add support for a "linux,pkvm-guest-firmware-memory" reserved memory > region, which can be used to identify a firmware image for protected > VMs. The idea that the guest's FW comes from the host's FW strikes me as unusual; what's the

Re: [PATCH 2/4] KVM: arm64: Extend comment in has_vhe()

2021-06-04 Thread Mark Rutland
On Thu, Jun 03, 2021 at 07:33:45PM +0100, Will Deacon wrote: > has_vhe() expands to a compile-time constant when evaluated from the VHE > or nVHE code, alternatively checking a static key when called from > elsewhere in the kernel. On face value, this looks like a case of > premature optimization,

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Catalin Marinas
On Fri, Jun 04, 2021 at 01:51:38PM +0100, Steven Price wrote: > On 04/06/2021 12:36, Catalin Marinas wrote: > > On Fri, Jun 04, 2021 at 11:42:11AM +0100, Steven Price wrote: > >> On 03/06/2021 17:00, Catalin Marinas wrote: > >>> On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: > @

Re: [PATCH 1/4] KVM: arm64: Ignore 'kvm-arm.mode=protected' when using VHE

2021-06-04 Thread Mark Rutland
On Thu, Jun 03, 2021 at 07:33:44PM +0100, Will Deacon wrote: > Ignore 'kvm-arm.mode=protected' when using VHE so that kvm_get_mode() > only returns KVM_MODE_PROTECTED on systems where the feature is available. IIUC, since the introduction of the idreg-override code, and the mutate_to_vhe stuff, pa

Re: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)

2021-06-04 Thread Marc Zyngier
On Fri, 04 Jun 2021 09:13:10 +0100, Shameerali Kolothum Thodi wrote: > > Hi, > > > -Original Message- > > From: Shameerali Kolothum Thodi > > Sent: 06 May 2021 17:52 > > To: linux-arm-ker...@lists.infradead.org; kvmarm@lists.cs.columbia.edu; > > linux-ker...@vger.kernel.org > > Cc: m...@

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Steven Price
On 04/06/2021 12:42, Catalin Marinas wrote: > On Fri, Jun 04, 2021 at 12:15:56PM +0100, Steven Price wrote: >> On 03/06/2021 18:13, Catalin Marinas wrote: >>> On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include

Re: [RFC PATCH 4/4] KVM: arm64: Introduce KVM_CAP_ARM_PROTECTED_VM

2021-06-04 Thread Sean Christopherson
On Thu, Jun 03, 2021, Will Deacon wrote: > +Enabling this capability causes all memory slots of the specified VM to be > +unmapped from the host system and put into a state where they are no longer > +configurable. What happens if userspace remaps the hva of the memslot? In other words, how will

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Steven Price
On 04/06/2021 12:36, Catalin Marinas wrote: > On Fri, Jun 04, 2021 at 11:42:11AM +0100, Steven Price wrote: >> On 03/06/2021 17:00, Catalin Marinas wrote: >>> On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index c5d1f

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Catalin Marinas
On Fri, Jun 04, 2021 at 12:15:56PM +0100, Steven Price wrote: > On 03/06/2021 18:13, Catalin Marinas wrote: > > On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: > >> diff --git a/arch/arm64/include/uapi/asm/kvm.h > >> b/arch/arm64/include/uapi/asm/kvm.h > >> index 24223adae150..b3edde

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Catalin Marinas
On Fri, Jun 04, 2021 at 11:42:11AM +0100, Steven Price wrote: > On 03/06/2021 17:00, Catalin Marinas wrote: > > On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: > >> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > >> index c5d1f3c87dbd..226035cf7d6c 100644 > >> --- a/arch/ar

Re: [PATCH v13 7/8] KVM: arm64: ioctl to fetch/store tags in a guest

2021-06-04 Thread Steven Price
On 03/06/2021 18:13, Catalin Marinas wrote: > On Mon, May 24, 2021 at 11:45:12AM +0100, Steven Price wrote: >> diff --git a/arch/arm64/include/uapi/asm/kvm.h >> b/arch/arm64/include/uapi/asm/kvm.h >> index 24223adae150..b3edde68bc3e 100644 >> --- a/arch/arm64/include/uapi/asm/kvm.h >> +++ b/arch/a

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Steven Price
On 03/06/2021 17:00, Catalin Marinas wrote: > On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: >> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c >> index c5d1f3c87dbd..226035cf7d6c 100644 >> --- a/arch/arm64/kvm/mmu.c >> +++ b/arch/arm64/kvm/mmu.c >> @@ -822,6 +822,42 @@ tran

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Marc Zyngier
On Fri, 04 Jun 2021 10:20:28 +0100, Sergey Senozhatsky wrote: > > On (21/06/04 09:46), Marc Zyngier wrote: > [..] > > > +void kvm_arch_pm_notifier(struct kvm *kvm) > > > +{ > > > +#ifdef CONFIG_PM > > > + int c; > > > + > > > + mutex_lock(&kvm->lock); > > > + for (c = 0; c < kvm->created_vcpus; c

Re: [PATCH v13 4/8] KVM: arm64: Introduce MTE VM feature

2021-06-04 Thread Catalin Marinas
On Thu, Jun 03, 2021 at 05:00:31PM +0100, Catalin Marinas wrote: > On Mon, May 24, 2021 at 11:45:09AM +0100, Steven Price wrote: > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > index c5d1f3c87dbd..226035cf7d6c 100644 > > --- a/arch/arm64/kvm/mmu.c > > +++ b/arch/arm64/kvm/mmu.c > >

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Vitaly Kuznetsov
Sergey Senozhatsky writes: > Add KVM suspend/hibernate PM-notifier which lets architectures > to implement arch-specific VM suspend code. For instance, on x86 > this sets PVCLOCK_GUEST_STOPPED on all the VCPUs. > > Our case is that user puts the host system into sleep multiple > times a day (e.g.

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Sergey Senozhatsky
On (21/06/03 19:27), Peter Zijlstra wrote: > On Fri, Jun 04, 2021 at 01:43:15AM +0900, Sergey Senozhatsky wrote: [..] > > > > +void kvm_arch_pm_notifier(struct kvm *kvm) > > +{ > > +} > > + > > long kvm_arch_vm_ioctl(struct file *filp, > >unsigned int ioctl, unsigned long arg

[RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Sergey Senozhatsky
Add KVM suspend/hibernate PM-notifier which lets architectures to implement arch-specific VM suspend code. For instance, on x86 this sets PVCLOCK_GUEST_STOPPED on all the VCPUs. Our case is that user puts the host system into sleep multiple times a day (e.g. closes the laptop's lid) so we need a r

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Marc Zyngier
On Thu, 03 Jun 2021 17:43:15 +0100, Sergey Senozhatsky wrote: > > Add KVM suspend/hibernate PM-notifier which lets architectures > to implement arch-specific VM suspend code. For instance, on x86 > this sets PVCLOCK_GUEST_STOPPED on all the VCPUs. > > Our case is that user puts the host system i

RE: [RFC PATCH 0/3] kvm/arm: New VMID allocator based on asid(2nd approach)

2021-06-04 Thread Shameerali Kolothum Thodi
Hi, > -Original Message- > From: Shameerali Kolothum Thodi > Sent: 06 May 2021 17:52 > To: linux-arm-ker...@lists.infradead.org; kvmarm@lists.cs.columbia.edu; > linux-ker...@vger.kernel.org > Cc: m...@kernel.org; w...@kernel.org; catalin.mari...@arm.com; > james.mo...@arm.com; julien.thier

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Paolo Bonzini
On 04/06/21 09:21, Vitaly Kuznetsov wrote: preempt_notifier_inc(); + kvm_init_pm_notifier(kvm); You've probably thought it through and I didn't but wouldn't it be easier to have one global pm_notifier call for KVM which would go through the list of VMs instead of registering/dereg

Re: [RFC][PATCH] kvm: add suspend pm-notifier

2021-06-04 Thread Paolo Bonzini
On 04/06/21 02:39, Sergey Senozhatsky wrote: +void kvm_arch_pm_notifier(struct kvm *kvm) +{ +} + long kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { What looks like you wants a __weak function. True. Thanks for the suggestion. I thou