From 8f4b41231a06095344d283be46f6cc13a49e77e0 Mon Sep 17 00:00:00 2001 From: Bitan Biswas Date: Wed, 17 Jun 2020 10:51:49 -0700 Subject: [PATCH] gpu: nvgpu: replace mmap_sem in K5.8 K5.8 onwards, use mmap_lock field instead of mmap_sem in struct mm_struct bug 200617764 Change-Id: I7655cde105e70e29de9d8047a51569890a1a8019 Signed-off-by: Bitan Biswas Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2362505 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index d131f9b71..9021b28b9 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -2115,7 +2115,11 @@ static void alter_usermode_mapping(struct gk20a *g, return; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) + down_write(&vma->vm_mm->mmap_lock); +#else down_write(&vma->vm_mm->mmap_sem); +#endif /* * This is a no-op for the below cases @@ -2149,7 +2153,11 @@ static void alter_usermode_mapping(struct gk20a *g, } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) + up_write(&vma->vm_mm->mmap_lock); +#else up_write(&vma->vm_mm->mmap_sem); +#endif } static void alter_usermode_mappings(struct gk20a *g, bool poweroff)