From: Nicholas Piggin <npiggin@gmail.com>
To: Paul Mackerras <paulus@ozlabs.org>
Cc: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Balbir Singh <bsingharora@gmail.com>
Subject: Re: [PATCH 06/10] powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM
Date: Mon, 7 May 2018 19:38:49 +1000 [thread overview]
Message-ID: <20180507193849.43d701ef@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <20180507051526.GE9440@fergus.ozlabs.ibm.com>
On Mon, 7 May 2018 15:15:26 +1000
Paul Mackerras <paulus@ozlabs.org> wrote:
> On Sun, May 06, 2018 at 05:37:27PM +1000, Nicholas Piggin wrote:
> > Implement a local TLB flush for invalidating an LPID with variants for
> > process or partition scope. And a global TLB flush for invalidating
> > a partition scoped page of an LPID.
> >
> > These will be used by KVM in subsequent patches.
> >
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> > ---
> > .../include/asm/book3s/64/tlbflush-radix.h | 7 +
> > arch/powerpc/mm/tlb-radix.c | 207 ++++++++++++++++++
> > 2 files changed, 214 insertions(+)
> >
> > diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> > index 19b45ba6caf9..ef5c3f2994c9 100644
> > --- a/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> > +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-radix.h
> > @@ -51,4 +51,11 @@ extern void radix__flush_tlb_all(void);
> > extern void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
> > unsigned long address);
> >
> > +extern void radix__flush_tlb_lpid_page(unsigned int lpid,
> > + unsigned long addr,
> > + unsigned long page_size);
> > +extern void radix__flush_pwc_lpid(unsigned int lpid);
> > +extern void radix__local_flush_tlb_lpid(unsigned int lpid);
> > +extern void radix__local_flush_tlb_lpid_guest(unsigned int lpid);
> > +
> > #endif
> > diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
> > index a5d7309c2d05..5ac3206c51cc 100644
> > --- a/arch/powerpc/mm/tlb-radix.c
> > +++ b/arch/powerpc/mm/tlb-radix.c
> > @@ -118,6 +118,53 @@ static inline void __tlbie_pid(unsigned long pid, unsigned long ric)
> > trace_tlbie(0, 0, rb, rs, ric, prs, r);
> > }
> >
> > +static inline void __tlbiel_lpid(unsigned long lpid, int set,
> > + unsigned long ric)
> > +{
> > + unsigned long rb,rs,prs,r;
> > +
> > + rb = PPC_BIT(52); /* IS = 2 */
> > + rb |= set << PPC_BITLSHIFT(51);
> > + rs = 0; /* LPID comes from LPIDR */
> > + prs = 0; /* partition scoped */
> > + r = 1; /* radix format */
> > +
> > + asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
> > + : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
> > + trace_tlbie(lpid, 1, rb, rs, ric, prs, r);
>
> Do we really want 128 trace entries every time
> radix__local_flush_tlb_lpid() or radix__local_flush_tlb_lpid_guest()
> is called? That seems like overkill to me. Could we move the
> trace_tlbie calls here and in __tlbiel_lpid_guest() into the callers
> instead?
Yeah well that's how the powerpc:tlbie tracepoints are defined. I can
see possible benefit to feeding the trace directly to a model or
simulator, but it does make other things harder.
I have a patch around that changes all those tracepoints around to
match the Linux semantics rather than the instructions... If people
would prefer that I can send it (cc'ed Balbir).
But for this patch we should just match the existing tracepoints.
Thanks,
Nick
prev parent reply other threads:[~2018-05-07 9:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180506073731.13097-1-npiggin@gmail.com>
2018-05-06 7:37 ` [PATCH 06/10] powerpc/mm/radix: implement LPID based TLB flushes to be used by KVM Nicholas Piggin
2018-05-07 5:15 ` Paul Mackerras
2018-05-07 9:38 ` Nicholas Piggin [this message]
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=20180507193849.43d701ef@roar.ozlabs.ibm.com \
--to=npiggin@gmail.com \
--cc=bsingharora@gmail.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--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).