[K8M890] Freezes with K8M890 and openchrome driver

Bug #326583 reported by thsths
2
Affects Status Importance Assigned to Milestone
openchrome
Fix Released
Unknown
linux (Ubuntu)
Invalid
Medium
Andy Whitcroft
xserver-xorg-video-openchrome (Ubuntu)
Fix Released
Medium
Bartosz Kosiorek

Bug Description

I am using Ubuntu 8.10 AMD64 with openchrome on a VIA K8M890 board, using the on board graphics VIA Chrome9 HC. This is working fine, except that during the startup of graphical applications, the system would freeze for about 5 seconds at a time. I have now found the cause of these freezes, and I think I have a fix.

The bug is in via_wait_idle(), in the DRM module via.ko. This function (I assume) is supposed to wait until the GPU is idle. First it waits for the GPU to become busy, but this may never happen. It then times out, but that causes the observed freeze of the system.

The statement to wait for the GPU to become busy was introduced in 2.6.22, http://www.linuxhq.com/kernel/v2.6/21-git13/drivers/char/drm/via_dma.c to be precise. I assume that there is a reason for this change (maybe the routine is sometimes called before the GPU is marked as busy), but even then it is not the correct solution.

Now one of the problems is that this first bug interacts with a second one: the timeout of via_wait_idle() is ignored in via_driver_dma_quiescent(). The return value indication a timetout is -1, but the check assumes it would be 0.

The combination of both bugs means that we do not want to handle timeouts caused by the GPU being already idle. And I am not even sure whether we want to handle timeouts at all: it would be a good idea, but the code so far does not.

Anyway, I have a patch below that fixes the two bugs, explains what is going on, and most of all works for me. I would be interested to here how it works for other people. (To be honest I could not get openchrome to work under i386 on my system, but maybe somebody has more luck.)

One of the annoying aspects of this bug is that there is no error message anywhere. I think this is because DRM does not usually log error messages, and because the return code of via_wait_idle() is handled incorrectly. If I enable debugging with insmod drm.ko debug=1, I get the lines attached as dmesg.log, indicating that the patch is working as intended.

This bug may be related to https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-openchrome/+bug/158999, because that is probably caused by the same patch set in linux 2.6.22. This may even be the solution, but I cannot test that.

Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :
Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :
Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :
Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :
Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :
description: updated
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Could You please try to build and install the newest Openchrome driver and try to run with original kernel?

Build instruction I described at:
https://help.ubuntu.com/community/OpenChrome

I have Ubuntu Intrepid 8.10 with K8M890 chipset and latest openchrome drivers and I do not observe any applications freezes.

Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :

Hi Bartosz

Yes, I just tried it (I think I did it before, but I may not have installed the DRM LKM). Anyway, the effect is very much the same, which is not surprising given that the same offending statement is in via_dma.c.

Are you using AMD64 (or x86_64 in new speak)? That may be part of the problem, although I fail to see how it would make a difference.

Did you try XV? I think the problem is very much related to an application opening an XV port, although it could be another part of mythtv.

And I am not sure whether there are different versions of the K8M890. lspci says about mine:

01:00.0 VGA compatible controller: VIA Technologies, Inc. K8M890CE/K8N890CE [Chrome 9] (rev 01)
        Subsystem: VIA Technologies, Inc. K8M890CE/K8N890CE [Chrome 9]
        Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 16
        Memory at c0000000 (32-bit, prefetchable) [size=256M]
        Memory at dd000000 (32-bit, non-prefetchable) [size=16M]
        [virtual] Expansion ROM at de000000 [disabled] [size=64K]
        Capabilities: [60] Power Management version 2
        Capabilities: [70] AGP version 3.0

or numeric:

01:00.0 0300: 1106:3230 (rev 01)
        Subsystem: 1106:3230

Andy Whitcroft (apw)
Changed in linux (Ubuntu):
assignee: nobody → Andy Whitcroft (apw)
status: New → In Progress
Revision history for this message
Andy Whitcroft (apw) wrote :

@thsths -- have you attempted to push this patch upstream at all? It is easier for us to take patches which have some degree of acceptance upstream while minimising our delta from there.

Changed in linux (Ubuntu):
status: In Progress → Incomplete
Revision history for this message
thsths (thomas-steffen+ubuntu) wrote :

> have you attempted to push this patch upstream at all?

Yes, I did. The response was two-fold negative: on one hand, the existing (kernel) driver is not supposed to support the Chrome9 anyway, and it is just a coincidence that it works. On the other hand, a rewrite is underway by Jon, which should then support Chrome9. But he is busy at the moment, and I was not able to test it. So I think the upstream situation for OpenChrome is still a bit chaotic.

I am not sure whether it is worthwhile to try to get it into the main line kernel. I am surprised that it is in there at all.

Andy Whitcroft (apw)
Changed in linux (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

This is well know bug in Openchrome

Changed in openchrome:
status: Unknown → Fix Released
Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Hello.
This problem was fixed in the openchrome revision 750:
http://www.openchrome.org/trac/changeset/750

Could You please try again build and install the newest Openchrome driver?

Build instruction I described at:
https://help.ubuntu.com/community/OpenChrome

Changed in xserver-xorg-video-openchrome (Ubuntu):
assignee: nobody → Bartosz (gang65)
status: New → Confirmed
Changed in xserver-xorg-video-openchrome (Ubuntu):
importance: Undecided → Medium
Changed in xserver-xorg-video-openchrome (Ubuntu):
status: Confirmed → Invalid
status: Invalid → Triaged
Changed in linux (Ubuntu):
status: Incomplete → Invalid
summary: - Freezes with K8M890 and openchrome driver
+ [K8M890] Freezes with K8M890 and openchrome driver
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

The Karmic packages have been updated to r758, which include the fix for this bug.

Changed in xserver-xorg-video-openchrome (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.