From: Conor Dooley <conor.dooley@microchip.com>
To: Jinyu Tang <tjytimi@163.com>
Cc: <palmer@rivosinc.com>, <paul.walmsley@sifive.com>,
<palmer@dabbelt.com>, <yuzhao@google.com>,
<ajones@ventanamicro.com>, <guoren@kernel.org>,
<tongtiangen@huawei.com>, <anup@brainfault.org>,
<akpm@linux-foundation.org>, <falcon@tinylab.org>,
<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] riscv: support arch_has_hw_pte_young()
Date: Mon, 30 Jan 2023 10:14:25 +0000 [thread overview]
Message-ID: <Y9eYgSnTmI168933@wendy> (raw)
In-Reply-To: <20230129064956.143664-1-tjytimi@163.com>
[-- Attachment #1.1: Type: text/plain, Size: 1592 bytes --]
On Sun, Jan 29, 2023 at 02:49:56PM +0800, Jinyu Tang wrote:
> The arch_has_hw_pte_young() is false for riscv by default. If it's
> false, page table walk is almost skipped for MGLRU reclaim. And it
> will also cause useless step in __wp_page_copy_user().
>
> RISC-V Privileged Book says that riscv have two schemes to manage A
> and D bit.
>
> So add a config for selecting, the default is true. For simple
> implementation riscv CPU which just generate page fault, unselect it.
>
> Signed-off-by: Jinyu Tang <tjytimi@163.com>
> ---
> arch/riscv/Kconfig | 10 ++++++++++
> arch/riscv/include/asm/pgtable.h | 7 +++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index e2b656043abf..17c82885549c 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -180,6 +180,16 @@ config PAGE_OFFSET
> default 0x80000000 if 64BIT && !MMU
> default 0xff60000000000000 if 64BIT
>
> +config ARCH_HAS_HARDWARE_PTE_YOUNG
> + bool "Hardware Set PTE Access Bit"
> + default y
> + help
> + Select if hardware set A bit when PTE is accessed. The default is
> + 'Y', because most RISC-V CPU hardware can manage A and D bit.
> + But RISC-V may have simple implementation that do not support
> + hardware set A bit but only generate page fault, for that case just
> + unselect it.
Hmm, I am not really sure if this is the right way to go. Should we
really be defaulting this option to enabled if there are going to be
implementations that do not support it?
Thanks,
Conor.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Conor Dooley <conor.dooley@microchip.com>
To: Jinyu Tang <tjytimi@163.com>
Cc: <palmer@rivosinc.com>, <paul.walmsley@sifive.com>,
<palmer@dabbelt.com>, <yuzhao@google.com>,
<ajones@ventanamicro.com>, <guoren@kernel.org>,
<tongtiangen@huawei.com>, <anup@brainfault.org>,
<akpm@linux-foundation.org>, <falcon@tinylab.org>,
<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] riscv: support arch_has_hw_pte_young()
Date: Mon, 30 Jan 2023 10:14:25 +0000 [thread overview]
Message-ID: <Y9eYgSnTmI168933@wendy> (raw)
In-Reply-To: <20230129064956.143664-1-tjytimi@163.com>
[-- Attachment #1: Type: text/plain, Size: 1592 bytes --]
On Sun, Jan 29, 2023 at 02:49:56PM +0800, Jinyu Tang wrote:
> The arch_has_hw_pte_young() is false for riscv by default. If it's
> false, page table walk is almost skipped for MGLRU reclaim. And it
> will also cause useless step in __wp_page_copy_user().
>
> RISC-V Privileged Book says that riscv have two schemes to manage A
> and D bit.
>
> So add a config for selecting, the default is true. For simple
> implementation riscv CPU which just generate page fault, unselect it.
>
> Signed-off-by: Jinyu Tang <tjytimi@163.com>
> ---
> arch/riscv/Kconfig | 10 ++++++++++
> arch/riscv/include/asm/pgtable.h | 7 +++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index e2b656043abf..17c82885549c 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -180,6 +180,16 @@ config PAGE_OFFSET
> default 0x80000000 if 64BIT && !MMU
> default 0xff60000000000000 if 64BIT
>
> +config ARCH_HAS_HARDWARE_PTE_YOUNG
> + bool "Hardware Set PTE Access Bit"
> + default y
> + help
> + Select if hardware set A bit when PTE is accessed. The default is
> + 'Y', because most RISC-V CPU hardware can manage A and D bit.
> + But RISC-V may have simple implementation that do not support
> + hardware set A bit but only generate page fault, for that case just
> + unselect it.
Hmm, I am not really sure if this is the right way to go. Should we
really be defaulting this option to enabled if there are going to be
implementations that do not support it?
Thanks,
Conor.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-01-30 17:56 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 6:49 [PATCH v1] riscv: support arch_has_hw_pte_young() Jinyu Tang
2023-01-29 6:49 ` Jinyu Tang
2023-01-30 8:22 ` Andrew Jones
2023-01-30 8:22 ` Andrew Jones
2023-01-30 10:14 ` Conor Dooley [this message]
2023-01-30 10:14 ` Conor Dooley
2023-01-30 10:25 ` Anup Patel
2023-01-30 10:25 ` Anup Patel
2023-01-30 10:49 ` Andrew Jones
2023-01-30 10:49 ` Andrew Jones
2023-01-30 17:27 ` Jessica Clarke
2023-01-30 17:27 ` Jessica Clarke
2023-08-25 5:42 ` Yong-Xuan Wang
2023-08-25 5:42 ` Yong-Xuan Wang
2023-08-25 19:39 ` Alexandre Ghiti
2023-08-25 19:39 ` Alexandre Ghiti
2023-08-28 7:26 ` Yong-Xuan Wang
2023-08-28 7:26 ` Yong-Xuan Wang
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=Y9eYgSnTmI168933@wendy \
--to=conor.dooley@microchip.com \
--cc=ajones@ventanamicro.com \
--cc=akpm@linux-foundation.org \
--cc=anup@brainfault.org \
--cc=falcon@tinylab.org \
--cc=guoren@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.com \
--cc=tjytimi@163.com \
--cc=tongtiangen@huawei.com \
--cc=yuzhao@google.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 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.