Nvidia opencl not working with kernel 5.9

With kernel 5.9 from unstable darktable is not able to use opencl.

1# darktable -d opencl                
0.116651 [opencl_init] opencl related configuration options:
0.116658 [opencl_init] 
0.116659 [opencl_init] opencl: 1
0.116660 [opencl_init] opencl_scheduling_profile: 'default'
0.116662 [opencl_init] opencl_library: ''
0.116665 [opencl_init] opencl_memory_requirement: 768
0.116667 [opencl_init] opencl_memory_headroom: 400
0.116670 [opencl_init] opencl_device_priority: '*/!0,*/*/*/!0,*'
0.116672 [opencl_init] opencl_mandatory_timeout: 200
0.116673 [opencl_init] opencl_size_roundup: 16
0.116674 [opencl_init] opencl_async_pixelpipe: 0
0.116675 [opencl_init] opencl_synch_cache: active module
0.116677 [opencl_init] opencl_number_event_handles: 25
0.116678 [opencl_init] opencl_micro_nap: 1000
0.116680 [opencl_init] opencl_use_pinned_memory: 0
0.116683 [opencl_init] opencl_use_cpu_devices: 0
0.116684 [opencl_init] opencl_avoid_atomics: 0
0.116685 [opencl_init] 
0.117323 [opencl_init] found opencl runtime library 'libOpenCL'
0.117337 [opencl_init] opencl library 'libOpenCL' found on your system and loaded
0.185940 [opencl_init] could not get platforms: -1001
0.185950 [opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
0.185952 [opencl_init] initial status of opencl enabled flag is OFF.

Found this:
https://www.phoronix.com/scan.php?page=news_item&px=Linux-59-Proprietary-Shim-Taint

Is this related?

EDIT:
When starting darktable with opencl I see the following messages in the journal:

nvidia_uvm: module uses symbols from proprietary module nvidia, inheriting taint.
nvidia_uvm: Unknown symbol set_cpus_allowed_ptr (err -2)
nvidia_uvm: Unknown symbol mmu_notifier_unregister (err -2)
nvidia_uvm: Unknown symbol __mmu_notifier_register (err -2)

Possibly, since all three functions are exported as GPL-only. I’m pretty sure, yes, proprietary modules cannot use GPL-only symbols, and since 5.9 the “proprietary taint” is inherited by any module that uses symbols from proprietary modules. nvidia_uvm (Dual MIT/GPL license) uses symbols from nvidia (“NVIDIA” license), thus nvidia_uvm inherits “proprietary taint” from nvidia, thus it won’t be able to use GPL-only symbols, but it tries to, therefore it fails to load.

So there isn’t a solutions for this it? We must pray nvidia won’t be dump? :unamused:

You can remove the taint inheritance part from the kernel. I’m interested in seeing what Manjaro developers do: patch the kernel or wait until Nvidia figures something out.

Reply to my post on the nvidia dev forum:

2 Likes

I created my own kernel patch to make nvidia drivers work again. The patch reverts the commit which introduced the TAINT stuff:

The patch is for kernel/module.c:

--- linux-5.9/kernel/module.c.old	2020-10-14 06:51:57.598066293 +0200
+++ linux-5.9/kernel/module.c	2020-10-14 07:58:16.504570606 +0200
@@ -1431,6 +1431,7 @@
 	return 0;
 }
 
+#if 0
 static bool inherit_taint(struct module *mod, struct module *owner)
 {
 	if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
@@ -1449,6 +1450,7 @@
 	}
 	return true;
 }
+#endif
 
 /* Resolve a symbol for this module.  I.e. if we find one, record usage. */
 static const struct kernel_symbol *resolve_symbol(struct module *mod,
@@ -1474,6 +1476,7 @@
 	if (!sym)
 		goto unlock;
 
+#if 0
 	if (license == GPL_ONLY)
 		mod->using_gplonly_symbols = true;
 
@@ -1481,6 +1484,7 @@
 		sym = NULL;
 		goto getname;
 	}
+#endif
 
 	if (!check_version(info, name, mod, crc)) {
 		sym = ERR_PTR(-EINVAL);

It works just fine!

3 Likes

You can use that for sure on your private machine, however as distribution we can’t revert such things. We have to follow upstream decisions closely, not to break any laws.

2 Likes

If this is something that can’t/doesn’t get patched upstream could you create a tutorial thread? Would help a lot of people and stop the forums getting spammed with the same issue

@philm:

Where is this point of view coming from? What you are saying is just contradicting the GPL2:
https://opensource.org/licenses/gpl-2.0.php

Let me quote it:

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

You may modify your copy or copies of the Program or any portion of it…

and so forth. The GPL2 is very clear. You have all rights to change the source and distribute it.

I am really concerned that the result of this FUD campaign is that you do not dare to patch the source code. The GPL2 is giving you all the rights to do so.

Who told you that you are not allowed to change certain parts of the source code? You are allowed to patch anything as long as the resulting source code is under GPL2 license

EDIT:

Good read about this topic: What is free software? - GNU Project - Free Software Foundation

Hi everybody,
I have same issue.
Is there any way to fix it for beginners users or I should wait for a new kernel release?
Thanks in advance

@pedro_cs the newest v455.45.01 driver works with 5.9 and 5.10.

1 Like

hi pobrn, thanks for your message
actually, this is the version i have installed, but does not work

@pedro_cs interestingly it works on my device.

#Solved#
hi everybody,
I have just installed the 5.11 kernel version and still my opencl does not work in darktable
is this normal?
in advance, thank you for your help