KDE freezes randomly

Bug #1833880 reported by Avamander
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xf86-video-amd
Won't Fix
High

Bug Description

1) The release of Ubuntu you are using: Ubuntu 19.04
2) The version of the package you are using: kinit-5.56.0-0ubuntu1

3) What you expected to happen
KDE not to freeze often and at random

4) What happened instead
KDE freezes often and unpredictably

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: kinit 5.56.0-0ubuntu1
ProcVersionSignature: Ubuntu 5.0.0-17.18-generic 5.0.8
Uname: Linux 5.0.0-17-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.10-0ubuntu27
Architecture: amd64
Date: Mon Jun 24 02:31:45 2019
ExecutablePath: /usr/bin/kdeinit5
InstallationDate: Installed on 2017-08-23 (669 days ago)
InstallationMedia: Kubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
ProcEnviron:

SourcePackage: kinit
UpgradeStatus: Upgraded to disco on 2019-06-20 (3 days ago)

Revision history for this message
Avamander (avamander) wrote :
Revision history for this message
Avamander (avamander) wrote :

Readded file that was originally uploaded by the bug uploader

Revision history for this message
Avamander (avamander) wrote :

This has happened now tens of times and it seems that every time there's a segfault:

gmenudbusmenupr[24241]: segfault at 8 up 00007f7d70ff78a3 sp 00007ffed4b2cfe8 error 4 in libQt5DBus.so.5.12.2

I will post full lines soon

Revision history for this message
Avamander (avamander) wrote :

```
[58707.072415] radeon 0000:20:00.0: IH ring buffer overflow (0x00005630, 0x00005620, 0x00005640)
[225655.414067] gmenudbusmenupr[24241]: segfault at 8 ip 00007f7d70ff78a3 sp 00007ffed4b2cfe8 error 4 in libQt5DBus.so.5.12.2[7f7d70f95000+68000]
[225655.414077] Code: 1f 84 00 00 00 00 00 53 48 8b 36 48 89 fb e8 e4 00 fa ff 48 89 d8 5b c3 90 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 8b 07 <48> 8b 40 08 c3 0f 1f 84 00 00 00 00 00 48 83 ec 08 e8 e7 ff ff ff
[307211.600281] intel_powerclamp: No package C-state available
```

Xorg log also spams a **lot** of messages:

```
[594468.080] (WW) modeset(0): flip queue failed: Cannot allocate memory
[594468.080] (WW) modeset(0): Page flip failed: Cannot allocate memory
[594468.080] (EE) modeset(0): present flip failed
[594468.104] (WW) modeset(0): flip queue failed: Cannot allocate memory
[594468.104] (WW) modeset(0): Page flip failed: Cannot allocate memory
[594468.104] (EE) modeset(0): present flip failed
```

This specific error ends with just the same and after that the following begins:

```
[599582.304] (WW) modeset(0): flip queue failed: Cannot allocate memory
[599582.304] (WW) modeset(0): Page flip failed: Cannot allocate memory
[599582.304] (EE) modeset(0): present flip failed
```

Then these two errors are printed in random sequence:

```
[599632.980] (WW) modeset(0): flip queue failed: Device or resource busy
[599632.980] (WW) modeset(0): Page flip failed: Device or resource busy
[599632.980] (EE) modeset(0): present flip failed
[599632.998] (WW) modeset(0): flip queue failed: Invalid argument
[599632.998] (WW) modeset(0): Page flip failed: Invalid argument
[599632.998] (EE) modeset(0): present flip failed
[599633.019] (WW) modeset(0): flip queue failed: Device or resource busy
[599633.019] (WW) modeset(0): Page flip failed: Device or resource busy
[599633.019] (EE) modeset(0): present flip failed
```

Thousands of lines later it ends up with only this:

```
[599665.784] (WW) modeset(0): flip queue failed: Invalid argument
[599665.784] (WW) modeset(0): Page flip failed: Invalid argument
[599665.784] (EE) modeset(0): present flip failed
[599665.802] (WW) modeset(0): flip queue failed: Invalid argument
[599665.802] (WW) modeset(0): Page flip failed: Invalid argument
[599665.802] (EE) modeset(0): present flip failed
```

