From: "Wu, Fei" <fei2.wu@intel.com>
To: Richard Henderson <richard.henderson@linaro.org>,
LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bin.meng@windriver.com>,
Weiwei Li <liweiwei@iscas.ac.cn>,
Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change
Date: Wed, 22 Mar 2023 11:36:01 +0800 [thread overview]
Message-ID: <38598c82-f625-b84b-0f91-30b1fe98e8c6@intel.com> (raw)
In-Reply-To: <b48b2cb9-bf2c-f527-435d-df497ea4df76@linaro.org>
On 3/22/2023 11:31 AM, Richard Henderson wrote:
> On 3/21/23 19:47, Wu, Fei wrote:
>>>> You should be making use of different softmmu indexes, similar to how
>>>> ARM uses a separate index for PAN (privileged access never) mode. If
>>>> I read the manual properly, PAN == !SUM.
>>>>
>>>> When you do this, you need no additional flushing.
>>>
>>> Hi Fei,
>>>
>>> Let's follow Richard's advice.
>>> Yes, I'm thinking about how to do it, and thank Richard for the advice.
>>
>> My question is:
>> * If we ensure this separate index (S+SUM) has no overlapping tlb
>> entries with S-mode (ignore M-mode so far), during SUM=1, we have to
>> look into both (S+SUM) and S index for kernel address translation, that
>> should be not desired.
>
> This is an incorrect assumption. S+SUM may very well have overlapping
> tlb entries with S.
> With SUM=1, you *only* look in S+SUM index; with SUM=0, you *only* look
> in S index.
>
> The only difference is a check in get_physical_address is no longer
> against MSTATUS_SUM directly, but against the mmu_index.
>
>> * If all the tlb operations are against (S+SUM) during SUM=1, then
>> (S+SUM) could contain some duplicated tlb entries of kernel address in S
>> index, the duplication means extra tlb lookup and fill.
>
> Yes, if the same address is probed via S and S+SUM, there is a
> duplicated lookup. But this is harmless.
>
>
>> Also if we want
>> to flush tlb entry of specific addr0, we have to flush both index.
>
> Yes, this is also true. But so far target/riscv is making no use of
> per-mmuidx flushing. At the moment you're *only* using tlb_flush(cpu),
> which flushes every mmuidx. Nor are you making use of per-page flushing.
>
> So, really, no change required at all there.
>
Got it, let me try this method.
Thanks,
Fei.
>
> r~
next prev parent reply other threads:[~2023-03-22 3:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 6:37 [PATCH] target/riscv: reduce overhead of MSTATUS_SUM change fei2.wu
2023-03-21 8:28 ` liweiwei
2023-03-21 8:40 ` Wu, Fei
2023-03-21 8:50 ` liweiwei
2023-03-21 9:14 ` Wu, Fei
2023-03-21 9:47 ` liweiwei
2023-03-21 12:00 ` Wu, Fei
2023-03-21 12:46 ` liweiwei
2023-03-21 12:58 ` liweiwei
2023-03-21 13:22 ` Wu, Fei
2023-03-21 13:27 ` liweiwei
2023-03-21 16:10 ` Richard Henderson
2023-03-22 1:58 ` LIU Zhiwei
2023-03-22 2:47 ` Wu, Fei
2023-03-22 3:16 ` LIU Zhiwei
2023-03-22 3:31 ` Richard Henderson
2023-03-22 3:36 ` Wu, Fei [this message]
2023-03-22 6:40 ` Wu, Fei
2023-03-22 6:50 ` LIU Zhiwei
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=38598c82-f625-b84b-0f91-30b1fe98e8c6@intel.com \
--to=fei2.wu@intel.com \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zhiwei_liu@linux.alibaba.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).