Re: [PATCH v4 00/21] Support SDEI Virtualization

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 10:29 PM, Eric Auger wrote: On 8/15/21 2:19 AM, Gavin Shan wrote: On 8/15/21 10:13 AM, Gavin Shan wrote: This series intends to virtualize Software Delegated Exception Interface (SDEI), which is defined by DEN0054A. It allows the hypervisor to deliver NMI-alike event to gu

Re: [PATCH v4 20/21] KVM: arm64: Export SDEI capability

2022-01-11 Thread Gavin Shan
On 11/10/21 9:55 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: The SDEI functionality is ready to be exported so far. This adds new capability (KVM_CAP_ARM_SDEI) and exports it. Need to be documented in kvm/api.rst as the rest of the API Ok, Thanks, Eric :) Signed-off-by:

Re: [PATCH v4 19/21] KVM: arm64: Support SDEI event cancellation

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 10:09 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: The injected SDEI event is to send notification to guest. The SDEI event might not be needed after it's injected. This introduces API to support cancellation on the injected SDEI event if it's not fired to th

Re: [PATCH v4 18/21] KVM: arm64: Support SDEI event injection

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 10:05 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI event injection by implementing kvm_sdei_inject(). It's called by kernel directly or VMM through ioctl command to inject SDEI event to the specific vCPU. Signed-off-by: Gavin Shan --- a

Re: [PATCH v4 16/21] KVM: arm64: Support SDEI ioctl commands on VM

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 9:48 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports ioctl commands on VM to manage the various objects. It's primarily used by VMM to accomplish live migration. The ioctl commands introduced by this are highlighted as blow: below * KVM_SDEI

Re: [PATCH v4 15/21] KVM: arm64: Support SDEI event notifier

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 7:35 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: The owner of the SDEI event, like asynchronous page fault, need owner is not a terminology used in the SDEI spec know the state of injected SDEI event. This supports SDEI event s/need know the state of inje

Re: [PATCH v4 14/21] KVM: arm64: Support SDEI_EVENT_{COMPLETE, COMPLETE_AND_RESUME} hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 6:58 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_{COMPLETE, COMPLETE_AND_RESUME} hypercall. They are used by the guest to notify the completion of the SDEI event in the handler. The registers are changed according to the SDEI specifi

Re: [PATCH v4 13/21] KVM: arm64: Impment SDEI event delivery

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 6:58 PM, Eric Auger wrote: s/Impment/Implement in the commit title On 8/15/21 2:13 AM, Gavin Shan wrote: This implement kvm_sdei_deliver() to support SDEI event delivery. The function is called when the request (KVM_REQ_SDEI) is raised. The following rules are taken accord

