Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Stretch] nvidia driver real time performance

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
hihu
Posts: 13
Joined: 2017-09-22 07:26

[Stretch] nvidia driver real time performance

#1 Post by hihu »

Hello everyone.

I was setting up my computer with debian stretch to use as a music workstation. But after I installed the nvidia driver I get a lot of noise, glitches and so on.
I'm using cadence in combination with jack and it works fine until I use the nvidia driver with the normal kernel (no rt). I know installing the driver with the real time kernel is another story.

What could I try to figure out why I'm getting that much xruns with the nvidia driver running? Somebody else having this problem?

Thank you very much.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: [Stretch] nvidia driver real time performance

#2 Post by stevepusser »

Could you give a hint of exactly what driver you installed and how you did it? There are are several different drivers if you include the legacy ones, and different ways of installing them, only one of which really meshes in with Debian.
MX Linux packager and developer

hihu
Posts: 13
Joined: 2017-09-22 07:26

Re: [Stretch] nvidia driver real time performance

#3 Post by hihu »

Sorry for the late reply, had notifications about this thread disabled.

First I tried my luck at linuxmusicians forum:

https://linuxmusicians.com/viewtopic.php?f=27&t=17484

First the problem started when routing pulse audio to jack (qjackctl) but I solved it by using cadence from KX repositories. After that I found out that also the nvidia driver causes trouble.

I have an Nvidia 960GTX graphic card and I was using this guide here:

https://wiki.debian.org/NvidiaGraphicsD ... ion_375.66

and installed the newest driver 375.66 with this guide. I added the repositories non-free, detected the right driver and as the graphic chip is pretty new I installed the regular driver (no legacy one).

I'm aware of the fact that the nvidia driver does not work with the low latency kernel (I would have to compile it myself) so I used the regular kernel. The difference using low latency and the normal kernel concerning xruns and stability is nearly the same.

But after I install the nvidia Kernel I get strange noise and clicks. I don't have to open an audio applications. Only browsing in firefox or hovering with the mouse over buttons results in clicks and noise. This is pretty strange.

But on the other hand using the nvidia driver is an advantage because of 3d acceleration. When I'm using the nouveau driver lot of work has to be done by the processor. So when using the audio applications I get 30% of Cpu usage added only for the graphical interface. With the nvidia driver it was a lot better (CPU usage).

So I don't know what I could try? Maybe the driver runs in higher priority than the audio interface?

Hope someone can help me out.

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1400
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 175 times

Re: [Stretch] nvidia driver real time performance

#4 Post by steve_v »

I don't know much about jack or cadence, so I have no advice on the dropouts. I use plain old ALSA, and I've never seen any latency issues at all.

As for the noise, here's my 2c:

What soundcard are you using? It's a bit of a long-shot, but this could well be a hardware issue.
Hypothesis: When running at it's full potential the GPU is injecting noise onto the pcie bus power rails, or radiating EM noise into the case. I've seen it before, many times.

If you're using an onboard / integrated sound chip, those are pretty notorious for picking up electrical noise, and generally have no EM shielding around the analogue components whatsoever.
If you're using a pci / pcie sound card, you might try moving it to the slot furthest away from the GPU, or even installing a DIY shielding can...

A quick way to test this would be to try a digital output, like SPDIF or HDMI, assuming you have something that can decode it. That should be mostly immune to noise, as it bypasses the DAC and amp circuits.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

hihu
Posts: 13
Joined: 2017-09-22 07:26

Re: [Stretch] nvidia driver real time performance

#5 Post by hihu »

Thanks for your reply.

Well I also experienced problems some years ago with my audio interface. I got a lot of interferences just by hitting keys on my keyboard :cry: . That time I was using an AMD Platform X2 4400+ processor on the Asus A8n32-Sli Mainboard with the onboard sound by VIA. This board had one of the worst shielding I ever experienced. I heard the harddrives spinning in my heaphones and also every key on the keyboard resulted in noise. Very strange.

Because of this I bought a good soundcard these days. It's a M-Audio Audiophile 192 soundcard using the envy24 bit chipset which is officially supported since kernel 3.3 I guess. But of course this card is old now and is still using the pci interface bus.

Now I'm on a newer platform still using this card. It's an Intel i7 3770k on a gigabyte Z77-UD3H mainboard. This mainboard was one of the first which lost the IDE connectivity. I read on the internet that former mainboards where emulating IDE by using an s-ata chipset and I read the same goes with Pci slots. They get somehow emulated by an Pci-Express chip.

To be honest I don't get very good values in Jack with this soundcard. I have to keep my latency settings really high compared to users of other soundcards or USB connected devices. I have to work with 256 samples sometimes even 512 samples. Other users get 128, 64 or maybe 32 samples. This could be a result of emulation?

From my experience I know that the electric noise and interferences are OS independent. When you have this problem you always have some amount of background noise which gets amplified by the input of your keyboard the spinning of the drives or using the graphic card. So the background noise changes over time when you have some activity on your pc going on.

