# [SOLVED] System freeze with kernel-3.6.x with DRI2/OpenGL

## Yamakuzure

[SOLVED]

The solution was to upgrade to kwin 4.9.3.

--- Original post below ---

Hi everybody,

--------

Update: It seems not any of the u* or *kit packages freeze the system, but kwin using OpenGL. Even OpenBox just froze while xscreensaver showed an OpenGL screensaver. (More below in the fourth post.)

--------

I have a problem using gentoo-sources-3.6.4 (tried with 3.6.2 before) and starting razor-qt or kde. OpenBox works fine, though, so I can work.

Unfortunately I have no idea how to gather the information needed to track the issue down, and further I have made so many changes and tests to the kernel configs for both 3.5.* and 3.6.* that I do not know what I changed where and when any more.

Pappy McFae once posted in his kernel seeds thread, that he keeps backups of all configs ever tried. I really should start taking a leaf out of his book.

However, I have spend a lot of my time for the last two weeks to find out what is going on, but I am still completely at sea.With kernel 3.5.x My system (razorqt or kde) became unusable within seconds. High cpuload everywhere with conky showing CPU Percentages above 300% per task.

Although I did find the information that the load calculation inside the kernel has been drastically changed, the system became unresponsive like mad. Example: Hitting PgDn in a browser or text editor needed 2-10 Seconds to complete the scrolling.With kernel 3.6.x My system froze right after the desktop showed up in razorqt or right before the kde desktop would have shown up.I then upgraded to linux-headers-3.6 and re-emerged everything either depending on linux-headers or having the linux_kernel USE-flag.After a reboot using kernel-3.4.11, the system was as unresponsive as described with the 3.5 kernel above.Booting into 3.5.7 showed normal system now. When razorqt/kde started, bot had high cpu load on many processes for half a minute, but then everything calmed down to a normal state.

So that's definitely an improvement! *yay*With kernel 3.6.4 the freeze is still there. No improvement. Although OpenBox works like a charm.The really bad thing is, I can only suspect udisks to be the culprit, but have no idea how to check/debug. /var/log/messages show only this: (From Hitting enter in kdm after entering my password up to the freeze) */var/log/messages wrote:*   

> Nov  2 08:28:22 sed-notebook acpid: client connected from 2783[0:0]
> 
> Nov  2 08:28:22 sed-notebook acpid: 1 client rule loaded
> 
> Nov  2 08:28:25 sed-notebook kdm: :0[2989]: pam_unix(kde:session): session opened for user sed by (uid=0)
> ...

 And this last activation of udisks service is always the last line prior a freeze.

Now here is the list of packages used:

```
sed-notebook ~ # eix -c udisk -o udev -o upower -o dbus -o xorg-server -o openrc -o baselayout -I

[I] dev-libs/dbus-glib (0.100@15.07.2012): D-Bus bindings for glib

[I] dev-libs/libdbusmenu-qt (0.9.2@15.07.2012): A library providing Qt implementation of DBusMenu specification

[I] dev-python/dbus-python (1.1.1@15.07.2012): Python bindings for the D-Bus messagebus

[I] dev-python/pyudev (0.16.1@30.10.2012): Python binding to libudev

[I] dev-util/gdbus-codegen (2.32.4@02.10.2012): GDBus code and documentation generator

[I] sys-apps/baselayout (2.2@01.11.2012): Filesystem baselayout and init scripts

[I] sys-apps/dbus (1.6.8@01.11.2012): A message bus system, a simple way for applications to talk to each other

[I] sys-apps/openrc (0.11.2@01.11.2012): OpenRC manages the services, startup and shutdown of a host

[I] sys-fs/udev (195@30.10.2012): Linux dynamic and persistent device naming support (aka userspace devfs)

[I] sys-fs/udev-init-scripts (17-r1@30.10.2012): udev startup scripts for openrc

[I] sys-fs/udisks (1.0.4-r3@01.11.2012 2.0.0(2)@01.11.2012): Daemon providing interfaces to work with storage devices

[I] sys-power/upower (0.9.18@01.11.2012): D-Bus abstraction for enumerating power devices and querying history and statistics

[I] x11-base/xorg-server (1.13.0@18.09.2012): X.Org X servers

[I] x11-libs/qt-dbus (4.8.3(4)@20.09.2012): The DBus module for the Qt toolkit
```

