From: Christoph Hellwig <hch@infradead.org>
To: Troy Benjegerdes <troy.benjegerdes@sifive.com>
Cc: Atish Patra <atish.patra@wdc.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexios Zavras <alexios.zavras@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Palmer Dabbelt <palmer@sifive.com>,
Anup Patel <anup.patel@wdc.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org,
Allison Randal <allison@lohutok.net>,
ron minnich <rminnich@gmail.com>
Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible.
Date: Mon, 12 Aug 2019 10:55:41 -0700 [thread overview]
Message-ID: <20190812175541.GA23733@infradead.org> (raw)
In-Reply-To: <118B0DE7-EDCC-4947-88E5-7FF133A757D8@sifive.com>
On Mon, Aug 12, 2019 at 10:36:25AM -0500, Troy Benjegerdes wrote:
> Is there anything other than convention and current usage that prevents
> the kernel from natively handling TLB flushes without ever making the SBI
> call?
Yes and no.
In all existing RISC-V implementation remote TLB flushes are simply
implementing using IPIs. So you could trivially implement remote TLB
flush using IPIs, and in fact Gary Guo posted a series to do that a
while ago.
But: the RISC privileged spec requires that IPIs are only issued from
M-mode and only delivered to M-mode. So what would be a trivial MMIO
write plus interupt to wakeup the remote hart actually turns into
a dance requiring multiple context switches between privile levels,
and without additional optimizations that will be even slower than the
current SBI based implementation.
I've started a prototype implementation and spec edits to relax this
and allow direct IPIs from S-mode to S-mode, which will speed up IPIs
by about an order of magnitude, and I hope this will be how future
RISC-V implementations work.
> Someone is eventually going to want to run the linux kernel in machine mode,
> likely for performance and/or security reasons, and this will require flushing TLBs
> natively anyway.
The nommu ports run in M-mode. But running a MMU-enabled port in M-mode
is rather painful if not impossible (trust me, I've tried) due to how
the privileged spec says that M-mode generally runs without address
translation. There is a workaround using the MPRV bit in mstatus, but
even that just uses the address translation for loads and stores, and
not for the program text.
next prev parent reply other threads:[~2019-08-12 17:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-10 1:43 [PATCH] RISC-V: Issue a local tlb flush if possible Atish Patra
2019-08-10 3:30 ` Anup Patel
2019-08-10 5:28 ` Atish Patra
2019-08-10 6:37 ` Andreas Schwab
2019-08-10 9:21 ` Atish Patra
2019-08-12 14:56 ` Christoph Hellwig
2019-08-13 0:15 ` Atish Patra
2019-08-13 14:30 ` hch
2019-08-15 20:37 ` Atish Patra
2019-08-19 14:46 ` hch
2019-08-19 15:09 ` Anup Patel
2019-08-19 15:10 ` hch
2019-08-20 0:02 ` Atish Patra
2019-08-12 15:36 ` Troy Benjegerdes
2019-08-12 17:13 ` Atish Patra
2019-08-12 17:55 ` Christoph Hellwig [this message]
2019-08-13 18:25 ` Paul Walmsley
2019-08-14 1:49 ` Atish Patra
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=20190812175541.GA23733@infradead.org \
--to=hch@infradead.org \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=anup.patel@wdc.com \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@wdc.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
--cc=rminnich@gmail.com \
--cc=troy.benjegerdes@sifive.com \
/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).