But this time I don't have a stable background noise I only have it when I click the Gnome Menu, opening the browser. Only when I use some graphical interaction. When I do nothing everything is fine. I mean the graphic card is not working on high power it's only accelerating the desktop which is a low end task for the 960gtx I guess.

I have many os installed on the system and I don't experience problems with all of them. I tried Windows 10, OpenSUSE Leap and SteamOS (Debian 8) all running the nvidia driver and no problems at all. So I don't think it's a hardware problem. I could test the digital output but I have no equipment to record the digital stream. My soundcard uses cinch digital output.

Could it help when I somehow use the debian real time kernel and compile the nvidia driver into it? It seems not to be that easy as I need some special patches. Maybe the nvidia driver runs at higher priority than the audio system. The changing of the clock speed can cause also some trouble I heard. This especially goes for power saving features like cool and quiete or intel turbo boost. maybe it's the same with graphic cards that I have to run it always at the same mhz speed.

greetings

steve_v
df -h | grep > 20TiB
df -h | grep > 20TiB
Posts: 1400
Joined: 2012-10-06 05:31
Location: /dev/chair
Has thanked: 79 times
Been thanked: 175 times

Re: [Stretch] nvidia driver real time performance

#6 Post by steve_v »

hihu wrote:I have many os installed on the system and I don't experience problems with all of them. I tried Windows 10, OpenSUSE Leap and SteamOS (Debian 8) all running the nvidia driver and no problems at all.
Well that is strange. Do you have the same issues if you take jack etc. out of the picture and use ALSA directly?
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

hihu
Posts: 13
Joined: 2017-09-22 07:26

Re: [Stretch] nvidia driver real time performance

#7 Post by hihu »

Hello,

when I disable jack and using the nvidia driver in conjunction with pulse audio it works. Only jack with nvidia does not work.

After uninstalling the nvidia driver today I found out that the nouveau driver wasn't loaded correctly. Actually I wouldn't need the nvidia driver when there wouldn't be that large overhead using audio software. So I checked the driver acceleration.

Code: Select all

music@debian-snd:~$ glxinfo | grep render
direct rendering: Yes
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.9, 256 bits)
    GL_ARB_conditional_render_inverted, GL_ARB_conservative_depth, 
    GL_NV_conditional_render, GL_NV_depth_clamp, GL_NV_packed_depth_stencil, 
    GL_ARB_conditional_render_inverted, GL_ARB_conservative_depth, 
    GL_NV_conditional_render, GL_NV_depth_clamp, GL_NV_fog_distance, 
    GL_OES_element_index_uint, GL_OES_fbo_render_mipmap, 
This means the software renderer is running, right.

nouveau is loaded

Code: Select all

music@debian-snd:~$ lspci -nnk | grep -iA2 vga 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM206 [GeForce GTX 960] [10de:1401] (rev a1)
	Subsystem: Micro-Star International Co., Ltd. [MSI] GM206 [GeForce GTX 960] [1462:3202]
	Kernel modules: nouveau
music@debian-snd:~$ 
or this command

Code: Select all

music@debian-snd:~$ grep nouveau /var/log/Xorg.0.log
[    24.197] (==) Matched nouveau as autoconfigured driver 0
[    24.197] (II) LoadModule: "nouveau"
[    24.197] (II) Loading /usr/lib/xorg/modules/drivers/nouveau_drv.so
[    24.212] (II) Module nouveau: vendor="X.Org Foundation"
music@debian-snd:~$ 
but when I modprobe nouveau I get this dmesg output

Code: Select all

10.069661] nouveau 0000:01:00.0: bios: version 84.06.0d.00.1f
[   10.069890] nouveau 0000:01:00.0: disp: dcb 15 type 8 unknown
[   10.086659] nouveau 0000:01:00.0: firmware: failed to load nvidia/gm206/gr/sw_nonctx.bin (-2)
[   10.086666] nouveau 0000:01:00.0: Direct firmware load for nvidia/gm206/gr/sw_nonctx.bin failed with error -2
[   10.086669] nouveau 0000:01:00.0: gr: failed to load gr/sw_nonctx
[   10.086675] nouveau 0000:01:00.0: gr ctor failed, -2
[   10.086681] nouveau: probe of 0000:01:00.0 failed with error -2
So I guess the nouveau is not working properly. I mean using nouveau would also be a solution. I don't need really fast 3d speed as I don't use 3d software or games.

Maybe I explained my problem the wrong way:

1. After installing Debian Stretch, I installed jack with qjackctl and some audio related software (ardour, linux sampler,...)
2. I wanted to route pulse audio to jack, so that I was able to watch videos with the browser (pulse) while jack was running. Both connect to alsa so you can run only one on its own normally.
3. I experienced crackles strange sound and finally I found out that it has to do with the pulse --> jack configuration.
4. I removed Qjackctl control center and installed Cadence from KxStudio repositories --> Working. Was able use any pulse audio related software within jack.
5. I installed the nvidia driver with the official debian guide posted above and the noise started again but in different way (hoovering with the mouse over buttons or using menues).
6. I remove nvidia driver again, noise was gone. Remains is a huge CPU usage of the gnome-panel when using any kind of audio software. Playing only one wav track results in 30% CPU usage. Should be 3 or maybe 5 but not 30%. According to many topics on the internet: in this case install a video driver.

