Success : Clang-built Nvidia 390.48 GTX GeForce 860M driver on clang-built Linux kernel 4.16

Hello,

I wanted to share my successful experience in building

Nvidia 390.48 GeForce GTX 860M  driver

with

clang version 5.0.0-3

on

Linux kernel 4.16 for Ubuntu 17.10 x86_64

which was also built using the same

clang version 5.0.0-3

, and bring these up on my system hardware. I extracted the source code from the installer

(NVIDIA-Linux-x86_64-390.48.run)

and manually built it using clang version 5.0.0-3 and manually installed into the Linux 4.16 kernel modules path.

I didn’t succeed right away - Linux kernel 4.16(to be precise, from 4.15.7 - started using clang/LLVM for building kernel since v4.15.7) had some issues when building using clang version 5.0.0-3 which I had to work upon. Nvidia 390.48(and the earlier 390.42 and 390.25 from which I started my clang/LLVM-Nvidia driver work) driver code built and worked without any moification(warnings were shown by clang version 5.0.0-3, but were ignored like I did for Linux kernel 4.16). Only change not related to clang/LLVM specific use case was, I had to make to Nvidia driver 390.48 code was to disable the logic around swiotlb(in common/inc/nv-linux.h : nv_dma_maps_swiotlb()) as some of the symbols associated with swiotlb have been reportedly hidden(not exported : Patchwork [11/22] swiotlb: remove various exports : https://patchwork.kernel.org/patch/10154413/) in the recent Linux kernel 4.16 release.

Here’s my complete report in relevant communities :

  1. UbuntuForums : https://ubuntuforums.org/showthread.php?t=2386423
  2. Quora(Actual place from where I started my research on clang/LLVM-kernel-and-kerne-modules) : https://www.quora.com/What-is-the-state-of-the-art-of-compiling-the-Linux-Kernel-using-LLVM-Clang/answer/Raghavan-Santhanam

Here are the specifics of the latest clang-built Nvidia 390.48 GeForce GTX 860M driver on clang-built Linux kernel 4.16 :

NOTE : Working snapshot attached(Nvidia 390.48 driver - clang-LLVM on clang-built Linux kernel 4.16(latest stable) - last.png) - shows nvidia-settings confirming Nvidia graphics card’s 100% utilization with glxgears running alongside.

exp@exp:~$ nvidia-smi 
Sat Apr  7 22:39:42 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48                 Driver Version: 390.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 860M    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   52C    P8    N/A /  N/A |    749MiB /  4046MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

exp@exp:~$ 
exp@exp:~$ ~/nvidia-driver-compiler.sh 
++ head -1
+++ uname -r
++ eclang /lib/modules/4.16.0/kernel/drivers/video/nvidia.ko
+++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
++ head -1
+++ uname -r
++ eclang /lib/modules/4.16.0/kernel/drivers/video/nvidia-drm.ko
+++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-drm.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
++ head -1
+++ uname -r
++ eclang /lib/modules/4.16.0/kernel/drivers/video/nvidia-modeset.ko
+++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-modeset.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
++ head -1
+++ uname -r
++ eclang /lib/modules/4.16.0/kernel/drivers/video/nvidia-uvm.ko
+++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-uvm.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
exp@exp:~$ 
exp@exp:~$

exp@exp:~$ 
exp@exp:~$ ~/nvidia_driver_modules_version.sh 
++ grep '^version='
+++ uname -r
++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia.ko
version=390.48
++ grep '^version='
+++ uname -r
++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-drm.ko
version=390.48
++ grep '^version='
+++ uname -r
++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-uvm.ko
++ grep '^version='
+++ uname -r
++ strings -a /lib/modules/4.16.0/kernel/drivers/video/nvidia-modeset.ko
version=390.48
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ cat /proc/version 
Linux version 4.16.0 (exp@exp) (clang version 5.0.0-3 (tags/RELEASE_500/final)) #4 SMP Thu Apr 5 02:12:22 PDT 2018
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ eclang /lib/modules/4.16.0/build/vmlinux | head -1
++ strings -a /lib/modules/4.16.0/build/vmlinux
++ grep 'clang version'
Linux version 4.16.0 (exp@exp) (clang version 5.0.0-3 (tags/RELEASE_500/final)) #4 SMP Thu Apr 5 02:12:22 PDT 2018
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 17.10
Release:	17.10
Codename:	artful
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ lsmod | grep nvidia
nvidia_uvm            811008  0 
nvidia_drm             49152  2 
nvidia_modeset       1105920  6 nvidia_drm
nvidia              14368768  477 nvidia_uvm,nvidia_modeset
ipmi_msghandler        61440  2 nvidia,ipmi_devintf
drm_kms_helper        188416  2 nvidia_drm,i915
drm                   454656  6 nvidia_drm,i915,drm_kms_helper
exp@exp:~$ 
exp@exp:~$

exp@exp:~$ 
exp@exp:~$ glxinfo | grep NVIDIA
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL core profile version string: 4.5.0 NVIDIA 390.48
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL version
 string: 4.6.0 NVIDIA 390.48
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 390.48
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ sudo dmidecode -t system | grep "Manufacturer:\|Version:"
	Manufacturer: LENOVO
	Version: Lenovo Y50-70 Touch
exp@exp:~$ 
exp@exp:~$ 

exp@exp:~$ 
exp@exp:~$ lspci | grep NVIDIA
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 860M] (rev a2)
exp@exp:~$ 
exp@exp:~$

Cheers,
Raghavan

To forum moderators and admins: The above impostor with the username (thelukester) going by the name Luke Benes and email is a spammer and scammer spreading negativity with his garbage talk and trying to devalue my above research work. He needs to be blocked and banned immediately. He is frustrated to the core since he wasn’t able to steal my research work from me. He has sent me couple of emails with that name and email id talking all the nonsense about my above research work. And this guy’s frustration and insecurity are at the peak, since this guy has gone to all of my other published places and has commented negatively about my above research work in the same exact manner. This guy has no idea about my research work but still out of frustration, stupidity and idiocy, he is talking negative about my LinkedIn, resume, etc. So, I am reporting the above impostor/scammer/spammer to be immediately banned and blocked from this forum and his above comment to be deleted.

Cheers

To forum moderators and admins:

Thanks for taking the quick right action to ban him. He needs to be banned from GeForce forum as well where he has spammed in the same manner over here(https://forums.geforce.com/default/topic/1039280/geforce-drivers/success-clang-built-nvidia-390-25-gtx-geforce-860m-driver-on-clang-built-linux-kernel-4-15-7/post/5972383/#5972383) with another fake profile having the username(slacka123).

Thanks,
Raghavan