[ Sasha's backport helper bot ] Hi, Summary of potential issues: ❌ Build failures detected ⚠️ Found matching upstream commit but patch is missing proper reference to it Found matching upstream commit: 49c87f7677746f3c5bd16c81b23700bb6b88bfd4 Note: The patch differs from the upstream commit: --- 1: 49c87f7677746 ! 1: 180bfe1de8d8a arm64: hugetlb: Fix huge_ptep_get_and_clear() for non-present ptes @@ Commit message Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx> Link: https://lore.kernel.org/r/20250226120656.2400136-3-ryan.roberts@xxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> + (cherry picked from commit 49c87f7677746f3c5bd16c81b23700bb6b88bfd4) + Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx> ## arch/arm64/mm/hugetlbpage.c ## @@ arch/arm64/mm/hugetlbpage.c: static int find_num_contig(struct mm_struct *mm, unsigned long addr, @@ arch/arm64/mm/hugetlbpage.c: static pte_t get_clear_contig(struct mm_struct *mm, unsigned long pgsize, unsigned long ncontig) { -- pte_t orig_pte = __ptep_get(ptep); +- pte_t orig_pte = ptep_get(ptep); - unsigned long i; - - for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) { -- pte_t pte = __ptep_get_and_clear(mm, addr, ptep); +- pte_t pte = ptep_get_and_clear(mm, addr, ptep); - - /* - * If HW_AFDBM is enabled, then the HW could turn on @@ arch/arm64/mm/hugetlbpage.c: static pte_t get_clear_contig(struct mm_struct *mm, + pte_t pte, tmp_pte; + bool present; + -+ pte = __ptep_get_and_clear(mm, addr, ptep); ++ pte = ptep_get_and_clear(mm, addr, ptep); + present = pte_present(pte); + while (--ncontig) { + ptep++; + addr += pgsize; -+ tmp_pte = __ptep_get_and_clear(mm, addr, ptep); ++ tmp_pte = ptep_get_and_clear(mm, addr, ptep); + if (present) { + if (pte_dirty(tmp_pte)) + pte = pte_mkdirty(pte); @@ arch/arm64/mm/hugetlbpage.c: static pte_t get_clear_contig(struct mm_struct *mm, } static pte_t get_clear_contig_flush(struct mm_struct *mm, -@@ arch/arm64/mm/hugetlbpage.c: pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, +@@ arch/arm64/mm/hugetlbpage.c: pte_t huge_ptep_get_and_clear(struct mm_struct *mm, { int ncontig; size_t pgsize; -- pte_t orig_pte = __ptep_get(ptep); +- pte_t orig_pte = ptep_get(ptep); - - if (!pte_cont(orig_pte)) -- return __ptep_get_and_clear(mm, addr, ptep); +- return ptep_get_and_clear(mm, addr, ptep); - - ncontig = find_num_contig(mm, addr, ptep, &pgsize); --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Failed | Build Errors: Build error for stable/linux-6.6.y: arch/arm64/mm/hugetlbpage.c: In function 'huge_ptep_get_and_clear': arch/arm64/mm/hugetlbpage.c:404:35: error: 'sz' undeclared (first use in this function); did you mean 's8'? 404 | ncontig = num_contig_ptes(sz, &pgsize); | ^~ | s8 arch/arm64/mm/hugetlbpage.c:404:35: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [scripts/Makefile.build:243: arch/arm64/mm/hugetlbpage.o] Error 1 make[4]: Target 'arch/arm64/mm/' not remade because of errors. make[3]: *** [scripts/Makefile.build:480: arch/arm64/mm] Error 2 make[3]: Target 'arch/arm64/' not remade because of errors. make[2]: *** [scripts/Makefile.build:480: arch/arm64] Error 2 make[2]: Target './' not remade because of errors. make[1]: *** [/home/sasha/build/linus-next/Makefile:1916: .] Error 2 make[1]: Target '__all' not remade because of errors. make: *** [Makefile:234: __sub-make] Error 2 make: Target '__all' not remade because of errors.