Conclusion

Jack + Nvidia = strange crackling noise / but good video perfomance and very low CPU usage
Jack without Nvidia = no noise / but very high CPU usage

It seems now that nouveau is also not working. Removed everything: xorg file, purged all nvidia, removed blacklist.
How do I load the driver properly in this case? There are a lot of guides for installing the nvidia driver not for removing it :(

Thank you very much

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: [Stretch] nvidia driver real time performance

#8 Post by stevepusser »

How about trying the Liquorix kernel? That's very low latency, and I have no trouble and using the Nvidia drivers (via Bumblebee on my Optimus laptop) with that kernel. The standard Debian kernel is more optimized for server throughput than for desktop audio creation.
MX Linux packager and developer

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: [Stretch] nvidia driver real time performance

#9 Post by sunrat »

There are a few things that may need tweaking to make JACK work better. Most important are to use performance CPU governor rather than ondemand, and use a kernel with PREEMPT configuration such as Liquorix as Steve mentioned, or the siduction kernel works well for me:

Code: Select all

$ uname -a
Linux siduction-brain 4.13.2-towo.1-siduction-amd64 #1 SMP PREEMPT siduction 4.13-5 (2017-09-13) x86_64 GNU/Linux
A full RT kernel is not necessary (and won't work with Nvidia drivers), but low latency is and is easier with PREEMPT.
Also important is to set the buffers/periods settings to a suitable one for your soundcard.
Run the script realTimeConfigQuickScan to highlight possible issues, although you don't need "good" for every test for a working system.
There are lots of resources to help get JACK working properly, and sometimes just one setting can make all the difference:
https://wiki.linuxaudio.org/wiki/system_configuration *probably the most comprehensive
https://thecrocoduckspond.wordpress.com ... mentation/
https://wiki.archlinux.org/index.php/JA ... ection_Kit
https://wiki.linuxaudio.org/wiki/optimize_jack *a bit dated but mostly relevant
http://libremusicproduction.com/article ... arted-jack

Seriously, the easiest way to get a working setup with JACK is to use a dedicated media distro with all the configs done already. Currently I mainly use KXStudio which works out of the box even with Nvidia drivers installed for my GTX970:
http://kxstudio.linuxaudio.org/
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

hihu
Posts: 13
Joined: 2017-09-22 07:26

Re: [Stretch] nvidia driver real time performance

#10 Post by hihu »

Hello thank you very much for your replies.

For now I'm using this kernel

https://packages.debian.org/stretch/lin ... e-rt-amd64

which has an advantage over the standard kernel regarding xruns in jack (subjective feeling).

Seems that I have removed also the nvidia firmware after removing the nvidia driver so also the nouveu wouldn't work.
After installing the firmware glxinfo test shows now 60 frames/sec according the the display refresh rate.

@ sunrat: I will execute the script when I'm at home again and check for errors in configuration.
I know installing a pure audio distribution would produce less hassle in configuring. But I don't need many of the software provided. But I added the repositories from KX studio. This is where I got Cadence from. My own configuration with qjack didn't work well but the preconfigured cadence works like a charm.

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: [Stretch] nvidia driver real time performance

#11 Post by sunrat »

RT kernel is not essential for audio and you may have better luck with the Liquorix kernel. To install Nvidia drivers you must first install the matching kernel headers package, there is a headers package in the repo for that RT kernel you have. If you followed the wiki, you should have the headers, I just mentioned it as a few people have posted here with driver install problems and turned out not to have done that.
Which firmware did you install? I don't recall ever installing any for Nvidia, or indeed if there is any available.
Anyway, sounds like it's all good for now if it's running like a charm. It may work better if you set CPU governor to performance as CPU speed switching can cause xruns.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: [Stretch] nvidia driver real time performance

#12 Post by stevepusser »

sunrat wrote:RT kernel is not essential for audio and you may have better luck with the Liquorix kernel. To install Nvidia drivers you must first install the matching kernel headers package, there is a headers package in the repo for that RT kernel you have. If you followed the wiki, you should have the headers, I just mentioned it as a few people have posted here with driver install problems and turned out not to have done that.
Which firmware did you install? I don't recall ever installing any for Nvidia, or indeed if there is any available.
Anyway, sounds like it's all good for now if it's running like a charm. It may work better if you set CPU governor to performance as CPU speed switching can cause xruns.
There is Nvidia firmware in firmware-misc-nonfree, but for what exactly...¯\_(ツ)_/¯
After installing the firmware glxinfo test shows now 60 frames/sec according the the display refresh rate.
If that were a true framerate, that would be pitiful...but it's just matching the screen refresh rate. Try this for xorg drivers such as nouveau:

Code: Select all

vblank_mode=0 glxgears
For the proprietary driver

Code: Select all

__GL_SYNC_TO_VBLANK=0 glxgears
MX Linux packager and developer

Post Reply