Patch for compiling v384.98 modules with Linux v4.14.9+

Greetings,

There has been some kernel headers reordering in Linux v4.14.9 and this caused the modules for the NVIDIA v384.98 drivers to fail to compile for me. Here is a patch allowing to fix this issue:

diff -durN nvidia-384-orig/nvidia-uvm/uvm8_va_block.c nvidia-384/nvidia-uvm/uvm8_va_block.c
--- nvidia-384-orig/nvidia-uvm/uvm8_va_block.c	2017-12-26 11:20:17.097715622 +0100
+++ nvidia-384/nvidia-uvm/uvm8_va_block.c	2017-12-26 11:20:29.674381760 +0100
@@ -36,6 +36,10 @@
 #include "uvm8_perf_prefetch.h"
 #include "uvm8_mem.h"
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,9)
+#include <linux/sched/task_stack.h>
+#endif
+
 typedef enum
 {
     BLOCK_PTE_OP_MAP,

Same build issue, for v387.22 (short term)

...
/src/nvidia/NVIDIA-Linux-x86_64-387.22-no-compat32/kernel/nvidia-uvm/uvm8_va_block.c: In function ‘block_cpu_fault_locked’:
/usr/src/linux-4.14.9-2.g9423ca2/arch/x86/include/asm/processor.h:826:39: error: implicit declaration of function ‘task_stack_page’; did you mean ‘task_stack_vm_area’? [-Werror=implicit-function-declaration]
  unsigned long __ptr = (unsigned long)task_stack_page(task); \
...                                       ^

Fix above,

...
+#include <linux/sched/task_stack.h>
...

works for v387.22 as well.

Too much went into 4.14.9
Some was reverted before releasing 4.14.9
So far one patch is pending a revert https://lkml.org/lkml/2017/12/26/306
They need to be more strict over what goes into -stable trees.

Interesting piece of info, thank you !

Well, it is unrelated with our issue here, since that pending revert affects IPv6 networking.

I was indeed surprised that a micro release bump of the Linux kernel caused such a havoc in headers…

I guess reverting to v4.14.8 till the mess gets sorted out is the wisest approach…

[/quote]

I ran into this issue on Ubuntu 16.04 with the HWE kernels.

The patch is no more needed for current kernel (4.14.14) and driver (384.111).

16.04 only has kernel version 4.13

Ouch, 4.13 kernel sources (ubuntu 16.04) are not compatible with nvidia driver.

Even after the fix, I am getting a new error:
In file included from /var/lib/dkms/nvidia/387.26/build/common/inc/conftest.h:5:0,
                 from /var/lib/dkms/nvidia/387.26/build/common/inc/nv-linux.h:17,
                 from /var/lib/dkms/nvidia/387.26/build/nvidia/nv-gpu-numa.c:24:
/var/lib/dkms/nvidia/387.26/build/conftest/functions.h:14:2: error: #error kmem_cache_create() conftest failed!

You need to add the include file and macro for it to work. I had the same issue.