From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
Helge Deller <deller@gmx.de>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Naveen N Rao <naveen@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
Arnd Bergmann <arnd@arndb.de>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Uladzislau Rezki <urezki@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
David Hildenbrand <david@redhat.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Dev Jain <dev.jain@arm.com>,
Kevin Brodsky <kevin.brodsky@arm.com>,
Alexandre Ghiti <alexghiti@rivosinc.com>,
linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 1/3] mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear()
Date: Wed, 26 Feb 2025 15:00:34 +0100 [thread overview]
Message-ID: <Z78eglxQbl1+E+2z@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com> (raw)
In-Reply-To: <20250226120656.2400136-2-ryan.roberts@arm.com>
On Wed, Feb 26, 2025 at 12:06:51PM +0000, Ryan Roberts wrote:
> In order to fix a bug, arm64 needs to be told the size of the huge page
> for which the huge_pte is being cleared in huge_ptep_get_and_clear().
> Provide for this by adding an `unsigned long sz` parameter to the
> function. This follows the same pattern as huge_pte_clear() and
> set_huge_pte_at().
>
> This commit makes the required interface modifications to the core mm as
> well as all arches that implement this function (arm64, loongarch, mips,
> parisc, powerpc, riscv, s390, sparc). The actual arm64 bug will be fixed
> in a separate commit.
>
> Cc: stable@vger.kernel.org
> Fixes: 66b3923a1a0f ("arm64: hugetlb: add support for PTE contiguous bit")
> Acked-by: David Hildenbrand <david@redhat.com>
> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> # riscv
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
> arch/arm64/include/asm/hugetlb.h | 4 ++--
> arch/arm64/mm/hugetlbpage.c | 8 +++++---
> arch/loongarch/include/asm/hugetlb.h | 6 ++++--
> arch/mips/include/asm/hugetlb.h | 6 ++++--
> arch/parisc/include/asm/hugetlb.h | 2 +-
> arch/parisc/mm/hugetlbpage.c | 2 +-
> arch/powerpc/include/asm/hugetlb.h | 6 ++++--
> arch/riscv/include/asm/hugetlb.h | 3 ++-
> arch/riscv/mm/hugetlbpage.c | 2 +-
> arch/s390/include/asm/hugetlb.h | 16 ++++++++++++----
> arch/s390/mm/hugetlbpage.c | 4 ++--
> arch/sparc/include/asm/hugetlb.h | 2 +-
> arch/sparc/mm/hugetlbpage.c | 2 +-
> include/asm-generic/hugetlb.h | 2 +-
> include/linux/hugetlb.h | 4 +++-
> mm/hugetlb.c | 4 ++--
> 16 files changed, 46 insertions(+), 27 deletions(-)
...
> diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
> index 7c52acaf9f82..663e87220e89 100644
> --- a/arch/s390/include/asm/hugetlb.h
> +++ b/arch/s390/include/asm/hugetlb.h
> @@ -25,8 +25,16 @@ void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
> #define __HAVE_ARCH_HUGE_PTEP_GET
> pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
>
> +pte_t __huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
> + pte_t *ptep);
> +
> #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
> -pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
> +static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
> + unsigned long addr, pte_t *ptep,
> + unsigned long sz)
> +{
> + return __huge_ptep_get_and_clear(mm, addr, ptep);
> +}
>
> static inline void arch_clear_hugetlb_flags(struct folio *folio)
> {
> @@ -48,7 +56,7 @@ static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
> static inline pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
> unsigned long address, pte_t *ptep)
> {
> - return huge_ptep_get_and_clear(vma->vm_mm, address, ptep);
> + return __huge_ptep_get_and_clear(vma->vm_mm, address, ptep);
> }
>
> #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
> @@ -59,7 +67,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
> int changed = !pte_same(huge_ptep_get(vma->vm_mm, addr, ptep), pte);
>
> if (changed) {
> - huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
> + __huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
> __set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
> }
> return changed;
> @@ -69,7 +77,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
> static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
> unsigned long addr, pte_t *ptep)
> {
> - pte_t pte = huge_ptep_get_and_clear(mm, addr, ptep);
> + pte_t pte = __huge_ptep_get_and_clear(mm, addr, ptep);
>
> __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
> }
> diff --git a/arch/s390/mm/hugetlbpage.c b/arch/s390/mm/hugetlbpage.c
> index d9ce199953de..2e568f175cd4 100644
> --- a/arch/s390/mm/hugetlbpage.c
> +++ b/arch/s390/mm/hugetlbpage.c
> @@ -188,8 +188,8 @@ pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
> return __rste_to_pte(pte_val(*ptep));
> }
>
> -pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
> - unsigned long addr, pte_t *ptep)
> +pte_t __huge_ptep_get_and_clear(struct mm_struct *mm,
> + unsigned long addr, pte_t *ptep)
> {
> pte_t pte = huge_ptep_get(mm, addr, ptep);
> pmd_t *pmdp = (pmd_t *) ptep;
...
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> # s390
Thanks!
next prev parent reply other threads:[~2025-02-26 14:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 12:06 [PATCH v3 0/3] Fixes for hugetlb on arm64 Ryan Roberts
2025-02-26 12:06 ` [PATCH v3 1/3] mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear() Ryan Roberts
2025-02-26 14:00 ` Alexander Gordeev [this message]
2025-02-26 12:06 ` [PATCH v3 2/3] arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes Ryan Roberts
2025-02-26 17:41 ` Catalin Marinas
2025-02-27 9:06 ` Ryan Roberts
2025-02-26 12:06 ` [PATCH v3 3/3] arm64: hugetlb: Fix flush_hugetlb_tlb_range() invalidation level Ryan Roberts
2025-02-27 18:50 ` [PATCH v3 0/3] Fixes for hugetlb on arm64 Will Deacon
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=Z78eglxQbl1+E+2z@li-008a6a4c-3549-11b2-a85c-c5cc2836eea2.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=andreas@gaisler.com \
--cc=anshuman.khandual@arm.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=david@redhat.com \
--cc=deller@gmx.de \
--cc=dev.jain@arm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=hch@infradead.org \
--cc=kernel@xen0n.name \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maddy@linux.ibm.com \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=ryan.roberts@arm.com \
--cc=stable@vger.kernel.org \
--cc=svens@linux.ibm.com \
--cc=tsbogend@alpha.franken.de \
--cc=urezki@gmail.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
/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