[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBlswnN7RJHn8gFz@li-a450e7cc-27df-11b2-a85c-b5a9ac31e8ef.ibm.com>
Date: Tue, 21 Mar 2023 14:07:22 +0530
From: Kautuk Consul <kconsul@...ux.vnet.ibm.com>
To: Nicholas Piggin <npiggin@...il.com>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Fabiano Rosas <farosas@...ux.ibm.com>,
Sathvika Vasireddy <sv@...ux.ibm.com>,
Alexey Kardashevskiy <aik@...abs.ru>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] arch/powerpc/kvm: kvmppc_hv_entry: remove r4
argument
On 2023-03-21 10:24:36, Kautuk Consul wrote:
> > Is r4 there only used for CONFIG_KVM_BOOK3S_HV_P8_TIMING? Could put it
> > under there. Although you then lose the barrier if it's disabled, that
> > is okay if you're sure that's the only memory operation being ordered.
> r4 is also used by the secondary_too_late label. So I decided against
> moving it inside the CONFIG_KVM_BOOK3S_HV_P8_TIMING #ifdef as then I
> would need to again load from HSTATE_KVM_VCPU(r13) in secondary_too_late.
> >
Sorry, forgot to mention, r4 is also being used in the 10f label.
Thats one more reason to not shift the r4 load into the #ifdef.
> > I'm not sure how much new work we want to put into changing this asm
> > code, since it's POWER7/8 only. I would love to move this (and the
> > other) KVM implementations to C like we did with P9. It's a pretty big
> > job though.
> Yeah. I was just reviewing this code and decided to send this small
> improvement to the mailing list. I will check with my team and ask
> them if we could move this implementation to C.
> >
> > Thanks,
> > Nick
> >
> > >
> > > Signed-off-by: Kautuk Consul <kconsul@...ux.vnet.ibm.com>
> > > ---
> > > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 ++++++-----
> > > 1 file changed, 6 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > index b81ba4ee0521..b61f0b2c677b 100644
> > > --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
> > > @@ -85,7 +85,7 @@ _GLOBAL_TOC(kvmppc_hv_entry_trampoline)
> > > RFI_TO_KERNEL
> > >
> > > kvmppc_call_hv_entry:
> > > - ld r4, HSTATE_KVM_VCPU(r13)
> > > + /* Enter guest. */
> > > bl kvmppc_hv_entry
> > >
> > > /* Back from guest - restore host state and return to caller */
> > > @@ -352,9 +352,7 @@ kvm_secondary_got_guest:
> > > mtspr SPRN_LDBAR, r0
> > > isync
> > > 63:
> > > - /* Order load of vcpu after load of vcore */
> > > - lwsync
> > > - ld r4, HSTATE_KVM_VCPU(r13)
> > > + /* Enter guest. */
> > > bl kvmppc_hv_entry
> > >
> > > /* Back from the guest, go back to nap */
> > > @@ -506,7 +504,6 @@ SYM_INNER_LABEL(kvmppc_hv_entry, SYM_L_LOCAL)
> > >
> > > /* Required state:
> > > *
> > > - * R4 = vcpu pointer (or NULL)
> > > * MSR = ~IR|DR
> > > * R13 = PACA
> > > * R1 = host R1
> > > @@ -524,6 +521,10 @@ SYM_INNER_LABEL(kvmppc_hv_entry, SYM_L_LOCAL)
> > > li r6, KVM_GUEST_MODE_HOST_HV
> > > stb r6, HSTATE_IN_GUEST(r13)
> > >
> > > + /* Order load of vcpu after load of vcore */
> > > + lwsync
> > > + ld r4, HSTATE_KVM_VCPU(r13)
> > > +
> > > #ifdef CONFIG_KVM_BOOK3S_HV_P8_TIMING
> > > /* Store initial timestamp */
> > > cmpdi r4, 0
> > > --
> > > 2.39.2
> >
Powered by blists - more mailing lists