My kernel config at pastebin: http://pastebin.com/g3nf5E4j

The dmesg output at pastebin: http://pastebin.com/js6SzkCi

Does anybody have any idea where to look to fix this?

What I've done so far:Upgraded BIOSTried different SchedulersTried with and without NUMA optionsTried different Timer settingsDecompiled my system BIOS DSDT, recompiled after fixing various issues, added custom dsdt header to kernel config.Even tried different versions of the u* packages with loads of rebuilding depending packages afterwards. (Like kdelibs. *gee*).

Any ideas anybody?

And what troubles me most: According to various search engines (including google) I am either too stupid to find the right search keywords, or I am the only f*cking idiot on this planet with these problems.

----------

## Yamakuzure

A little update: My system just froze from within OpenBox running kernel-3.6.4. And to make the matter just more stunning: /var/log/messages shows absolutely no sign that anything was done beforehand. Just xscreensaver was running. *sigh*

----------

## Yamakuzure

In the meantime I have upgraded to gentoo-sources-3.6.5 and geek-sources-3.6.5 (from init6 overlay with TuxOnIce, CK, BFQ and UKSM patch sets).

The latter lets me get beyond udisks service and freezes on polkit. What the hell is going on? */var/log/messages wrote:*   

> Nov  2 19:54:32 sed-notebook kdm: :0[2879]: pam_unix(kde:session): session opened for user sed by (uid=0)
> 
> Nov  2 19:54:38 sed-notebook dbus[2280]: [system] Activating service name='org.freedesktop.UPower' (using servicehelper)
> 
> Nov  2 19:54:38 sed-notebook dbus[2280]: [system] Successfully activated service 'org.freedesktop.UPower'
> ...

 

----------

## Yamakuzure

I think I can start narrowing the problem down.

OpenBox just froze with nothing but an emerge process in a terminal window and xscreensaver running an OpenGL screensaver.

There is nothing in the logs, but I started "xscreensaver-command -prefs" to disable all the OpenGL screensavers, and this is what showed up on the console:

```
sed@sed-notebook ~ $ xscreensaver-command -prefs

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)

  Major opcode of failed request:  151 (DRI2)

  Minor opcode of failed request:  8 (DRI2SwapBuffers           )

  Resource id in failed request:  0x2600710

  Serial number of failed request:  652

  Current serial number in output stream:  652

(... three more errors like that and a final: )

X Error of failed request:  BadDrawable (invalid Pixmap or Window parameter)

  Major opcode of failed request:  151 (DRI2)

  Minor opcode of failed request:  8 (DRI2SwapBuffers           )

  Resource id in failed request:  0x2603309

  Serial number of failed request:  206

  Current serial number in output stream:  206
```

Google doesn't show anything directly interesting, but I'll keep digging.

----------

## Yamakuzure

I do not know whether the issue is solved now or not. But currently I am running KDE with kwin using OpenGL and no freeze so far.

I have updated mesa to 8.1_rc1_pre20120814 and am using geek-sources-3.6.5 from init6 overlay now. If there is no freeze today this issue might be solved.

----------

## Tolstoi

Hi Yamakuzure,

I think I have the same problem as you have which I have described here: https://forums.gentoo.org/viewtopic-t-941118.html .

Maybe I'll try to reproduce your steps.

----------

## Yamakuzure

Well, the last step didn't bring a solution. About 3 seconds after the post was sent, the system froze again.