I let it work this long because I needed a software to finish its work, thankfully every graphical piece of software just kept running, I could even move the cursor.

Revision history for this message
Avamander (avamander) wrote :

(I could move the cursor but the screen didn't update and nothing was clickable, just needed to clarify that)

Revision history for this message
Avamander (avamander) wrote :

Just in case this helps

Revision history for this message
Avamander (avamander) wrote :

The bug happens with all three compositor backends, OpenGL2/3 and XRender.

Revision history for this message
Avamander (avamander) wrote :

I'm using a Radeon R7 260X (Identifies as Bonaire XTX [Radeon R7 260X/360]) for those Googling this issue on Ubuntu 19.04.

description: updated
Revision history for this message
Avamander (avamander) wrote :

This has happened like 40 times thus far. It's incredibly disruptive, just tell me please what more info can I provide to get this fixed?

In the most recent case KDE froze, I restarted it and then kwin just eats 92% of my CPU. When I did strace of Xorg (I have the file but it's **big**) I first saw:
```
ioctl(14, DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 0x7fffd7980ea0) = -1 ENOMEM (Cannot allocate memory)
```

and

```
futex(0x5586c3807040, FUTEX_WAKE_PRIVATE, 1) = 1
writev(7, [{iov_base="#\224\330\4\0\0\0\0\2\0\0\0-\0 \0\26\0 \0C\1\0\0.\0 \0/\0 \0", iov_len=32}], 1) = 32
writev(7, [{iov_base="#\224\330\4\2\0\0\0\1\0\0\0-\0 \0\26\0 \0C\1\0\0\16\177\262\217\23\0\0\0"..., iov_len=40}], 1) $
epoll_wait(3, [{EPOLLIN, {u32=3285958304, u64=94037299936928}}, {EPOLLIN, {u32=3287010464, u64=94037300989088}}], 256$
recvmsg(45, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\224\1\22\0\26\0\300\1\35\0\300\1\2\0\0\0\0\0\0\0\0\0\$
ioctl(14, DRM_IOCTL_CRTC_GET_SEQUENCE, 0x7fffd7980ee0) = 0
ioctl(14, DRM_IOCTL_MODE_ADDFB, 0x7fffd7980d20) = 0
ioctl(14, DRM_IOCTL_MODE_PAGE_FLIP, 0x7fffd7980e00) = -1 ENOMEM (Cannot allocate memory)
poll([{fd=14, events=POLLIN}], 1, 0) = 0 (Timeout)
write(4, "[ 84302.173] ", 13) = 13
write(4, "(WW) modeset(0): flip queue fail"..., 59) = 59
ioctl(14, DRM_IOCTL_MODE_RMFB, 0x7fffd7980e1c) = 0
write(4, "[ 84302.174] ", 13) = 13
write(4, "(WW) modeset(0): Page flip faile"..., 58) = 58
write(4, "[ 84302.174] ", 13) = 13
write(4, "(EE) modeset(0): present flip fa"..., 37) = 37
```

I rose limits with ulimit just to see what happens (because I had ~4GB actually free RAM), all the "(Cannot allocate memory)" errors disappeared, however then it started spamming (and I stopped stracing it):

```
ioctl(18, DRM_IOCTL_RADEON_GEM_BUSY, 0x7fffd7980470) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_BUSY, 0x7fffd7980470) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_BUSY, 0x7fffd7980470) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_BUSY, 0x7fffd7980470) = 0
```

It took like ten minutes of just using the PC and then suddenly it seemed to stop hogging CPU.

Revision history for this message
In , Avamander (avamander) wrote :
Download full text (6.9 KiB)

What happens:
* At some point KDE just freezes and Xorg starts spamming the logs with:
```
[596294.070] (WW) modeset(0): flip queue failed: Cannot allocate memory
[596294.070] (WW) modeset(0): Page flip failed: Cannot allocate memory
[596294.070] (EE) modeset(0): present flip failed
```

I also captured a bit of strace output (I have about 450MB of strace output, if required I can provide a lot more), here's a snippet:

```
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]}) = 0
futex(0x5586c3807094, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5586c3807040, FUTEX_WAKE_PRIVATE, 1) = 1
epoll_wait(3, [{EPOLLIN, {u32=3287010464, u64=94037300989088}}], 256, 0) = 1
recvmsg(45, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="+\26\1\0", iov_len=16384}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 4
writev(45, [{iov_base="\1\1s\3\0\0\0\0\6\0\300\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=32}], 1) = 32
recvmsg(45, {msg_namelen=0}, 0) = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(3, [], 256, 0) = 0
recvmsg(7, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\224\1\22\0\26\0 \0.\0 \0A\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=16384}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 288
ioctl(14, DRM_IOCTL_CRTC_GET_SEQUENCE, 0x7fffd7980ee0) = 0
ioctl(14, DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 0x7fffd7980ea0) = -1 ENOMEM (Cannot allocate memory)
ioctl(18, DRM_IOCTL_RADEON_GEM_CREATE, 0x7fffd7980d20) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980d00) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980da0) = 0
ioctl(18, DRM_IOCTL_GEM_CLOSE, 0x7fffd7980d98) = 0
futex(0x5586c3807090, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5586c3807040, FUTEX_WAKE_PRIVATE, 1) = 1
writev(7, [{iov_base="#\224\324\4\0\0\0\0\2\0\0\0-\0 \0\26\0 \0A\1\0\0.\0 \0/\0 \0", iov_len=32}], 1) = 32
writev(7, [{iov_base="#\224\324\4\2\0\0\0\1\0\0\0-\0 \0\26\0 \0A\1\0\0\16\177\262\217\23\0\0\0"..., iov_len=40}], 1) = 40
ioctl(14, DRM_IOCTL_CRTC_GET_SEQUENCE, 0x7fffd7980ee0) = 0
ioctl(14, DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 0x7fffd7980ea0) = -1 ENOMEM (Cannot allocate memory)
ioctl(18, DRM_IOCTL_RADEON_GEM_CREATE, 0x7fffd7980d20) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980d00) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980da0) = 0
ioctl(18, DRM_IOCTL_GEM_CLOSE, 0x7fffd7980d98) = 0
futex(0x5586c3807094, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5586c3807040, FUTEX_WAKE_PRIVATE, 1) = 1
writev(7, [{iov_base="#\224\325\4\0\0\0\0\2\0\0\0-\0 \0\26\0 \0B\1\0\0000\0 \0001\0 \0", iov_len=32}], 1) = 32
writev(7, [{iov_base="#\224\325\4\2\0\0\0\1\0\0\0-\0 \0\26\0 \0B\1\0\0\16\177\262\217\23\0\0\0"..., iov_len=40}], 1) = 40
ioctl(14, DRM_IOCTL_CRTC_GET_SEQUENCE, 0x7fffd7980ee0) = 0
ioctl(14, DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 0x7fffd7980ea0) = -1 ENOMEM (Cannot allocate memory)
ioctl(18, DRM_IOCTL_RADEON_GEM_CREATE, 0x7fffd7980d20) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980d00) = 0
ioctl(18, DRM_IOCTL_RADEON_GEM_VA, 0x7fffd7980da0) = 0
ioctl(18, DRM_IOCTL_GEM_CLOSE, 0x7fffd7980d98) = 0
futex(0x5586c3807090, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x5586c3807040, FUTEX_WAKE_PRIVATE, 1) = 1
writev(7, [{iov_base="#\224\32...

Read more...

Changed in xf86-video-amd:
importance: Undecided → Unknown
status: New → Unknown
Changed in xf86-video-amd:
importance: Unknown → High
status: Unknown → Confirmed
Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

You're using the Xorg modesetting driver, not the xf86-video-ati radeon driver. Does the problem also occur with the latter? If yes, please attach the corresponding Xorg log file and output of dmesg.

Revision history for this message
In , Avamander (avamander) wrote :

Created attachment 144742
dmesg

Revision history for this message
In , Avamander (avamander) wrote :

Created attachment 144743
syslog

Revision history for this message
In , Avamander (avamander) wrote :

Created attachment 144744
syslog

I truncated it to only contain last boot

Revision history for this message
In , Avamander (avamander) wrote :

Created attachment 144745
Xorg.0.log

Revision history for this message
In , Avamander (avamander) wrote :

These last three are the most recent freeze's, haven't yet managed to switch drivers.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

The Xorg log file is still from the modesetting driver, not the radeon one. Also, it doesn't contain the failure lines. Make sure you attach the information corresponding to the problem. You may need to get the Xorg.*.log.old file.

Revision history for this message
In , Avamander (avamander) wrote :

As I said, I haven't yet switched, mostly because it's incredibly painful to find out how to switch away from modesetting because Google thinks it knows better :D

I don't know why it doesn't contain failure lines, but it did freeze.

Revision history for this message
In , Avamander (avamander) wrote :

If you could tell me how to switch drivers I'd gladly do it much quicker.

Revision history for this message
In , Avamander (avamander) wrote :

Okay for those that are Googling this:

You can switch from Xorg modesetting driver to the xf86-video-ati radeon driver by setting `modeset=0` kernel parameter and installing the `xserver-xorg-video-radeon` on Ubuntu 19.04.

The very least the Xorg log now says "RADEON(0)" instead of "modeset(0)", I hope this fixes the terrible, terrible bug.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to Avamander from comment #10)
> You can switch from Xorg modesetting driver to the xf86-video-ati radeon
> driver by setting `modeset=0` kernel parameter

That kernel parameter would prevent the radeon kernel driver from working. It's not directly related to which Xorg driver is used.

> and installing the `xserver-xorg-video-radeon` on Ubuntu 19.04.

The radeon driver should be used automatically if xserver-xorg-video-ati is installed as well, otherwise it can be selected in /etc/X11/xorg.conf Section "Device".

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to Michel Dänzer from comment #11)
> > and installing the `xserver-xorg-video-radeon` on Ubuntu 19.04.
>
> The radeon driver should be used automatically if xserver-xorg-video-ati is
> installed as well, [...]

Never mind, just installing xserver-xorg-video-radeon should be enough. Forgot that I made that work a few years ago. :)

Revision history for this message
In , Avamander (avamander) wrote :

> That kernel parameter would prevent the radeon kernel driver from working. It's not directly related to which Xorg driver is used.

Good to know. So I can re-enable it?

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

(In reply to Avamander from comment #13)
> Good to know. So I can re-enable it?

You haven't actually disabled it yet, or the radeon driver wouldn't be working. But yeah, better make sure it won't actually get disabled.

Revision history for this message
In , Avamander (avamander) wrote :

If that is true then `modeset=0` has simply no effect if it's not specifically something like `radeon.modeset=0`?

Revision history for this message
In , Avamander (avamander) wrote :

I don't want to cause even more bad luck but it seems changing drivers fixed the bug for me.

Revision history for this message
In , Michel Dänzer (michel-daenzer) wrote :

Glad to hear it doesn't seem to happen with the radeon driver.

modesetting driver issues can be filed here: https://gitlab.freedesktop.org/xorg/xserver/issues/new

Revision history for this message
Avamander (avamander) wrote :

Switching drivers decreased the freeze frequency tremendously, so it's pretty much a solution.

Revision history for this message
In , Avamander (avamander) wrote :

I think I stumbled upon two bugs stacked, one being the frequent page flip/memory allocation fails that was really frequent, other being the random silent freeze. The random silent freezes are still happening but very infrequently and I think it's not Xorg.

Changed in xf86-video-amd:
status: Confirmed → Won't Fix
Revision history for this message
Avamander (avamander) wrote :

Due to two bugs stacked replacing the driver fixes only one of them, I do still get random KDE freezes, they are however much more rare. Would like advice on how to collect debugging information to fix that.

Revision history for this message
Avamander (avamander) wrote :

Switching to Xorg PPA seems to have fixed it.

Avamander (avamander)
Changed in kinit (Ubuntu):
status: New → Fix Released
no longer affects: kinit (Ubuntu)
no longer affects: xorg-server
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.