__rt_mutex_init has changed to EXPORT_SYMBOL_GPL causing 337.12 to not compile on 3.14-rt

Hey nvidia, devs and user alike;

I am a linux-rt user [ as you may notice from other posts ] … as of late nVidia has been doing an excellent job of ‘unofficially’ supporting PREEMPT_RT_FULL by allowing the use of the IGNORE_PREEMPT_RT_PRESENCE=1 environment variable [plus, adding some necessary bits to the driver].

however, it seems between 3.12 and 3.14 [i never tested 3.13] that upstream linux developers have decided to change __rt_mutex_init from EXPORT_SYMBOL [which is usable for out-of-tree, non-gpl drivers] to EXPORT_SYMBOL_GPL which is NOT usable by non-gpl drivers, which obviously creates a problem - being as nvidia will no longer compile / be usable if those symbols remain EXPORT_SYMBOL_GPL :\

a quick grep reveals where it is used;

/home/ninez/Desktop/LPA/nvidia-l-pa-337/src/NVIDIA-Linux-x86_64-337.12-no-compat32/kernel/uvm/nvidia-uvm.mod.c:	{ 0x37c6a344, __VMLINUX_SYMBOL_STR(__rt_mutex_init) },
/home/ninez/Desktop/LPA/nvidia-l-pa-337/src/NVIDIA-Linux-x86_64-337.12-no-compat32/kernel/nvidia.mod.c:	{ 0x37c6a344, __VMLINUX_SYMBOL_STR(__rt_mutex_init) },

so in this case, the modules that will be expecting EXPORT_SYMBOL [or rather the kernel will be expecting gpl-only symbol]… On top of this; i have been using mutexes in nvidia.ko, as well - which has never been a problem, until the kernel developers changed these symbols recently…

of course, the easy workaround is to change nvidia’s MODULE_LICENSE=nvidia to MODULE_LICENSE=GPL, like so;

--- kernel/nv.c	2014-04-04 17:12:14.000000000 -0400
+++ kernel/nv.c	2014-04-12 16:27:06.523676294 -0400
@@ -30,7 +30,7 @@
 #if defined(MODULE_LICENSE)
 #if defined(MODULE_INFO)
 MODULE_INFO(supported, "external");
--- kernel/uvm/nvidia_uvm_common.c	2014-04-04 17:12:14.000000000 -0400
+++ kernel/uvm/nvidia_uvm_common.c	2014-04-12 16:23:07.632663969 -0400
@@ -275,5 +275,5 @@
 MODULE_INFO(supported, "external");
--- kernel/nv-frontend.c	2014-04-13 16:12:38.268038126 -0400
+++ kernel/nv-frontend.c	2014-04-13 16:23:37.891072155 -0400
@@ -15,7 +15,7 @@
 #include "nv-frontend.h"
 #if defined(MODULE_LICENSE)
 #if defined(MODULE_INFO)
 MODULE_INFO(supported, "external");

now, it is one thing to do this on my own machine - but no one/packagers can ship nvidia by changing it’s license, as well, nvidia is supposed to be a tainted module [disables lock debugging, etc]…

anyway, i am hoping someone from nvidia can talk to kernel developers on this matter, as it is a big problem for myself and others… I have went ahead and notified the linux-rt developers, who work on the relevant parts of the kernel, whom also presumably have direct interaction with the subsystems maintainer [ingo]… but aside from that - there isn’t a whole lot that i can do personally, beyond reporting to you both…


I’m still waiting to hear back from linux-rt devs, but i may hit LKML on this issue - if i don’t hear something back soon.

I should also add that there is another tactic for working around the gpl-only symbol and that is by changing the symbol in the kernel, itself - back to EXPORT_SYMBOL - although this makes the kernel GPL-incompatible / non-distributable. In my own build script for linux-rt/PREEMPT_RT_FULL, i simply;

sed -i \
's/EXPORT_SYMBOL_GPL(__rt_mutex_init);/EXPORT_SYMBOL(__rt_mutex_init);/' \

obviously “${srcdir}” is defined/used in my script, so one would require the full path if doing manually. this at least allows 337.12 to be installable, since the symbols are resolved… not ideal, but at least there are a couple of ways around the problem, until upstream linux developers [hopefully] do something about it.

Did the old rt-patch explicitly change EXPORT_SYMBOL_GPL to EXPORT_SYMBOL? __rt_mutex_init has been a GPL symbol in vanilla Linux at least as far back as 2.6.34 (http://lxr.free-electrons.com/source/kernel/rtmutex.c?v=2.6.34#L970).

An old LWN article on circumvention: http://lwn.net/Articles/154602/

This article may actually be more relevant (it’s recent, and an NVIDIA developer weighs in): http://www.ifross.org/artikel/ongoing-dispute-over-value-exportsymbolgpl-function

@Arakageeta - on linux-rt that symbol is supposed to be EXPORT_SYMBOL - so that non-gpl modules [ even some who’s licenses are supposed to be gpl-compatible ] can build correctly on -rt… Anyway, I have had the problem resolved upstream, in the last few days.