[patches] 378.13 - 4.10 and 4.11-rc5

Update: 381.09 released, this post will no longer be updated with anything that might happen after rc5.

Will try to keep this updated with current git master of linuses tree, here is the newest patch (thanks to @albertomilone / Ubuntu for publishing propper fix for CPU_HOTPLUG on 4.10

vanilla 4.10 patch

patch -p1 <<< $('curl https://gist.githubusercontent.com/tpruzina/c4d9c0ca6bdbb6e78ab2126a7cdf8f1c/raw/38ccd3224f3205e45982c0c217e23d04f9681b49/gistfile1.txt')

4.11-rc2 patch

WARNING, DUE TO GPL-only exported symbols being in use after upstream changes, this patch relicenses NVIDIAs module as a quick and dirty workaround. You definitely shouldn’t use this outside personal use (for testing).

https://gist.github.com/tpruzina/ae0390e16c3404af2e1667778f5af780

patch -p1 <<< $(curl 'https://gist.githubusercontent.com/tpruzina/ae0390e16c3404af2e1667778f5af780/raw/53250f0c93d0586e7b028f724cfdf0c72812db1a/gistfile1.txt')

Offending patches discussed here:
https://patchwork.kernel.org/patch/9429407/, marked as 10383aea2f445bce9b2a2b308def08134b438c8e in upstream git.

NVIDIA is ‘on it’ and it seems that they will have their own fix up soon, discussion is on LKML.
https://lkml.org/lkml/2017/3/8/126

Hello there,
Is there any patch for 340.102 legacy driver for the kernel 4.10?

I don’t believe there is (yet), at least quick google search didn’t return anything.
I keep latest beta drivers up to date with latest kernels for my personal use only and I don’t do legacy drivers unfurtunatedly. I’m sure that once 4.10 is included in ubuntu/fedora, they will have propper patches for it.
I just share what I have here with rest of the folks.

kernel 4.10 suport - nvidia
340: https://pkgs.rpmfusion.org/cgit/nonfree/nvidia-340xx-kmod.git/plain/4.10.0_kernel.patch
304: https://pkgs.rpmfusion.org/cgit/nonfree/nvidia-304xx-kmod.git/plain/kernel_4.10.patch
378: https://pkgs.rpmfusion.org/cgit/nonfree/nvidia-kmod.git/plain/kernel_4.10.patch

Hi, I’ve been trying to patch the nvidia-installer all evening, and was led here after furious googling. When I attempt to patch using the above link I get the following error:

patch: **** Only garbage was found in the patch input.

I’m probably doing something wrong, but this is my first attempt at compiling.
I used following commands:

sh NVIDIA-Linux-x86_64-378.13.run --extract-only
cd NVIDIA-Linux-x86_64-378.13
patch -p1 <<< $(curl https://gist.githubusercontent.com/tpruzina/4a4aef53b266aa04606385b92ca6d042/raw/d3fabe741c9d9babab20fee294c00f1be6482ba8/gistfile1.txt) ./nvidia-installer

Anything jump out at anyone? Again, I don’t actually know what I’m doing, I’m just repeating stuff found on google that I don’t understand…

@Halpm: is that “./nvidia-installer” appended to that patch line or just typo?

Also, if you don’t have curl installed (and built with ssl support), it wont download the patch, but alternatively just download the file manually and use “patch -p1 < file.patch” in extracted folder.

I don’t see anything else “wrong” with what you are doing per se.

Thank you, it worked.

I applied

patch -p1 <<< $(curl ‘https://gist.githubusercontent.com/tpruzina/ae0390e16c3404af2e1667778f5af780/raw/084e398576640ead019e914fa7c8e2d57bc6811f/gistfile1.txt’)

But Intall of Driver 378.13 failed.

[…]
/tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia/ibmnpu_linux.o
ld -r -o /tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia-modeset/nv-modeset-interface.o /tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia-modeset/nvidia-modeset-linux.o
LD [M] /tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia.o
LD [M] /tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia-modeset.o
LD [M] /tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel/nvidia-drm.o
make[3]: Target ‘__build’ not remade because of errors.
/home/masaru/Kernel/linux-4.11-rc1/Makefile:1492: recipe for target ‘module/tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel’ failed
make[2]: *** [module/tmp/selfgz8209/NVIDIA-Linux-x86_64-378.13-custom/kernel] Error 2
make[2]: Target ‘modules’ not remade because of errors.
make[2]: Leaving directory ‘/home/masaru/Kernel/linux-4.11-rc1’
Makefile:152: recipe for target ‘sub-make’ failed
make[1]: *** [sub-make] Error 2
make[1]: Target ‘modules’ not remade because of errors.
make[1]: Leaving directory ‘/home/masaru/Kernel/linux-4.11-rc1’
Makefile:81: recipe for target ‘modules’ failed
make: *** [modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Any Hint?

Thanks,

Should be fixed in updated comment.

Dear all,
are there any patches against the long-term release 375.39 which is the current one in Debian? I am trying to use the 3.78 patches, but besides trying to patch non-existing files (nvidia-uvm/uvm8_gpu_isr.c) and lots of failing hunks it doesn’t work.

Since the 375.39 are already running on 4.10 in Debian without any problem (patches already included), I tried to only change the MODULE_LICENSE stuff, but that gave me another problem during compilation, which I fixed using the information from the 378 patch.

But finally I got stuck in compiling nvidia-uvm/uvm8.c where errors about initialization from incompatible pointer type are thrown ( .fault = uvm_vm_fault_sigbus etc etc).

Any suggestions?

Thanks

./NVIDIA-Linux-x86_64-340.102.run --apply-patch 4.10.0_kernel.patch 
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 340.102.................................................................................................................................................................................................................................
can't find file to patch at input line 16
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 983a2ca221a371e08bb5ad11758a729cfa5aa88c Mon Sep 17 00:00:00 2001
|From: Alberto Milone <alberto.milone@canonical.com>
|Date: Wed, 15 Feb 2017 17:05:55 +0100                                       
|Subject: [PATCH 1/1] Add support for Linux 4.10                             
|                                                                            
|---                                                                         
| nv-linux.h            |  7 +++++++                                         
| nv-pat.c              | 40 ++++++++++++++++++++++++++++++++++++++++        
| uvm/nvidia_uvm_lite.c |  4 ++++                                            
| 3 files changed, 51 insertions(+)                                          
|
|diff --git a/kernel/nv-linux.h b/kernel/nv-linux.h
|index e7068e3..2d62492 100644
|--- a/kernel/nv-linux.h
|+++ b/kernel/nv-linux.h
--------------------------
File to patch:

@icomputo Erm, that’s 340.102 driver, not 378.13.

@Norbu Unless you need UVM for cuda, you can simply try to skip building uvm modules like this:
cd NVIDIA-Linux-x86_64-375.39/kernel
make NV_EXCLUDE_KERNEL_MODULES=nvidia-uvm

You could also modify Makefile in ./kernel directory so that it doesn’t build UVM (which is only really required for CUDA) to workaround this. Afterwards, only nvidia.ko, nvidia-drm.ko and nvidia-modesetting.ko will be built.

I only keep my patches up to date with most recent drivers and most recent git master, sorry.
Fix is likely very trivial but I honestly don’t have time fix every driver, I just fix it for myself and share it here in hope that it’s useful for people who like to stay on bleeding edge with latest drivers&kernels like I do.

Wish I had found this before I spent the time figuring it out myself! Thanks for posting and the LKML link.

I guess this upcoming 4.11 breakage is going to be tough to sort out.

From reading LKML it’s my understanding that they are just gonna relicense the module to dual MIT/GPL and fix it in similar manner to what I did. Can’t but to wonder if the fact that they are consulting their lawyers haven’t delayed fairly stable release cycle (one release each month).

Thanks for the hint. Unfortunately I need CUDA for some machine learning applications, so I will wait until the drivers (either upstream or on the Debian side) are updated.

Thanks for your work!

Norbert

patch is crude, kref thingy introduced clean kref_read() call so that ref->ref.refs style derefenece isn’t needed.

#ifndef KREF_INIT
static inline unsigned int kref_read(const struct kref *kref)
{
	return atomic_read(&kref->refcount);
}
+#endif

It’s backwards compatible and doesn’t even end up needing versioning.

might rebase the whole thing later but eh.

Hi

So I just updated to 4.10.8-200 fc25 kernel on fedora 25 and also failed to bootup after and found this page

I also had the problem trying to run the curl to get the patch so I downloaded the patch directly from the URL gistfile1.txt

I extracted the 3.78.13 drivers and cd into that dir and run patch -p1 gistfile1.txt and nothing happens

It just sits on a flashing cursor and left it for over an hour and didnt finish or come back with any error or success message… How long is the patch supposed to take it seems it is not working or doing anything?

Thanks

You 99% forgot the “<”, patch expects input on stdin, not via commandline argument. rtfm.

Hello Friends:

Just a helpful note:

On Fedora-25 running Kernel-4.10.9-200 and nVidia driver version 378-13, I ran into the same problem as others on here.

When I applied the following patch (which is NOT the “vanilla” patch mentioned at the beginning of this topic), it failed:

https://gist.githubusercontent.com/tpruzina/4a4aef53b266aa04606385b92ca6d042/raw/d3fabe741c9d9babab20fee294c00f1be6482ba8/gistfile1.txt

However, when I tried the “vanilla” patch (mentioned at the beginning) shown next, this did work:

https://gist.githubusercontent.com/tpruzina/c4d9c0ca6bdbb6e78ab2126a7cdf8f1c/raw/38ccd3224f3205e45982c0c217e23d04f9681b49/gistfile1.txt

This may help someone. =:) I hope it does.