Bug 111091

Summary: Xorg causes KDE to freeze
Product: xorg Reporter: Avamander <avamander>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED NOTOURBUG QA Contact: Xorg Project Team <xorg-team>
Severity: major    
Priority: medium    
Version: 7.7 (2012.06)   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
dmesg
none
syslog
none
syslog
none
Xorg.0.log none

Description Avamander 2019-07-08 23:20:04 UTC
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\326\4\0\0\0\0\2\0\0\0\"\0 \0\22\0 \0C\1\0\0#\0 \0$\0 \0", iov_len=32}], 1) = 32
writev(7, [{iov_base="#\224\326\4\2\0\0\0\1\0\0\0\"\0 \0\22\0 \0C\1\0\0\264\20\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\327\4\0\0\0\0\2\0\0\0\"\0 \0\22\0 \0D\1\0\0%\0 \0&\0 \0", iov_len=32}], 1) = 32
writev(7, [{iov_base="#\224\327\4\2\0\0\0\1\0\0\0\"\0 \0\22\0 \0D\1\0\0\264\20\262\217\23\0\0\0"..., iov_len=40}], 1) = 40
recvmsg(7, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\224\1\22\0\26\0 \0.\0 \0C\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
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
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) = 40
epoll_wait(3, [{EPOLLIN, {u32=3285958304, u64=94037299936928}}, {EPOLLIN, {u32=3287010464, u64=94037300989088}}], 256, 0) = 2
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\0\0\0\0\0\0\0\0\0\0"..., iov_len=16384}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 100
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
ioctl(14, DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 0x7fffd7980e30) = -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(45, [{iov_base="#\224t\3\0\0\0\0\2\0\0\0\30\0\300\1\26\0\300\1\2\0\0\0\35\0\300\1\36\0\300\1", iov_len=32}], 1) = 32
writev(45, [{iov_base="#\224t\3\2\0\0\0\1\0\0\0\30\0\300\1\26\0\300\1\2\0\0\0\264\20\262\217\23\0\0\0"..., iov_len=40}], 1) = 40
writev(53, [{iov_base="\34\0\231\1*\5\0\0E\1\0\0^Y\6\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=32}], 1) = 32
```

I have opened bugs also on KDE's bug tracker and Ubuntu's to get this resolved:
* https://bugs.kde.org/show_bug.cgi?id=409514
* https://bugs.launchpad.net/xf86-video-amd/+bug/1833880
Comment 1 Michel Dänzer 2019-07-09 07:35:28 UTC
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.
Comment 2 Avamander 2019-07-09 13:35:09 UTC
Created attachment 144742 [details]
dmesg
Comment 3 Avamander 2019-07-09 13:35:43 UTC
Created attachment 144743 [details]
syslog
Comment 4 Avamander 2019-07-09 13:39:28 UTC
Created attachment 144744 [details]
syslog

I truncated it to only contain last boot
Comment 5 Avamander 2019-07-09 13:43:53 UTC
Created attachment 144745 [details]
Xorg.0.log
Comment 6 Avamander 2019-07-09 13:44:22 UTC
These last three are the most recent freeze's, haven't yet managed to switch drivers.
Comment 7 Michel Dänzer 2019-07-09 13:49:21 UTC
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.
Comment 8 Avamander 2019-07-09 14:13:02 UTC
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.
Comment 9 Avamander 2019-07-09 14:16:00 UTC
If you could tell me how to switch drivers I'd gladly do it much quicker.
Comment 10 Avamander 2019-07-09 14:56:41 UTC
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.
Comment 11 Michel Dänzer 2019-07-09 15:15:42 UTC
(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".
Comment 12 Michel Dänzer 2019-07-09 15:17:50 UTC
(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. :)
Comment 13 Avamander 2019-07-09 15:18:30 UTC
> 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?
Comment 14 Michel Dänzer 2019-07-09 15:22:36 UTC
(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.
Comment 15 Avamander 2019-07-09 15:25:44 UTC
If that is true then `modeset=0` has simply no effect if it's not specifically something like `radeon.modeset=0`?
Comment 16 Avamander 2019-07-11 21:10:58 UTC
I don't want to cause even more bad luck but it seems changing drivers fixed the bug for me.
Comment 17 Michel Dänzer 2019-07-12 10:41:09 UTC
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
Comment 18 Avamander 2019-07-14 14:51:04 UTC
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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.