On Thu, Jul 20, 2023 at 06:39:27PM +1000, Alistair Popple wrote: > There are two main use cases for mmu notifiers. One is by KVM which > uses mmu_notifier_invalidate_range_start()/end() to manage a software > TLB. > > The other is to manage hardware TLBs which need to use the > invalidate_range() callback because HW can establish new TLB entries > at any time. Hence using start/end() can lead to memory corruption as > these callbacks happen too soon/late during page unmap. > > mmu notifier users should therefore either use the start()/end() > callbacks or the invalidate_range() callbacks. To make this usage > clearer rename the invalidate_range() callback to > arch_invalidate_secondary_tlbs() and update documention. > > Signed-off-by: Alistair Popple <apopple@xxxxxxxxxx> > Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > arch/arm64/include/asm/tlbflush.h | 6 +- > arch/powerpc/mm/book3s64/radix_hugetlbpage.c | 2 +- > arch/powerpc/mm/book3s64/radix_tlb.c | 10 ++-- > arch/x86/include/asm/tlbflush.h | 2 +- > arch/x86/mm/tlb.c | 2 +- > drivers/iommu/amd/iommu_v2.c | 10 ++-- > drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 13 ++--- > drivers/iommu/intel/svm.c | 8 +-- > drivers/misc/ocxl/link.c | 8 +-- > include/linux/mmu_notifier.h | 48 +++++++++--------- > mm/huge_memory.c | 4 +- > mm/hugetlb.c | 7 +-- > mm/mmu_notifier.c | 20 ++++++-- > 13 files changed, 76 insertions(+), 64 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason