[Erledigt] Nvidia Legacy 340.101/340.102 und Kernel 4.10/4.11/4.12

Status
Für weitere Antworten geschlossen.

Rain_Maker

Administrator
Teammitglied
Und auf ein Neues, aber dieses Mal mit einer (halbwegs bösen) Überraschung dabei.

Neuer Kernel, altes Problem, aber man wird bei den üblichen Verdächtigen fündig.

Die Patches, die man schon seit Wochen finden konnten, waren recht "rudimentär", eine Funktion, die man eher selten braucht ("CPU Hotplugging") wurde dabei deaktiviert, dann noch ein paar Kleinigkeiten, alles kein Problem, oder?

Aber dann gab es zunächst eine -vermeintliche positive- Überraschung, NVidia hatte wenige Tage vor dem Release des 4.10er Kernels eine neue Version des 340er Legacytreibers (340.102) veröffentlicht, und man konnte zumindest hoffen, daß diese Version vielleicht ohne Patches gegen 4.10 baut, auch wenn NVidia eigentlich keine Treiber für noch nicht veröffentlichte Kernel herausbringt.

Wie zu erwarten, Pustekuchen, also einen der gefundenen Patches für 4.10 angewandt, und da gab es die böse Überraschung:

Der Treiber funktionierte nicht und die Fehlermeldung kam mir schwer bekannt vor.

Langer Rede, gar kein Sinn, NVidia hatte in den 340.102 nicht mal die Kompatibilität für 4.9 eingebaut!

*ARGH*

Dazu fällt mir nur der Meister selbst ein:

https://www.youtube.com/watch?v=iYWzMvlj2RQ

Aber wo wir gerade bei Überraschungen waren, dieses Mal findet sich ein passender Patch bei einem der "nicht so üblichen" Verdächtigen.

Code:
wget -c http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-340/nvidia-graphics-drivers-340_340.102-0ubuntu1.diff.gz
Ja, allen Ernstes bei *Buntu findet sich ein passender Patch, der im Gegensatz zu den ersten Patches für 4.10 auch keinen "dreckigen" Hack beinhaltet und eine Funktion (CPU HOTPLUG) einfach ausknipst.

Code:
zcat nvidia-graphics-drivers-340_340.102-0ubuntu1.diff.gz | patch -p1
patching file debian/copyright
patching file debian/create-uvm-dev-node
patching file debian/dkms.conf
patching file debian/dkms_nvidia.conf
patching file debian/dkms_nvidia/patches/allow_sublevel_greater_than_5.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.0.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.10.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.11.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.13.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.14.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.18.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.6.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_3.8.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_4.0.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_4.10.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_4.6.patch
patching file debian/dkms_nvidia/patches/buildfix_kernel_4.9.patch
patching file debian/dkms_nvidia/patches/make-use-of-the-new-uapi-framework.patch
patching file debian/dkms_nvidia/patches/register-VT-switch-requirements.patch
patching file debian/dkms_nvidia/patches/replace-VM_RESERVED-with-VM_DONTEXPAND-and-VM_DONTDU.patch
patching file debian/dkms_nvidia_uvm.conf
patching file debian/glamor.conf
patching file debian/headers/cl.h
patching file debian/headers/cl_gl.h
patching file debian/headers/cl_platform.h
patching file debian/headers/cuda.h
patching file debian/headers/cudaGL.h
patching file debian/headers/cudaVDPAU.h
patching file debian/headers/gl.h
patching file debian/headers/glext.h
patching file debian/headers/glx.h
patching file debian/headers/glxext.h
patching file debian/libcuda1-340.dirs
patching file debian/libcuda1-340.install
patching file debian/libcuda1-340.links
patching file debian/libcuda1-340.links32
patching file debian/libcuda1-340.shlibs
patching file debian/nvidia-340-dev.install
patching file debian/nvidia-340-dev.links
patching file debian/nvidia-340-dev.preinst
patching file debian/nvidia-340.README.Debian
patching file debian/nvidia-340.dirs
patching file debian/nvidia-340.dirs32
patching file debian/nvidia-340.docs
patching file debian/nvidia-340.grub-gfxpayload
patching file debian/nvidia-340.install
patching file debian/nvidia-340.links
patching file debian/nvidia-340.links32
patching file debian/nvidia-340.override
patching file debian/nvidia-340.postinst
patching file debian/nvidia-340.postrm
patching file debian/nvidia-340.preinst
patching file debian/nvidia-340.prerm
patching file debian/nvidia-340.shlibs
patching file debian/nvidia-libopencl1-340.dirs
patching file debian/nvidia-libopencl1-340.install
patching file debian/nvidia-libopencl1-340.links
patching file debian/nvidia-libopencl1-340.links32
patching file debian/nvidia-libopencl1-340.shlibs
patching file debian/nvidia-opencl-icd-340.dirs
patching file debian/nvidia-opencl-icd-340.install
patching file debian/nvidia-opencl-icd-340.links
patching file debian/nvidia-opencl-icd-340.links32
patching file debian/nvidia_supported
patching file debian/rules
patching file debian/start-nvidia-persistenced
patching file debian/stop-nvidia-persistenced
patching file debian/substvars
patching file debian/templates/control.in
patching file debian/templates/copyright.in
patching file debian/templates/dkms_nvidia.conf.in
patching file debian/templates/libcuda1-flavour.dirs.in
patching file debian/templates/libcuda1-flavour.install.in
patching file debian/templates/libcuda1-flavour.links.in
patching file debian/templates/libcuda1-flavour.links32.in
patching file debian/templates/libcuda1-flavour.shlibs.in
patching file debian/templates/nvidia-graphics-drivers-dev.install.in
patching file debian/templates/nvidia-graphics-drivers-dev.links.in
patching file debian/templates/nvidia-graphics-drivers-dev.preinst.in
patching file debian/templates/nvidia-graphics-drivers.README.Debian.in
patching file debian/templates/nvidia-graphics-drivers.dirs.in
patching file debian/templates/nvidia-graphics-drivers.dirs32.in
patching file debian/templates/nvidia-graphics-drivers.docs.in
patching file debian/templates/nvidia-graphics-drivers.grub-gfxpayload.in
patching file debian/templates/nvidia-graphics-drivers.install.in
patching file debian/templates/nvidia-graphics-drivers.links.in
patching file debian/templates/nvidia-graphics-drivers.links32.in
patching file debian/templates/nvidia-graphics-drivers.override.in
patching file debian/templates/nvidia-graphics-drivers.postinst.in
patching file debian/templates/nvidia-graphics-drivers.postrm.in
patching file debian/templates/nvidia-graphics-drivers.preinst.in
patching file debian/templates/nvidia-graphics-drivers.prerm.in
patching file debian/templates/nvidia-graphics-drivers.shlibs.in
patching file debian/templates/nvidia-libopencl1-flavour.dirs.in
patching file debian/templates/nvidia-libopencl1-flavour.install.in
patching file debian/templates/nvidia-libopencl1-flavour.links.in
patching file debian/templates/nvidia-libopencl1-flavour.links32.in
patching file debian/templates/nvidia-libopencl1-flavour.shlibs.in
patching file debian/templates/nvidia-opencl-icd-flavour.dirs.in
patching file debian/templates/nvidia-opencl-icd-flavour.install.in
patching file debian/templates/nvidia-opencl-icd-flavour.links.in
patching file debian/templates/nvidia-opencl-icd-flavour.links32.in
patching file debian/var-lib-snapd-lib-gl.mount
Benötigt werden die Patches

Code:
buildfix_kernel_4.9.patch
buildfix_kernel_4.10.patch
welche man nach obigem Befehl im Verzeichnis "debian/dkms_nvidia/patches/" finden kann.

Greetz,

RM
 

Rain_Maker

Administrator
Teammitglied
Kernel 4.11

Für Kernel 4.11 wird zusätzlich zu den Patches aus dem vorigen Beitrag noch dieser hier benötigt:

Code:
--- nv-drm.c.orig    2017-05-11 18:28:37.182882021 +0200
+++ nv-drm.c    2017-05-11 18:32:36.902885752 +0200
@@ -48,7 +48,11 @@
     return -ENODEV;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
 static int nv_drm_unload(
+#else
+static void nv_drm_unload(
+#endif
     struct drm_device *dev
 )
 {
@@ -60,11 +64,19 @@
         {
             BUG_ON(nvl->drm != dev);
             nvl->drm = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
             return 0;
+#else
+            return;
+#endif
         }
     }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     return -ENODEV;
+#else
+    return;
+#endif
 }
 
 static void nv_gem_free(
--- uvm/nvidia_uvm_linux.h.orig    2017-01-16 21:15:32.000000000 +0100
+++ uvm/nvidia_uvm_linux.h    2017-05-11 18:34:56.478887925 +0200
@@ -124,6 +124,9 @@
 #include <linux/delay.h>            /* mdelay, udelay                   */
 
 #include <linux/sched.h>            /* suser(), capable() replacement   */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#include <linux/sched/signal.h>
+#endif
 #include <linux/moduleparam.h>      /* module_param()                   */
 #if !defined(NV_VMWARE)
 #include <asm/tlbflush.h>           /* flush_tlb(), flush_tlb_all()     */
@@ -362,6 +365,7 @@
     void address_space_init_once(struct address_space *mapping);
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
 #if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT)
     static inline int __fatal_signal_pending(struct task_struct *p)
     {
@@ -373,6 +377,7 @@
         return signal_pending(p) && __fatal_signal_pending(p);
     }
 #endif
+#endif
 
 //
 // Before the current->cred structure was introduced, current->euid,
--- uvm/nvidia_uvm_lite.c.orig    2017-05-11 18:28:40.150882067 +0200
+++ uvm/nvidia_uvm_lite.c    2017-05-11 18:39:45.536100057 +0200
@@ -818,7 +818,11 @@
 }
 
 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
 int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+#else
+int _fault(struct vm_fault *vmf)
+#endif
 {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
     unsigned long vaddr = (unsigned long)vmf->virtual_address;
@@ -828,7 +832,11 @@
     struct page *page = NULL;
     int retval;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
     retval = _fault_common(vma, vaddr, &page, vmf->flags);
+#else
+    retval = _fault_common(NULL, vaddr, &page, vmf->flags);
+#endif
 
     vmf->page = page;
 
@@ -866,7 +874,11 @@
 // it's dealing with anonymous mapping (see handle_pte_fault).
 //
 #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
 int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+#else
+int _sigbus_fault(struct vm_fault *vmf)
+#endif
 {
     vmf->page = NULL;
     return VM_FAULT_SIGBUS;
Hier das Ganze als base64 uuencoded:

Code:
begin-base64 644 nvidia340-4.11.diff
LS0tIG52LWRybS5jLm9yaWcJMjAxNy0wNS0xMSAxODoyODozNy4xODI4ODIw
MjEgKzAyMDAKKysrIG52LWRybS5jCTIwMTctMDUtMTEgMTg6MzI6MzYuOTAy
ODg1NzUyICswMjAwCkBAIC00OCw3ICs0OCwxMSBAQAogICAgIHJldHVybiAt
RU5PREVWOwogfQogCisjaWYgTElOVVhfVkVSU0lPTl9DT0RFIDwgS0VSTkVM
X1ZFUlNJT04oNCwgMTEsIDApCiBzdGF0aWMgaW50IG52X2RybV91bmxvYWQo
CisjZWxzZQorc3RhdGljIHZvaWQgbnZfZHJtX3VubG9hZCgKKyNlbmRpZgog
ICAgIHN0cnVjdCBkcm1fZGV2aWNlICpkZXYKICkKIHsKQEAgLTYwLDExICs2
NCwxOSBAQAogICAgICAgICB7CiAgICAgICAgICAgICBCVUdfT04obnZsLT5k
cm0gIT0gZGV2KTsKICAgICAgICAgICAgIG52bC0+ZHJtID0gTlVMTDsKKyNp
ZiBMSU5VWF9WRVJTSU9OX0NPREUgPCBLRVJORUxfVkVSU0lPTig0LCAxMSwg
MCkKICAgICAgICAgICAgIHJldHVybiAwOworI2Vsc2UKKyAgICAgICAgICAg
IHJldHVybjsKKyNlbmRpZgogICAgICAgICB9CiAgICAgfQogCisjaWYgTElO
VVhfVkVSU0lPTl9DT0RFIDwgS0VSTkVMX1ZFUlNJT04oNCwgMTEsIDApCiAg
ICAgcmV0dXJuIC1FTk9ERVY7CisjZWxzZQorICAgIHJldHVybjsKKyNlbmRp
ZgogfQogCiBzdGF0aWMgdm9pZCBudl9nZW1fZnJlZSgKLS0tIHV2bS9udmlk
aWFfdXZtX2xpbnV4Lmgub3JpZwkyMDE3LTAxLTE2IDIxOjE1OjMyLjAwMDAw
MDAwMCArMDEwMAorKysgdXZtL252aWRpYV91dm1fbGludXguaAkyMDE3LTA1
LTExIDE4OjM0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QorICAgIHJldHZhbCA9IF9mYXVsdF9j
b21tb24oTlVMTCwgdmFkZHIsICZwYWdlLCB2bWYtPmZsYWdzKTsKKyNlbmRp
ZgogCiAgICAgdm1mLT5wYWdlID0gcGFnZTsKIApAQCAtODY2LDcgKzg3NCwx
MSBAQAogLy8gaXQncyBkZWFsaW5nIHdpdGggYW5vbnltb3VzIG1hcHBpbmcg
KHNlZSBoYW5kbGVfcHRlX2ZhdWx0KS4KIC8vCiAjaWYgZGVmaW5lZChOVl9W
TV9PUEVSQVRJT05TX1NUUlVDVF9IQVNfRkFVTFQpCisjaWYgTElOVVhfVkVS
U0lPTl9DT0RFIDwgS0VSTkVMX1ZFUlNJT04oNCwgMTEsIDApCiBpbnQgX3Np
Z2J1c19mYXVsdChzdHJ1Y3Qgdm1fYXJlYV9zdHJ1Y3QgKnZtYSwgc3RydWN0
IHZtX2ZhdWx0ICp2bWYpCisjZWxzZQoraW50IF9zaWdidXNfZmF1bHQoc3Ry
dWN0IHZtX2ZhdWx0ICp2bWYpCisjZW5kaWYKIHsKICAgICB2bWYtPnBhZ2Ug
PSBOVUxMOwogICAgIHJldHVybiBWTV9GQVVMVF9TSUdCVVM7Cg==
====
Wie man daraus den Patch erstellen kann, habe ich in folgendem Beitrag beschrieben

Nvidia Legacy 340.98/340.101 und Kernel 4.9

die Ausgabedatei heißt (bei richtiger Anwendung von uudecode) "nvidia340-4.11.diff".

Greetz,

RM
 

Sauerland

Member
Im Kernel 4.11.1 aus Kernel-Stable ist aber der drm Patch enthalten, muss man da trotzdem noch patchen?
Code:
rpm -q --changelog kernel-default | grep -iA5 'Mai 15 2017'
* Mo Mai 15 2017 jslaby@suse.cz
- Linux 4.11.1 (bnc#1012628 bnc#1038615).
- Delete
  patches.fixes/refcount-change-EXPORT_SYMBOL-markings.patch.
- commit c31e8e6
Code:
uname -a
Linux linux64 4.11.1-1.ga37d575-default #1 SMP PREEMPT Mon May 15 14:33:13 UTC 2017 (a37d575) x86_64 x86_64 x86_64 GNU/Linux
Dieser Patch ist momentan noch nicht im Tumbleweed Kernel enthalten.
 

Rain_Maker

Administrator
Teammitglied
Eben gegen die aktuellen Pakete aus Kernel:stable

Code:
kernel-default-devel-4.11.1-1.1.ga37d575.x86_64.rpm
kernel-devel-4.11.1-1.1.ga37d575.noarch.rpm
kernel-macros-4.11.1-1.1.ga37d575.noarch.rpm
kernel-syms-4.11.1-1.1.ga37d575.x86_64.rpm
getestet und ja, man braucht den Patch.

Wundert mich auch nicht, denn z.B. das hier

Code:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+#include <linux/sched/signal.h>
+#endif
musste ich auch bei mindestens einem anderen "out of tree" Treiber hinzufügen, damit er gegen 4.11.x baut.

Greetz,

RM
 

Rain_Maker

Administrator
Teammitglied
Mit dem Release der Treiberversion 340.104 durch NVIDIA werden die obigen Patches zumindest bis einschließlich Kernel 4.13 nicht mehr benötigt.

Deshalb

a) Licht aus

und

b) auf ein Neues im nächsten Thread zu diesem Thema, wenn der 340.104 nicht mehr gegen eine neuere Kernelversion baut.

Greetz,

RM
 
Status
Für weitere Antworten geschlossen.
Oben