From 0d07f6d0ed9e7fe68ddfe44c282a3b54bb8ffe98 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Fri, 18 Dec 2020 05:27:41 -0500 Subject: [PATCH] drm/amdkfd: Work around mmu_notifier_put issue on RHEL 8.3 The DRM backport from kernel 5.6 includes some MMU notifier changes that cause problems with the mmu_notifier_put function. The free_notifier never gets called. This leads to a leak of kfd_process structures and their doorbells. Work around this by falling back to the old method of releasing the MMU notifier and destryoing the process structure. Change-Id: I711a61efee2b284e385251b7f826e228e64c04f2 Signed-off-by: Felix Kuehling Acked-by: Oak Zeng Reviewed-by: Flora Cui --- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 6ca61b573e6a1..1fd7409a97bc7 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h @@ -864,6 +864,11 @@ struct kfd_process { /* We want to receive a notification when the mm_struct is destroyed */ struct mmu_notifier mmu_notifier; +#if defined(DRM_VER) && defined(DRM_PATCH) && DRM_VER == 5 && DRM_PATCH == 6 \ + && LINUX_VERSION_CODE == KERNEL_VERSION(4, 18, 0) + /* mmu_notifier_put in the RH DRM backport from 5.6 is broken */ +# undef HAVE_MMU_NOTIFIER_PUT +#endif #ifndef HAVE_MMU_NOTIFIER_PUT /* Use for delayed freeing of kfd_process structure */ struct rcu_head rcu;