On 17. 10. 25, 16:53, Greg Kroah-Hartman wrote:
6.17-stable review patch. If anyone has any objections, please let me know.
From: Alexandre Ghiti alexghiti@rivosinc.com
commit 668208b161a0b679427e7d0f34c0a65fd7d23979 upstream.
Make sure we return the right pud value and not a value that could have been overwritten in between by a different core.
Link: https://lkml.kernel.org/r/20250814-dev-alex-thp_pud_xchg-v1-1-b4704dfae206@r... Fixes: c3cc2a4a3a23 ("riscv: Add support for PUD THP") Signed-off-by: Alexandre Ghiti alexghiti@rivosinc.com Cc: Andrew Donnellan ajd@linux.ibm.com Cc: stable@vger.kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
arch/riscv/include/asm/pgtable.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
--- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -959,6 +959,17 @@ static inline pud_t pudp_huge_get_and_cl return pud; } +#define __HAVE_ARCH_PUDP_HUGE_GET_AND_CLEAR +static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
unsigned long address, pud_t *pudp)
+{
- pud_t pud = __pud(atomic_long_xchg((atomic_long_t *)pudp, 0));
- page_table_check_pud_clear(mm, pud);
- return pud;
+}
With the above, I see: [ 321s] In file included from ../include/linux/pgtable.h:6, [ 321s] from ../include/linux/mm.h:31, [ 321s] from ../arch/riscv/kernel/asm-offsets.c:8: [ 321s] ../arch/riscv/include/asm/pgtable.h:963:21: error: redefinition of ‘pudp_huge_get_and_clear’ [ 321s] 963 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, [ 321s] | ^~~~~~~~~~~~~~~~~~~~~~~ [ 321s] ../arch/riscv/include/asm/pgtable.h:946:21: note: previous definition of ‘pudp_huge_get_and_clear’ with type ‘pud_t(struct mm_struct *, long unsigned int, pud_t *)’ [ 321s] 946 | static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm, [ 321s] | ^~~~~~~~~~~~~~~~~~~~~~~
thanks,