Patch "tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     tlb-hugetlb-add-more-sizes-to-tlb_remove_huge_tlb_en.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a4dee44f080005228955efde358113f71278a7ab
Author: Steve Capper <steve.capper@xxxxxxx>
Date:   Wed Mar 30 12:25:43 2022 +0100

    tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry
    
    [ Upstream commit 697a1d44af8ba0477ee729e632f4ade37999249a ]
    
    tlb_remove_huge_tlb_entry only considers PMD_SIZE and PUD_SIZE when
    updating the mmu_gather structure.
    
    Unfortunately on arm64 there are two additional huge page sizes that
    need to be covered: CONT_PTE_SIZE and CONT_PMD_SIZE. Where an end-user
    attempts to employ contiguous huge pages, a VM_BUG_ON can be experienced
    due to the fact that the tlb structure hasn't been correctly updated by
    the relevant tlb_flush_p.._range() call from tlb_remove_huge_tlb_entry.
    
    This patch adds inequality logic to the generic implementation of
    tlb_remove_huge_tlb_entry s.t. CONT_PTE_SIZE and CONT_PMD_SIZE are
    effectively covered on arm64. Also, as well as ptes, pmds and puds;
    p4ds are now considered too.
    
    Reported-by: David Hildenbrand <david@xxxxxxxxxx>
    Suggested-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx>
    Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
    Cc: Will Deacon <will@xxxxxxxxxx>
    Link: https://lore.kernel.org/linux-mm/811c5c8e-b3a2-85d2-049c-717f17c3a03a@xxxxxxxxxx/
    Signed-off-by: Steve Capper <steve.capper@xxxxxxx>
    Acked-by: David Hildenbrand <david@xxxxxxxxxx>
    Reviewed-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
    Reviewed-by: Catalin Marinas <catalin.marinas@xxxxxxx>
    Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220330112543.863-1-steve.capper@xxxxxxx
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 46294ef620ff..268674c1d568 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -547,10 +547,14 @@ static inline void tlb_flush_p4d_range(struct mmu_gather *tlb,
 #define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)	\
 	do {							\
 		unsigned long _sz = huge_page_size(h);		\
-		if (_sz == PMD_SIZE)				\
-			tlb_flush_pmd_range(tlb, address, _sz);	\
-		else if (_sz == PUD_SIZE)			\
+		if (_sz >= P4D_SIZE)				\
+			tlb_flush_p4d_range(tlb, address, _sz);	\
+		else if (_sz >= PUD_SIZE)			\
 			tlb_flush_pud_range(tlb, address, _sz);	\
+		else if (_sz >= PMD_SIZE)			\
+			tlb_flush_pmd_range(tlb, address, _sz);	\
+		else						\
+			tlb_flush_pte_range(tlb, address, _sz);	\
 		__tlb_remove_tlb_entry(tlb, ptep, address);	\
 	} while (0)
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux