Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
remove nvidia module without reboot? [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 192
Location: Dresden

PostPosted: Fri Aug 17, 2018 2:57 pm    Post subject: remove nvidia module without reboot? [solved] Reply with quote

Hi

My normal system configuration is:
Primary Intel GPU for desktop/X11
Secondary Nividia GPU for pci-passthrough/nvenc-encoding/OpenCl tasks

Per default I boot with vfio that grabs the nvidia card just before anything else would...
Then I could just normally start qemu with the nvidia card as pci-passthrough.

After I finished my gaming session in qemu I would like to use the nvidia card for
ffmpeg encoding tasks, so I unload vfio module and do my stuff with ffmpeg.

That somehow automatically loaded all the nvidia modules.

Now if I want to start another gaming-qemu session, how can I unload all the nvidia modules
and re-enable vfio?

I tried to unload nvidia_drm/nvidia_modeset/nvidia_uvm in any combination but it simply says:
Code:
modprobe -r nvidia
modprobe: FATAL: Module nvidia_drm is in use.
modprobe: FATAL: Error running remove command for nvidia


I have no idea what else prevents the modules from unloading them...

Any ideas?
_________________
-=human without Windows®=-
sorry for my bad english!


Last edited by dasPaul on Fri Aug 17, 2018 3:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 5625
Location: Removed by Neddy

PostPosted: Fri Aug 17, 2018 3:10 pm    Post subject: Reply with quote

Either there is still an Xorg or other session still running or not all the modules are unloaded



Quote:
$ lsmod
Module Size Used by
nct6775 53248 0
hwmon_vid 16384 1 nct6775
nvidia_drm 40960 6
nvidia_modeset 1060864 15 nvidia_drm
nvidia 13549568 737 nvidia_modeset

i2c_piix4 24576 0
k10temp 16384 0
input_leds 16384 0


from my output you can see there is a dependancy to the modules but nvidia_drm is the
Code:
alias nvidia="/etc/init.d/xdm stop && rmmod nvidia_drm && rmmod nvidia_modeset && rmmod nvidia && modprobe nvidia && /etc/init.d/xdm start"

From a kernel module point of view, drm does need to be removed 1st (which you are doing).

So there must be an application still using the driver:


Code:
lsof /dev/nvidia0 | grep mem
X          3505 root  mem    CHR  195,0          1204 /dev/nvidia0
Discord    3934  Naib  mem    CHR  195,0          1204 /dev/nvidia0
steam      4948  Naib  mem    CHR  195,0          1204 /dev/nvidia0
steam      4952  Naib  mem    CHR  195,0          1204 /dev/nvidia0
steamwebh  4956  Naib  mem    CHR  195,0          1204 /dev/nvidia0
hon-x86_6 13930  Naib  mem    CHR  195,0          1204 /dev/nvidia0
hon-x86_6 13945  Naib  mem    CHR  195,0          1204 /dev/nvidia0
chrome    14154  Naib  mem    CHR  195,0          1204 /dev/nvidia0
chrome    14233  Naib  mem    CHR  195,0          1204 /dev/nvidia0

_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
dasPaul
Apprentice
Apprentice


Joined: 14 Feb 2012
Posts: 192
Location: Dresden

PostPosted: Fri Aug 17, 2018 3:29 pm    Post subject: Reply with quote

Problem solved.
I just noticed that I accidentally uncommented the modules in my "/etc/modprobe.d/blacklist.conf"

So the nvidia modules got loaded from boot by whatever (even with enabled vfio that should prevent this if my understanding is correct) and they somehow dig deeper into the system, especially nvidia_drm...

If I do now my cuda/nvenc stuff it automatically loads only "nvidia" and nvidia_uvm, no drm... and those two I can simply unload.
_________________
-=human without Windows®=-
sorry for my bad english!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum