From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C484918C034; Thu, 17 Apr 2025 18:11:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744913484; cv=none; b=kzhRWwWH1yfsRjhE+lIelCO42ickweU/AQE9bJdDex1gFaKSuVNz6dPHxgpqEy1XtNVjFVLrijsBLwEj7kALYN8Pdx6TStcjmOIHUKdagH1E+vV1rAJo34HTpKf3yeTsv8pLnLCL3YDHXyIAkn0zm+4JOVenUptxdsfiaqZdVyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744913484; c=relaxed/simple; bh=Nc32qLcjBONiRLqf7kVsTfeztvMgwpcIlHaQ9LOPOZM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ylhe0CRbULCJfHGsANYCOaiU3X5f0yDsbI46cLs7LydWC5ir3aeBPuX5FXiEyKYtiruEgLq4yWFFS1o/9eo+e4Dca+2Th9EMU3wfy8N4n3gFU7LTn3YIwOVFqoG1MBpRJUR0wByWJwnwxeodTIvcUtM5U9dA9a+0c2CP1q1RJbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Uz9444cZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Uz9444cZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4222C4CEE4; Thu, 17 Apr 2025 18:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744913484; bh=Nc32qLcjBONiRLqf7kVsTfeztvMgwpcIlHaQ9LOPOZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uz9444cZ/fAarRdnZi5BsyJSn6G/4XtrLZV3LEddCkE5MnZ2X17Jr2yKC9Vesa8Ik hZISzVb0QYl7jpjLW4sQb1Pp7Vjki5TKsgx/ZalG2M7wsi3z4m8mlf6Wp52Xy/0T/E YnUCRRoU+TX8mQZjJpFCHIflfIV7hYVYA6FXINfc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ryan Roberts , David Hildenbrand , Andreas Larsson , Juergen Gross , Borislav Betkov , Boris Ostrovsky , Catalin Marinas , Dave Hansen , "David S. Miller" , "H. Peter Anvin" , Ingo Molnar , "Matthew Wilcow (Oracle)" , Thomas Gleinxer , Andrew Morton Subject: [PATCH 6.14 354/449] sparc/mm: avoid calling arch_enter/leave_lazy_mmu() in set_ptes Date: Thu, 17 Apr 2025 19:50:42 +0200 Message-ID: <20250417175132.472710210@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175117.964400335@linuxfoundation.org> References: <20250417175117.964400335@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ryan Roberts commit eb61ad14c459b54f71f76331ca35d12fa3eb8f98 upstream. With commit 1a10a44dfc1d ("sparc64: implement the new page table range API") set_ptes was added to the sparc architecture. The implementation included calling arch_enter/leave_lazy_mmu() calls. The patch removes the usage of arch_enter/leave_lazy_mmu() since this implies nesting of lazy mmu regions which is not supported. Without this fix, lazy mmu mode is effectively disabled because we exit the mode after the first set_ptes: remap_pte_range() -> arch_enter_lazy_mmu() -> set_ptes() -> arch_enter_lazy_mmu() -> arch_leave_lazy_mmu() -> arch_leave_lazy_mmu() Powerpc suffered the same problem and fixed it in a corresponding way with commit 47b8def9358c ("powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes"). Link: https://lkml.kernel.org/r/20250303141542.3371656-5-ryan.roberts@arm.com Fixes: 1a10a44dfc1d ("sparc64: implement the new page table range API") Signed-off-by: Ryan Roberts Acked-by: David Hildenbrand Acked-by: Andreas Larsson Acked-by: Juergen Gross Cc: Borislav Betkov Cc: Boris Ostrovsky Cc: Catalin Marinas Cc: Dave Hansen Cc: David S. Miller Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Juegren Gross Cc: Matthew Wilcow (Oracle) Cc: Thomas Gleinxer Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- arch/sparc/include/asm/pgtable_64.h | 2 -- 1 file changed, 2 deletions(-) --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -936,7 +936,6 @@ static inline void __set_pte_at(struct m static inline void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte, unsigned int nr) { - arch_enter_lazy_mmu_mode(); for (;;) { __set_pte_at(mm, addr, ptep, pte, 0); if (--nr == 0) @@ -945,7 +944,6 @@ static inline void set_ptes(struct mm_st pte_val(pte) += PAGE_SIZE; addr += PAGE_SIZE; } - arch_leave_lazy_mmu_mode(); } #define set_ptes set_ptes