Re: [PATCH] mm: Give kmap_lock before call flush_tlb_kernel_rang,avoid kmap_high deadlock.

From: Matthew Wilcox
Date: Tue Jul 09 2024 - 07:56:37 EST


On Tue, Jul 09, 2024 at 05:17:38PM +0800, zhangchun wrote:
> +++ b/mm/highmem.c
> @@ -220,8 +220,11 @@ static void flush_all_zero_pkmaps(void)
> set_page_address(page, NULL);
> need_flush = 1;
> }
> - if (need_flush)
> + if (need_flush) {
> + spin_unlock(&kmap_lock);

should this be a raw spin_unlock(), or should it be unlock_kmap()?
ie when ARCH_NEEDS_KMAP_HIGH_GET is set, do we also need to re-enable
interrupts here?

> flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP));
> + spin_lock(&kmap_lock);
> + }
> }
>
> void __kmap_flush_unused(void)
> --
> 1.8.3.1
>
>