mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandre Ghiti <alex@ghiti.fr>
To: Chunyan Zhang <zhangchunyan@iscas.ac.cn>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Chunyan Zhang <zhang.lyra@gmail.com>
Subject: Re: [RESEND PATCH V4 1/3] riscv: mm: Prepare for reusing PTE RSW bit(9)
Date: Tue, 5 Nov 2024 13:45:44 +0100	[thread overview]
Message-ID: <bedac8d9-4ba4-427c-9323-edcdbd7876ee@ghiti.fr> (raw)
In-Reply-To: <20240830011101.3189522-2-zhangchunyan@iscas.ac.cn>

Hi Chunyan,

On 30/08/2024 03:10, Chunyan Zhang wrote:
> The PTE bit(9) on RISC-V is reserved for software, it is used by DEVMAP
> now which has to be disabled if we want to use bit(9) for other features,
> since there's no more free PTE bit on RISC-V now.
>
> So to make ARCH_HAS_PTE_DEVMAP selectable, this patch uses it as
> the build condition of devmap definitions.
>
> Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
> ---
>   arch/riscv/include/asm/pgtable-64.h   | 2 +-
>   arch/riscv/include/asm/pgtable-bits.h | 6 ++++++
>   2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h
> index 0897dd99ab8d..babb8d2b0f0b 100644
> --- a/arch/riscv/include/asm/pgtable-64.h
> +++ b/arch/riscv/include/asm/pgtable-64.h
> @@ -398,7 +398,7 @@ static inline struct page *pgd_page(pgd_t pgd)
>   #define p4d_offset p4d_offset
>   p4d_t *p4d_offset(pgd_t *pgd, unsigned long address);
>   
> -#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> +#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_ARCH_HAS_PTE_DEVMAP)
>   static inline int pte_devmap(pte_t pte);
>   static inline pte_t pmd_pte(pmd_t pmd);
>   
> diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h
> index a8f5205cea54..5bcc73430829 100644
> --- a/arch/riscv/include/asm/pgtable-bits.h
> +++ b/arch/riscv/include/asm/pgtable-bits.h
> @@ -19,7 +19,13 @@
>   #define _PAGE_SOFT      (3 << 8)    /* Reserved for software */
>   
>   #define _PAGE_SPECIAL   (1 << 8)    /* RSW: 0x1 */
> +
> +#ifdef CONFIG_ARCH_HAS_PTE_DEVMAP
>   #define _PAGE_DEVMAP    (1 << 9)    /* RSW, devmap */
> +#else
> +#define _PAGE_DEVMAP	0
> +#endif /* CONFIG_ARCH_HAS_PTE_DEVMAP */
> +
>   #define _PAGE_TABLE     _PAGE_PRESENT
>   
>   /*


There is a small inconsistency in our code: pte_devmap() is protected by 
a #ifdef but pte_mkdevmap() is not, I guess that's why you had to define 
_PAGE_DEVMAP if !CONFIG_ARCH_HAS_PTE_DEVMAP.

I'd be in favor of removing the #ifdef around pte_devmap() too.

Thanks,

Alex


  reply	other threads:[~2024-11-05 12:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-30  1:10 [RESEND PATCH V4 0/3] riscv: mm: Add soft-dirty and uffd-wp support Chunyan Zhang
2024-08-30  1:10 ` [RESEND PATCH V4 1/3] riscv: mm: Prepare for reusing PTE RSW bit(9) Chunyan Zhang
2024-11-05 12:45   ` Alexandre Ghiti [this message]
2024-11-06  6:32     ` Chunyan Zhang
2024-08-30  1:11 ` [RESEND PATCH V4 2/3] riscv: mm: Add soft-dirty page tracking support Chunyan Zhang
2024-08-30  1:31   ` Jinjie Ruan
2024-08-30  2:31     ` Chunyan Zhang
2024-11-05 13:14       ` Alexandre Ghiti
2024-11-06  2:34         ` Jinjie Ruan
2024-11-06  6:42         ` Chunyan Zhang
2024-11-05 13:13   ` Alexandre Ghiti
2024-11-06  6:41     ` Chunyan Zhang
2024-08-30  1:11 ` [RESEND PATCH V4 3/3] riscv: mm: Add uffd write-protect support Chunyan Zhang
2024-08-30  1:34   ` Jinjie Ruan
2024-11-05 13:24   ` Alexandre Ghiti

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=bedac8d9-4ba4-427c-9323-edcdbd7876ee@ghiti.fr \
    --to=alex@ghiti.fr \
    --cc=akpm@linux-foundation.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=zhang.lyra@gmail.com \
    --cc=zhangchunyan@iscas.ac.cn \
    /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®