From: Nicholas Piggin <npiggin@gmail.com>
To: Paul Mackerras <paulus@ozlabs.org>
Cc: Alexander Graf <agraf@suse.com>,
kvm-ppc@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] KVM: PPC: Book3S: Change interrupt call to reduce scratch space use on HV
Date: Tue, 6 Dec 2016 18:31:33 +1000 [thread overview]
Message-ID: <20161206183133.384feba6@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <20161206060907.GA25458@fergus.ozlabs.ibm.com>
On Tue, 6 Dec 2016 17:09:07 +1100
Paul Mackerras <paulus@ozlabs.org> wrote:
> On Thu, Dec 01, 2016 at 06:18:10PM +1100, Nicholas Piggin wrote:
> > Change the calling convention to put the trap number together with
> > CR in two halves of r12, which frees up HSTATE_SCRATCH2 in the HV
> > handler, and r9 free.
>
> Cute idea! Some comments below...
>
> > The 64-bit PR handler entry translates the calling convention back
> > to match the previous call convention (i.e., shared with 32-bit), for
> > simplicity.
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > arch/powerpc/include/asm/exception-64s.h | 28 +++++++++++++++-------------
> > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 15 +++++++--------
> > arch/powerpc/kvm/book3s_segment.S | 27 ++++++++++++++++++++-------
> > 3 files changed, 42 insertions(+), 28 deletions(-)
> >
> > diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
> > index 9a3eee6..bc8fc45 100644
> > --- a/arch/powerpc/include/asm/exception-64s.h
> > +++ b/arch/powerpc/include/asm/exception-64s.h
> > @@ -233,7 +233,7 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
> >
> > #endif
> >
> > -#define __KVM_HANDLER_PROLOG(area, n) \
> > +#define __KVM_HANDLER(area, h, n) \
> > BEGIN_FTR_SECTION_NESTED(947) \
> > ld r10,area+EX_CFAR(r13); \
> > std r10,HSTATE_CFAR(r13); \
> > @@ -243,30 +243,32 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
> > std r10,HSTATE_PPR(r13); \
> > END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,948); \
> > ld r10,area+EX_R10(r13); \
> > - stw r9,HSTATE_SCRATCH1(r13); \
> > - ld r9,area+EX_R9(r13); \
> > std r12,HSTATE_SCRATCH0(r13); \
> > -
> > -#define __KVM_HANDLER(area, h, n) \
> > - __KVM_HANDLER_PROLOG(area, n) \
> > - li r12,n; \
> > + li r12,(n); \
> > + sldi r12,r12,32; \
> > + or r12,r12,r9; \
>
> Did you consider doing it the other way around, i.e. with r12
> containing (cr << 32) | trap? That would save 1 instruction in each
> handler:
When I tinkered with it I thought it came out slightly nicer this way, but
your suggested versions seem to prove me wrong. I can change it if you'd
like.
>
> + sldi r12,r9,32; \
> + ori r12,r12,(n); \
>
> > + ld r9,area+EX_R9(r13); \
> > + std r9,HSTATE_SCRATCH1(r13); \
>
> Why not put this std in kvmppc_interrupt[_hv] rather than in each
> handler?
Patch 3/3 uses r9 to load the ctr when CONFIG_RELOCATABLE is turned on, so
this resulted in the smaller difference between the two cases. I agree it's
not ideal when config relocatable is off.
[snip]
Thanks,
Nick
next prev parent reply other threads:[~2016-12-06 8:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-01 7:18 [PATCH 0/3] KVM: PPC: Book3S: 64-bit CONFIG_RELOCATABLE fixes Nicholas Piggin
2016-12-01 7:18 ` [PATCH 1/3] KVM: PPC: Book3S: Change interrupt call to reduce scratch space use on HV Nicholas Piggin
2016-12-06 6:09 ` Paul Mackerras
2016-12-06 8:31 ` Nicholas Piggin [this message]
2016-12-01 7:18 ` [PATCH 2/3] KVM: PPC: Book3S: Move 64-bit KVM interrupt handler out from alt section Nicholas Piggin
2016-12-01 7:18 ` [PATCH 3/3] KVM: PPC: Book3S: 64-bit CONFIG_RELOCATABLE support for interrupts Nicholas Piggin
-- strict thread matches above, loose matches on Subject: below --
2016-12-21 18:29 [PATCH v2 0/3] KVM: PPC: Book3S: 64-bit CONFIG_RELOCATABLE fixes Nicholas Piggin
2016-12-21 18:29 ` [PATCH 1/3] KVM: PPC: Book3S: Change interrupt call to reduce scratch space use on HV Nicholas Piggin
2017-01-27 2:21 ` Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161206183133.384feba6@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=agraf@suse.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).