From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Piggin Date: Fri, 26 Feb 2021 23:59:13 +0000 Subject: Re: [PATCH v2 16/37] KVM: PPC: Book3S HV P9: Stop handling hcalls in real-mode in the P9 path Message-Id: <1614383911.azeq7dbfo9.astroid@bobo.none> List-Id: References: <20210225134652.2127648-1-npiggin@gmail.com> <20210225134652.2127648-17-npiggin@gmail.com> <47ae7b2f-9356-6cff-da38-142eaea773ca@kaod.org> In-Reply-To: <47ae7b2f-9356-6cff-da38-142eaea773ca@kaod.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: =?iso-8859-1?q?C=E9dric?= Le Goater , kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Excerpts from C=C3=A9dric Le Goater's message of February 26, 2021 12:51 am: > On 2/25/21 2:46 PM, Nicholas Piggin wrote: >> In the interest of minimising the amount of code that is run in >> "real-mode", don't handle hcalls in real mode in the P9 path. >>=20 >> POWER8 and earlier are much more expensive to exit from HV real mode >> and switch to host mode, because on those processors HV interrupts get >> to the hypervisor with the MMU off, and the other threads in the core >> need to be pulled out of the guest, and SLBs all need to be saved, >> ERATs invalidated, and host SLB reloaded before the MMU is re-enabled >> in host mode. Hash guests also require a lot of hcalls to run. The >> XICS interrupt controller requires hcalls to run. >>=20 >> By contrast, POWER9 has independent thread switching, and in radix mode >> the hypervisor is already in a host virtual memory mode when the HV >> interrupt is taken. Radix + xive guests don't need hcalls to handle >> interrupts or manage translations. >>=20 >> So it's much less important to handle hcalls in real mode in P9. >>=20 >> Signed-off-by: Nicholas Piggin >> --- >> arch/powerpc/include/asm/kvm_ppc.h | 5 +++++ >> arch/powerpc/kvm/book3s_hv.c | 25 ++++++++++++++++++++++--- >> arch/powerpc/kvm/book3s_hv_rmhandlers.S | 5 +++++ >> arch/powerpc/kvm/book3s_xive.c | 25 +++++++++++++++++++++++++ >> 4 files changed, 57 insertions(+), 3 deletions(-) >>=20 >> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/a= sm/kvm_ppc.h >> index 73b1ca5a6471..db6646c2ade2 100644 >> --- a/arch/powerpc/include/asm/kvm_ppc.h >> +++ b/arch/powerpc/include/asm/kvm_ppc.h >> @@ -607,6 +607,7 @@ extern void kvmppc_free_pimap(struct kvm *kvm); >> extern int kvmppc_xics_rm_complete(struct kvm_vcpu *vcpu, u32 hcall); >> extern void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu); >> extern int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd); >> +extern int kvmppc_xive_xics_hcall(struct kvm_vcpu *vcpu, u32 req); >> extern u64 kvmppc_xics_get_icp(struct kvm_vcpu *vcpu); >> extern int kvmppc_xics_set_icp(struct kvm_vcpu *vcpu, u64 icpval); >> extern int kvmppc_xics_connect_vcpu(struct kvm_device *dev, >> @@ -639,6 +640,8 @@ static inline int kvmppc_xics_enabled(struct kvm_vcp= u *vcpu) >> static inline void kvmppc_xics_free_icp(struct kvm_vcpu *vcpu) { } >> static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) >> { return 0; } >> +static inline int kvmppc_xive_xics_hcall(struct kvm_vcpu *vcpu, u32 req) >> + { return 0; } >> #endif >> =20 >> #ifdef CONFIG_KVM_XIVE >> @@ -673,6 +676,7 @@ extern int kvmppc_xive_set_irq(struct kvm *kvm, int = irq_source_id, u32 irq, >> int level, bool line_status); >> extern void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu); >> extern void kvmppc_xive_pull_vcpu(struct kvm_vcpu *vcpu); >> +extern void kvmppc_xive_cede_vcpu(struct kvm_vcpu *vcpu); >=20 > I can not find this routine. Is it missing or coming later in the patchse= t ?=20 Yeah it leaked into a later patch but it belongs here. I'll fix it. Thanks, Nick