Re: [PATCH v4 12/21] KVM: arm64: Support SDEI_{PRIVATE, SHARED}_RESET hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 4:37 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_{PRIVATE, SHARED}_RESET. They are used by the guest to purge the private or shared SDEI events, which are registered to reset all private SDEI event registrations of the calling PE (resp. P

Re: [PATCH v4 11/21] KVM: arm64: Support SDEI_PE_{MASK, UNMASK} hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 4:31 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_PE_{MASK, UNMASK} hypercall. They are used by the guest to stop the specific vCPU from receiving SDEI events. Signed-off-by: Gavin Shan --- arch/arm64/kvm/sdei.c | 35 +++

Re: [PATCH v4 10/21] KVM: arm64: Support SDEI_EVENT_ROUTING_SET hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 2:47 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_ROUTING_SET hypercall. It's used by the guest to set route mode and affinity for the registered KVM event. It's only valid for the shared events. It's not allowed to do so when the cor

Re: [PATCH v4 09/21] KVM: arm64: Support SDEI_EVENT_GET_INFO hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 1:19 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_GET_INFO hypercall. It's used by the guest to retrieve various information about the supported (exported) events, including type, signaled, route mode and affinity for the shared event

Re: [PATCH v4 08/21] KVM: arm64: Support SDEI_EVENT_STATUS hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 1:12 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_STATUS hypercall. It's used by the guest to retrieve a bitmap to indicate the SDEI event states, including registration, enablement and delivery state. Signed-off-by: Gavin Shan ---

Re: [PATCH v4 07/21] KVM: arm64: Support SDEI_EVENT_UNREGISTER hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 1:05 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_UNREGISTER hypercall. It's used by the guest to unregister SDEI event. The SDEI event won't be raised to the guest or specific vCPU after it's unregistered successfully. It's notable t

Re: [PATCH v4 06/21] KVM: arm64: Support SDEI_EVENT_CONTEXT hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 7:16 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_CONTEXT hypercall. It's used by the guest to retrieved the original registers (R0 - R17) in its SDEI event handler. Those registers can be corrupted during the SDEI event delivery. Si

Re: [PATCH v4 05/21] KVM: arm64: Support SDEI_EVENT_{ENABLE, DISABLE} hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/10/21 12:02 AM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_{ENABLE, DISABLE} hypercall. After SDEI event is registered by guest, it won't be delivered to the guest until it's enabled. On the other hand, the SDEI event won't be raised to the g

Re: [PATCH v4 04/21] KVM: arm64: Support SDEI_EVENT_REGISTER hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/9/21 11:50 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_EVENT_REGISTER hypercall, which is used by guest to register SDEI events. The SDEI event won't be raised to the guest or specific vCPU until it's registered and enabled explicitly. Only tho

Re: [PATCH 1/2] KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs

2022-01-11 Thread Alexandru Elisei
Hi Marc, On Tue, Jan 11, 2022 at 01:30:41PM +, Marc Zyngier wrote: > On Tue, 11 Jan 2022 07:37:57 +, > Reiji Watanabe wrote: > > > > Hi Alex, > > > > On Mon, Jan 10, 2022 at 2:48 AM Alexandru Elisei > > wrote: > > > > > > Hi Reiji, > > > > > > On Sun, Jan 09, 2022 at 09:40:41PM -0800,

Re: [PATCH v3] hw/arm/virt: KVM: Enable PAuth when supported by the host

2022-01-11 Thread Marc Zyngier
On Tue, 11 Jan 2022 13:58:49 +, Peter Maydell wrote: > > On Sat, 8 Jan 2022 at 13:42, Marc Zyngier wrote: > > > > On 2022-01-07 20:23, Richard Henderson wrote: > > > On 1/7/22 7:01 AM, Marc Zyngier wrote: > > >> @@ -1380,17 +1380,10 @@ void arm_cpu_finalize_features(ARMCPU *cpu, > > >> Error

Re: [PATCH v3] hw/arm/virt: KVM: Enable PAuth when supported by the host

2022-01-11 Thread Peter Maydell
On Sat, 8 Jan 2022 at 13:42, Marc Zyngier wrote: > > On 2022-01-07 20:23, Richard Henderson wrote: > > On 1/7/22 7:01 AM, Marc Zyngier wrote: > >> @@ -1380,17 +1380,10 @@ void arm_cpu_finalize_features(ARMCPU *cpu, > >> Error **errp) > >> return; > >> } > >> -/* >

Re: [PATCH 1/2] KVM: arm64: mixed-width check should be skipped for uninitialized vCPUs

2022-01-11 Thread Marc Zyngier
On Tue, 11 Jan 2022 07:37:57 +, Reiji Watanabe wrote: > > Hi Alex, > > On Mon, Jan 10, 2022 at 2:48 AM Alexandru Elisei > wrote: > > > > Hi Reiji, > > > > On Sun, Jan 09, 2022 at 09:40:41PM -0800, Reiji Watanabe wrote: > > > vcpu_allowed_register_width() checks if all the VCPUs are either >

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-11 Thread Mark Rutland
On Tue, Jan 11, 2022 at 12:32:38PM +0100, Nicolas Saenz Julienne wrote: > Hi Mark, > > On Tue, 2022-01-04 at 16:39 +, Mark Rutland wrote: > > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > > On 12/17/21 15:38, Mark Rutland wrote: > > > > For example kvm_guest_enter_irqoff()

Re: [RFC PATCH 0/3] ARM64: Guest performance improvement during dirty

2022-01-11 Thread Marc Zyngier
On Mon, 10 Jan 2022 21:04:38 +, Jing Zhang wrote: > > This patch is to reduce the performance degradation of guest workload during > dirty logging on ARM64. A fast path is added to handle permission relaxation > during dirty logging. The MMU lock is replaced with rwlock, by which all > permis

Re: Possible nohz-full/RCU issue in arm64 KVM

2022-01-11 Thread Nicolas Saenz Julienne
Hi Mark, On Tue, 2022-01-04 at 16:39 +, Mark Rutland wrote: > On Fri, Dec 17, 2021 at 04:54:22PM +0100, Paolo Bonzini wrote: > > On 12/17/21 15:38, Mark Rutland wrote: > > > For example kvm_guest_enter_irqoff() calls guest_enter_irq_off() which > > > calls > > > vtime_account_guest_enter(), b

Re: [RFC PATCH 2/3] KVM: arm64: Add fast path to handle permission relaxation during dirty logging

2022-01-11 Thread Marc Zyngier
Coming back to this, as it does bother me. On Mon, 10 Jan 2022 21:04:40 +, Jing Zhang wrote: > > To reduce MMU lock contention during dirty logging, all permission > relaxation operations would be performed under read lock. > > Signed-off-by: Jing Zhang > --- > arch/arm64/kvm/mmu.c | 50 +

Re: [RFC PATCH 3/3] KVM: selftests: Add vgic initialization for dirty log perf test for ARM

2022-01-11 Thread Marc Zyngier
On Mon, 10 Jan 2022 21:04:41 +, Jing Zhang wrote: > > For ARM64, if no vgic is setup before the dirty log perf test, the > userspace irqchip would be used, which would affect the dirty log perf > test result. Doesn't it affect *all* performance tests? How much does this change contributes to

Re: [RFC PATCH 1/3] KVM: arm64: Use read/write spin lock for MMU protection

2022-01-11 Thread Marc Zyngier
On Mon, 10 Jan 2022 21:04:39 +, Jing Zhang wrote: > > To reduce the contentions caused by MMU lock, some MMU operations can > be performed under read lock. > One improvement is to add a fast path for permission relaxation during > dirty logging under the read lock. This commit message really

Re: [RFC PATCH 2/3] KVM: arm64: Add fast path to handle permission relaxation during dirty logging

2022-01-11 Thread Marc Zyngier
On Mon, 10 Jan 2022 21:04:40 +, Jing Zhang wrote: > > To reduce MMU lock contention during dirty logging, all permission > relaxation operations would be performed under read lock. > > Signed-off-by: Jing Zhang > --- > arch/arm64/kvm/mmu.c | 50

Re: [RFC PATCH 3/3] KVM: selftests: Add vgic initialization for dirty log perf test for ARM

2022-01-11 Thread Andrew Jones
On Mon, Jan 10, 2022 at 09:04:41PM +, Jing Zhang wrote: > For ARM64, if no vgic is setup before the dirty log perf test, the > userspace irqchip would be used, which would affect the dirty log perf > test result. > > Signed-off-by: Jing Zhang > --- > tools/testing/selftests/kvm/dirty_log_per

Re: [PATCH 2/2] KVM: arm64: selftests: Introduce vcpu_width_config

2022-01-11 Thread Andrew Jones
On Sun, Jan 09, 2022 at 09:40:42PM -0800, Reiji Watanabe wrote: > Introduce a test for aarch64 that ensures non-mixed-width vCPUs > (all 64bit vCPUs or all 32bit vcPUs) can be configured, and > mixed-width vCPUs cannot be configured. > > Signed-off-by: Reiji Watanabe > --- > tools/testing/selfte

Re: [PATCH v4 06/21] KVM: arm64: Support SDEI_EVENT_CONTEXT hypercall

2022-01-11 Thread Shannon Zhao
On 2021/8/15 8:13, Gavin Shan wrote: +static unsigned long kvm_sdei_hypercall_context(struct kvm_vcpu *vcpu) +{ + struct kvm *kvm = vcpu->kvm; + struct kvm_sdei_kvm *ksdei = kvm->arch.sdei; + struct kvm_sdei_vcpu *vsdei = vcpu->arch.sdei; + struct kvm_sdei_vcpu_regs *re

Re: [PATCH v4 02/21] KVM: arm64: Add SDEI virtualization infrastructure

2022-01-11 Thread Shannon Zhao
On 2021/8/15 8:13, Gavin Shan wrote: diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index e9a2b8f27792..2f021aa41632 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -150,6 +150,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) kvm_vgic_early_init(kv

Re: [PATCH v4 03/21] KVM: arm64: Support SDEI_VERSION hypercall

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/9/21 11:26 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: This supports SDEI_VERSION hypercall by returning v1.0.0 simply s/This supports/Add Support. I think this is the prefered way to start the commit msg. Here and elsewhere. Ok. when the functionality is sup

Re: [PATCH v4 02/21] KVM: arm64: Add SDEI virtualization infrastructure

2022-01-11 Thread Gavin Shan
Hi Eric, On 11/9/21 11:45 PM, Eric Auger wrote: On 8/15/21 2:13 AM, Gavin Shan wrote: Software Delegated Exception Interface (SDEI) provides a mechanism for registering and servicing system events. Those system events are high priority events, which must be serviced immediately. It's going to b

Re: [PATCH 3/6] KVM: Remove opaque from kvm_arch_check_processor_compat

2022-01-11 Thread Chao Gao
On Mon, Jan 10, 2022 at 11:06:44PM +, Sean Christopherson wrote: >On Mon, Dec 27, 2021, Chao Gao wrote: >> No arch implementation uses this opaque now. > >Except for the RISC-V part, this can be a pure revert of commit b99040853738 >("KVM: >Pass kvm_init()'s opaque param to additional arch fun

Re: [PATCH v5 4/4] KVM: mmu: remove over-aggressive warnings

2022-01-11 Thread David Stevens
> The best thing to do is probably to wait for for kvm_vcpu_map() to be > eliminated, > as described in the changelogs for commits: > > 357a18ad230f ("KVM: Kill kvm_map_gfn() / kvm_unmap_gfn() and > gfn_to_pfn_cache") > 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted >