FAILED: patch "[PATCH] riscv: fix set_huge_pte_at() for NAPOT mappings when a swap" failed to apply to 6.5-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.5.y
git checkout FETCH_HEAD
git cherry-pick -x 1de195dd0e05d9cba43dec16f83d4ee32af94dd2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023110127-chip-surfacing-4583@gregkh' --subject-prefix 'PATCH 6.5.y' HEAD^..
Possible dependencies:
1de195dd0e05 ("riscv: fix set_huge_pte_at() for NAPOT mappings when a swap entry is set")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 1de195dd0e05d9cba43dec16f83d4ee32af94dd2 Mon Sep 17 00:00:00 2001
From: Alexandre Ghiti <[email protected]>
Date: Thu, 28 Sep 2023 17:18:46 +0200
Subject: [PATCH] riscv: fix set_huge_pte_at() for NAPOT mappings when a swap
entry is set
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.
arch/riscv/mm/hugetlbpage.c +13 -6
@@ -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); }