These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

Linux

 
  • Topic is locked indefinitely.
 

Nvidia proprietary driver compile fail on kernels >4.9.x - patch.

Author
Polarbear Cuddlebunny
Viziam
Amarr Empire
#1 - 2017-02-10 19:19:43 UTC  |  Edited by: Polarbear Cuddlebunny
All,

Updated my kernel to 4.9.8-201fc25 today and found out the NVIDIA-Linux-x86_64-375.26 drivers do not compile.

Supposedly this shouldn't be a problem according to some forums, but for me it is. There is a patch available at https://devtalk.nvidia.com/default/topic/972761/linux/linux-4-9-git-rc1-375-10-build-errors/, the relevant bits are included in the code block below.

If you have "nvidia-installer" hanging at 20% when compiling, this issue is likely the cause.

There was also some bugger-up for me in the Makefile shipped with the installer ("$(RM) -r conftest" needing commenting out in ./kernel/Makefile). Everything worked fine after commenting out the mentioned line and patching the code.


  • Extract the package with: "./NVIDIA-Linux-x86_64-375.26.run -x"
  • Check the issue is the same via "cd ./NVIDIA-Linux-x86_64-375.26/kernel" and "make" (GET_USER_PAGES errors)
  • Use "make clean" to get to a decent state.
  • Put the patch below somewhere sane (e.g. /tmp/nvpatch) and apply it with: "patch -p1 < /tmp/nvpatch"
  • Run "make" to save time later.
  • Re-run the installer: "cd ../ && ./nvidia-installer -a"



If you're still finding the installer is crap, manually deploy the nvidia-drm.ko kernel module compiled in ./kernel/ and reboot.


# Issue №1
diff -Naur kernel/common/inc/nv-mm.h b/kernel/common/inc/nv-mm.h
--- kernel/common/inc/nv-mm.h    2016-10-22 13:42:48.220791689 +0300
+++ b/kernel/common/inc/nv-mm.h    2016-10-22 13:51:23.906406480 +0300
@@ -45,8 +45,8 @@
     #define NV_GET_USER_PAGES           get_user_pages
     #define NV_GET_USER_PAGES_REMOTE    get_user_pages_remote
#else
-    #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \
-        get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas)
+    #define NV_GET_USER_PAGES(start, nr_pages, gup_flags, pages, vmas) \
+        get_user_pages(current, current->mm, start, nr_pages, gup_flags, pages, vmas)

     #define NV_GET_USER_PAGES_REMOTE    get_user_pages
#endif
diff -Naur kernel/nvidia/os-mlock.c b/kernel/nvidia/os-mlock.c
--- kernel/nvidia/os-mlock.c    2016-10-22 13:42:48.222791633 +0300
+++ b/kernel/nvidia/os-mlock.c    2016-10-22 13:51:23.908406424 +0300
@@ -117,7 +117,7 @@

     down_read(&mm->mmap_sem);
     ret = NV_GET_USER_PAGES((unsigned long)address,
-                            page_count, write, force, user_pages, NULL);
+                            page_count, write ? FOLL_WRITE : 0, user_pages, NULL);
     up_read(&mm->mmap_sem);
     pinned = ret;

diff -Naur kernel/nvidia-drm/nvidia-drm-linux.c b/kernel/nvidia-drm/nvidia-drm-linux.c
--- kernel/nvidia-drm/nvidia-drm-linux.c    2016-10-22 13:42:48.243791048 +0300
+++ b/kernel/nvidia-drm/nvidia-drm-linux.c    2016-10-22 13:51:23.931405780 +0300
@@ -137,7 +137,7 @@

     down_read(&mm->mmap_sem);

-    pages_pinned = NV_GET_USER_PAGES(address, pages_count, write, force,
+    pages_pinned = NV_GET_USER_PAGES(address, pages_count, write ? FOLL_WRITE :0,
                                      user_pages, NULL);
     up_read(&mm->mmap_sem);
 
diff -Naur kernel/nvidia-uvm/uvm8_tools.c b/kernel/nvidia-uvm/uvm8_tools.c
--- kernel/nvidia-uvm/uvm8_tools.c    2016-10-22 13:42:48.251790826 +0300
+++ b/kernel/nvidia-uvm/uvm8_tools.c    2016-10-22 13:51:23.938405584 +0300
@@ -224,7 +224,7 @@
     }

     down_read(&current->mm->mmap_sem);
-    ret = NV_GET_USER_PAGES(user_va, num_pages, 1, 0, *pages, vmas);
+    ret = NV_GET_USER_PAGES(user_va, num_pages, 1 ? FOLL_WRITE : 0, *pages, vmas);
     up_read(&current->mm->mmap_sem);
     if (ret != num_pages) {
         status = NV_ERR_INVALID_ARGUMENT;

Biterno Sintaph
Reboot Required
#2 - 2017-02-21 12:53:24 UTC
If you're willing to add another repository to your dnf settings, RPM Fusion handles nVidia driver installs without the manual recompiling every kernel patch.

https://rpmfusion.org/Configuration
https://rpmfusion.org/Howto/nVidia