So what I basically did afterwards, is to disable all USE-Flags related to Gallium3D (i965 isn't available anyway), GLES1, GLES2, OpenVG (was an experiment, not needed), EGL and rebuild everything related. Then I changed the driver section in my /etc/X11/xorg.conf from

```
        Option     "AccelMethod" "SNA"
```

to

```
        Option     "AccelMethod" "GLAMOR"
```

 - this needs the use flags "glamor" and "uxa" set for x11-drivers/xf86-video-intel.

Now everything (mesa, qt4, kwin) are back to plain old "OpenGL" again, although EGL/GLES worked perfectly for months. But maybe those freezes are gone, now?

Next I'll reactivate "SNA" acceleration, I doubt it was the culprit.

UPDATE: No, this did _NOT_ help, the system froze while I was reading your thread, Tolstoi. So I have deactivated OpenGL for kwin now, and switched RazorQT from kwin to openbox.

Something somewhere is seriously wrong. But no log anywhere shows any hint.

But: I have started TWM just to start the SampleBrowser from Ogre3D, and I can watch any Example I want without a freeze. This means that kwin and xscreensaver are freezing when they use OpenGL, but other OpenGL applications work.

I'll try a longer Demo in full screen mode next, maybe it is a full-screen issue.

It seems like I am in no way anywhere near the solution of the problem...

----------

## Tolstoi

Yes, at the moment it seems as if there is no solution. And no real hints where to begin.

----------

## Yamakuzure

At least I did some more testing:KDE works solid with no freezes when switching to XRender for the Desktop Effects.The same with RazorQT using OpenBox instead of kwin.Ogre3D Full Screen demos cause no freezeNother did a 15 minutes run of Fireworx OpenGL screensaver.I have one last idea I'll try next:

Switch back to OpenGL in kwin but disable Version 2 Shaders.

----------

## Yamakuzure

No, the last experiment caused an instant freeze of the system. Something is very very wrong here, but at least I nailed down the problem. I have changed back to XRender.

Hmm... There is an option "OpenGLIsUnsafe", I'd like to know whether I can switch back to OpenGL using systemsettings with any difference...

In the meantime I am using RazorQT with OpenBox as Window Manager. I have put "xcompmgr -cC -t-5 -l-7 -r7 -fF" in its autostart, and the effect is quite nice.

----------

## Yamakuzure

 *Tolstoi wrote:*   

> Yes, at the moment it seems as if there is no solution. And no real hints where to begin.

 Now that I could adapt my keywords for an internet search, I found this bug: (lengthy read!) https://bugs.freedesktop.org/show_bug.cgi?id=55998. Although the initial report is something different, several comments report issues with some likenesses to what you and I report here. (Like the tearing, artifacts, garbled output and my freezes.)

----------

## Yamakuzure

I can't believe that it took almost three weeks for me to remember the Magic SysRq Key. *sigh* All those hard power-downs when getting into a console was one Alt+SysRq+r away. So lets reactivate OpenGL in kwin and see whether SysRq still works.

I'll edit the results into this post later.

----------

## Tolstoi

Ahh, I can't believe it. I disabled that recently and that is probably about the time my problems started. I'll check that out as soon as I'm home from work.

----------

## Yamakuzure

I hope it helps you, the freeze on my system blocks the keyboard. I have tested SysRq on a running system and it works, but when the freeze occurs I can't reach the kernel any more.

So I'll have to wait until next monday, I'll SSH into my laptop, maybe a remote session can bring some light upon this.

The kernel *is* working when X freezes. I can tell because the CPU fan spins up after some seconds. So there must be CPU activity, right?

However, according to the bug report I linked above, there is a problem in kwin, which is said to be fixed in 4.9.3, which is scheduled to be released yesterday. Oh. yesterday? I thought it would be tomorrow. *yay*, let's sync!  :Smile: 

----------

## Tolstoi

Don't know about your setup but why don't you just plug in a sysresc usb thumb ?

----------

## Tolstoi

Enabling MAGIC_SYSRQ_KEY helped me out of this mess. At least it seems to have been part of the problem. Thanks!

----------

## Yamakuzure

I am glad it could help you, Tolstoi.

Unfortunately KDE 4.9.3 isn't in the tree, yet. I am impatient and am adding kde overlay via layman right now.

As far as I have understood the issue, kwin isn't checking two OpenGL values, and can therefore pick the wrong FBConfig. It was planned to be fixed in kwin-4.9.3, so full steam ahead I say!

Edith now knows: *sigh* I should have waited for eix-update to finish and should have taken an actual look. Of course kde-4.9.3 *is* in the tree, now.

----------

## Yamakuzure

Ha! The issue seems to be fixed in kwin-4.9.3. No freeze for several minutes now. But now I have garbage instead of tool-tips. That's annoying...

----------

## Yamakuzure

And the tooltip artifacts and garbage where caused by x11-libs/cairo-2.12.6. Downgrading to x11-libs/cairo-2.12.2-r4 instantly solved the issue, even in a running (!) firefox.

----------

