From: Nicholas Piggin <npiggin@gmail.com>
To: Rik van Riel <riel@surriel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Possibility of conflicting memory types in lazier TLB mode?
Date: Fri, 15 May 2020 16:50:19 +1000 [thread overview]
Message-ID: <1589523957.s4pf3vd48l.astroid@bobo.none> (raw)
Hi Rik,
Commit 145f573b89a62 ("Make lazy TLB mode lazier").
A couple of questions here (and I don't know the x86 architecture too
well let alone the ASID stuff, so bear with me). I'm assuming, and it
appears to be in the x86 manual that you can't map the same physical
page with conflicting memory types on different processors in general
(or in different ASIDs on the same processor?)
Firstly, the freed_tables check, that's to prevent CPUs in the lazy mode
with this mm loaded in their ASID from bringing in new translations
based on random "stuff" if they happen to speculatively load userspace
addresses (but in lazy mode they would never explicitly load such
addresses), right?
I'm guessing that's a problem but the changed pte case is not, is
because the table walker is going to barf if it sees garbage, but a
valid pte is okay.
Now the intel manual says conflicting attributes are bad because you'll
lose cache coherency on stores. But the speculative accesses from the
lazy thread will never push stores to cache coherency and result of the
loads doesn't matter, so maybe that's how this special case avoids the
problem.
But what about if there are (real, not speculative) stores in the store
queue still on the lazy thread from when it was switched, that have not
yet become coherent? The page is freed by another CPU and reallocated
for something that maps it as nocache. Do you have a coherency problem
there?
Ensuring the store queue is drained when switching to lazy seems like it
would fix it, maybe context switch code does that already or you have
some other trick or reason it's not a problem. Am I way off base here?
Thanks,
Nick
next reply other threads:[~2020-05-15 6:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 6:50 Nicholas Piggin [this message]
2020-05-15 19:24 ` Rik van Riel
2020-05-16 2:35 ` Nicholas Piggin
2020-05-27 0:09 ` Andy Lutomirski
2020-05-27 12:06 ` Andrew Cooper
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=1589523957.s4pf3vd48l.astroid@bobo.none \
--to=npiggin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®