All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: PPC: Book3S HV: Remove shared-TLB optimisation from vCPU TLB coherency logic
Date: Wed, 10 Feb 2021 01:44:54 +0000	[thread overview]
Message-ID: <1612919826.6b4hx3kcrb.astroid@bobo.none> (raw)
In-Reply-To: <20200528015331.GD307798@thinks.paulus.ozlabs.org>

Excerpts from Paul Mackerras's message of February 10, 2021 10:39 am:
> On Tue, Feb 09, 2021 at 06:44:53PM +1000, Nicholas Piggin wrote:
>> Excerpts from Paul Mackerras's message of February 9, 2021 5:19 pm:
>> > On Mon, Jan 18, 2021 at 10:26:08PM +1000, Nicholas Piggin wrote:
>> >> Processors that implement ISA v3.0 or later don't necessarily have
>> >> threads in a core sharing all translations, and/or TLBIEL does not
>> >> necessarily invalidate translations on all other threads (the
>> >> architecture talks only about the effect on translations for "the thread
>> >> executing the tlbiel instruction".
>> > 
>> > It seems to me that to have an implementation where TLB entries
>> > created on one thread (say T0) are visible to and usable by another
>> > thread (T1), but a tlbiel on thread T0 does not result in the entry
>> > being removed from visibility/usability on T1, is a pretty insane
>> > implementation.  I'm not sure that the architecture envisaged allowing
>> > this kind of implementation, though perhaps the language doesn't
>> > absolutely prohibit it.
>> > 
>> > This kind of implementation is what you are allowing for in this
>> > patch, isn't it?
>> 
>> Not intentionally, and patch 2 removes the possibility.
>> 
>> The main thing it allows is an implementation where TLB entries created 
>> by T1 which are visble only to T1 do not get removed by TLBIEL on T0.
> 
> I could understand this patch as trying to accommodate both those
> implementations where TLB entries are private to each thread, and
> those implementations where TLB entries are shared, without needing to
> distinguish between them, at the expense of doing unnecessary
> invalidations on both kinds of implementation.

That's exactly what it is. Existing code accommodates shared TLBs, this 
patch additionally allows for private.

>> I also have some concern with ordering of in-flight operations (ptesync,
>> memory ordering, etc) which are mostly avoided with this.
>> 
>> > The sane implementations would be ones where either (a) TLB entries
>> > are private to each thread and tlbiel only works on the local thread,
>> > or (b) TLB entries can be shared and tlbiel works across all threads.
>> > I think this is the conclusion we collectively came to when working on
>> > that bug we worked on towards the end of last year.
>> 
>> I think an implementation could have both types. So it's hard to get 
>> away from flushing all threads.
> 
> Having both private and shared TLB entries in the same implementation
> would seem very odd to me.  What would determine whether a given entry
> is shared or private?

Example: an ERAT or L1 TLB per-thread, and a shared L2 TLB behind that.
The L1 may not be PID/LPID tagged so you don't want to cross-invalidate
other threads every time, say.

Thanks,
Nick

  parent reply	other threads:[~2021-02-10  1:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28  1:53 [PATCH 1/2] KVM: PPC: Book3S HV: Remove user-triggerable WARN_ON Paul Mackerras
2020-05-28  1:53 ` Paul Mackerras
2020-05-28  1:54 ` [PATCH 2/2] KVM: PPC: Book3S HV: Close race with page faults around memslot flushes Paul Mackerras
2020-05-28  1:54   ` Paul Mackerras
2021-01-18 12:26 ` [PATCH 1/2] KVM: PPC: Book3S HV: Remove shared-TLB optimisation from vCPU TLB coherency logic Nicholas Piggin
2021-02-09  7:19 ` Paul Mackerras
2021-02-09  8:44 ` Nicholas Piggin
2021-02-10  0:39 ` Paul Mackerras
2021-02-10  1:44 ` Nicholas Piggin [this message]
2021-02-10  2:46 ` Paul Mackerras
2021-02-10  5:33 ` Nicholas Piggin

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=1612919826.6b4hx3kcrb.astroid@bobo.none \
    --to=npiggin@gmail.com \
    --cc=kvm-ppc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.