public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andrew Jones <ajones@ventanamicro.com>,
	Qinglin Pan <panqinglin2020@iscas.ac.cn>,
	Ryan Roberts <ryan.roberts@arm.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -fixes 2/2] riscv: Fix set_huge_pte_at() for NAPOT mappings when a swap entry is set
Date: Sat, 30 Sep 2023 10:14:34 +0100	[thread overview]
Message-ID: <20230930-unnoticed-slacked-0bf5696cc265@spud> (raw)
In-Reply-To: <20230928151846.8229-3-alexghiti@rivosinc.com>


[-- Attachment #1.1: Type: text/plain, Size: 2407 bytes --]

On Thu, Sep 28, 2023 at 05:18:46PM +0200, Alexandre Ghiti wrote:
> We used to determine the number of page table entries to set for a NAPOT
> hugepage by using the pte value which actually fails when the pte to set is
> a swap entry.
> 
> So take advantage of a recent fix for arm64 reported in [1] which
> introduces the size of the mapping as an argument of set_huge_pte_at(): we
> can then use this size to compute the number of page table entries to set
> for a NAPOT region.
> 
> Fixes: 82a1a1f3bfb6 ("riscv: mm: support Svnapot in hugetlb page")
> Reported-by: Ryan Roberts <ryan.roberts@arm.com>
> Closes: https://lore.kernel.org/linux-arm-kernel/20230922115804.2043771-1-ryan.roberts@arm.com/ [1]
> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Breaks the build. Your $subject marks this for -fixes, but this will not
build there, as it relies on content that's not yet in that branch.
AFAICT, you're going to have to resend this with akpm on CC, as the
dependency is in his tree...

Thanks,
Conor.

> ---
>  arch/riscv/mm/hugetlbpage.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/riscv/mm/hugetlbpage.c b/arch/riscv/mm/hugetlbpage.c
> index e4a2ace92dbe..b52f0210481f 100644
> --- a/arch/riscv/mm/hugetlbpage.c
> +++ b/arch/riscv/mm/hugetlbpage.c
> @@ -183,15 +183,22 @@ void set_huge_pte_at(struct mm_struct *mm,
>  		     pte_t pte,
>  		     unsigned long sz)
>  {
> +	unsigned long hugepage_shift;
>  	int i, pte_num;
>  
> -	if (!pte_napot(pte)) {
> -		set_pte_at(mm, addr, ptep, pte);
> -		return;
> -	}
> +	if (sz >= PGDIR_SIZE)
> +		hugepage_shift = PGDIR_SHIFT;
> +	else if (sz >= P4D_SIZE)
> +		hugepage_shift = P4D_SHIFT;
> +	else if (sz >= PUD_SIZE)
> +		hugepage_shift = PUD_SHIFT;
> +	else if (sz >= PMD_SIZE)
> +		hugepage_shift = PMD_SHIFT;
> +	else
> +		hugepage_shift = PAGE_SHIFT;
>  
> -	pte_num = napot_pte_num(napot_cont_order(pte));
> -	for (i = 0; i < pte_num; i++, ptep++, addr += PAGE_SIZE)
> +	pte_num = sz >> hugepage_shift;
> +	for (i = 0; i < pte_num; i++, ptep++, addr += (1 << hugepage_shift))
>  		set_pte_at(mm, addr, ptep, pte);
>  }
>  
> -- 
> 2.39.2
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

[-- 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

  reply	other threads:[~2023-09-30  9:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 15:18 [PATCH -fixes 0/2] Fix set_huge_pte_at() Alexandre Ghiti
2023-09-28 15:18 ` [PATCH -fixes 1/2] riscv: Handle VM_FAULT_[HWPOISON|HWPOISON_LARGE] faults instead of panicking Alexandre Ghiti
2023-09-28 15:18 ` [PATCH -fixes 2/2] riscv: Fix set_huge_pte_at() for NAPOT mappings when a swap entry is set Alexandre Ghiti
2023-09-30  9:14   ` Conor Dooley [this message]
2023-10-02  7:18     ` Alexandre Ghiti
2023-10-02 13:11       ` Conor Dooley
2023-10-03 15:35         ` Alexandre Ghiti
2023-10-03  7:42   ` Andrew Jones
2023-10-03 15:43 ` [PATCH -fixes 0/2] Fix set_huge_pte_at() Alexandre Ghiti
2023-10-03 16:04   ` Andrew Morton
2023-10-04 16:37     ` Palmer Dabbelt
2023-10-26  8:57     ` Alexandre Ghiti
2023-10-26 14:13       ` Andrew Morton
2023-10-26 14:15         ` Alexandre Ghiti
2023-10-26 14:30           ` Ryan Roberts
2023-10-26 14:54             ` Andrew Morton
2023-10-26 15:00               ` Ryan Roberts

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=20230930-unnoticed-slacked-0bf5696cc265@spud \
    --to=conor@kernel.org \
    --cc=ajones@ventanamicro.com \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=panqinglin2020@iscas.ac.cn \
    --cc=paul.walmsley@sifive.com \
    --cc=ryan.roberts@arm.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