If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Strangest Linux Problem Ever

10-27-2009, 07:56 AM

Hello Phoronix,

I have been having the most annoying problem with Linux (particularly my 64bit Ubuntu distribution) for many years now.

It is as follows:
3D/2D accelerated OpenGL applications sometimes (but more often than not) use up all of my CPU! (screenshot from my old PC)
Yes, that is right. When I run a game or app such as xmoto, openttd, mupen64plus... It may use very little CPU (the way it's supposed to work) OR it will hog up all of the CPU.
Usually when I run such an application it will be hogging the CPU. When I close it, and reopen it, it will work fine. When I close it again and reopen it, it will be hogging the CPU again. It seems to be random.

It gets better:
I have actually bought a new graphic card (ATI now, had nvidia previously). The problem is still here.
I have bought a new motherboard. The problem persists.
I have bought a new CPU (AMD 3500+ previously, AMD X4 640 now). The problem persists.
I have bought new RAM. The problem persists.
I have wiped my /home and my OS and reinstalled it. The problem persists.

Basically I've bought a new computer (except the case, the PSU, the hard drives and the sound card) and reinstalled the OS, and I'm still getting this problem.
This leads me to believe that either I am cursed or that X is deeply broken in Ubuntu.

What do the experts of Phoronix have to say about this?
Thanks for whatever answers/help I may get!

This is normal if you don't have VSync enabled. What happens is that without VSync, the 3D application will render with hunders, even thousands of frames per second (FPS). This stresses CPU and GPU to their maximum. Even glxgears without VSync eats 90% of one core here (and runs at 5000FPS). Enabling VSync fixes the problem.

This is by no means a Linux problem. Exactly the same applies to Windows and other systems.

You can enable VSync in Catalyst Control Center if you're using the binary drivers (3D->More Settings->Wait for vertical refresh->On, unless application specifies).

If you're using the open source drivers, you might be able to enable it with the "driconf" utility.

Comment

It happens no matter what my VSync setting is. And even if it did matter, why does it sometimes happen and sometimes doesn't (using the same setting)?

And glxgears is a special case. It doesn't do any throttling (as the other games do) and will always eat up your CPU if you don't have vsync enabled.

EDIT:
Also here is more proof that you are wrong. A screenshot from my laptop, where everything works as expected (no CPU hogging): http://img193.imageshack.us/img193/4...ectnovsync.png. As you can see VSync is off.
3D/2D apps (except glxgears) should NOT use all of your CPU even if VSync is off. This has to be a Linux/X/Ubuntu bug of some sort.

Comment

What type of soundcard do you have there... If the application is having difficulty getting control of the soundcard it might manifest in the behaviour you are seeing. Try running the applications with sound dissabled.

Comment

What type of soundcard do you have there... If the application is having difficulty getting control of the soundcard it might manifest in the behaviour you are seeing. Try running the applications with sound dissabled.

Oh my... You're right.
I just took the sound card out of my computer, and the problem went away.

Well this sucks, because I paid a lot for it.
It's an Echo Gina 3G, using the driver module snd_echo3g with alsa & pulseaudio (strangely pulseaudio itself seems to work fine all the time).
I actually had to use the Medibuntu repository to install the alsa-firmware package to make it work.

Otherwise a few other things to try -
1) check the seating of the card, have a look at the contacts I had an old soundcard (audiowerks2) that was very sensitive to this as it got older.
2) talk to the alsa developers about the specifics of your soundcard.