Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

rootston: blackscreen and freeze after switching to and from X #1359

Closed
soreau opened this issue Nov 6, 2018 · 12 comments
Closed

rootston: blackscreen and freeze after switching to and from X #1359

soreau opened this issue Nov 6, 2018 · 12 comments

Comments

@soreau
Copy link
Contributor

soreau commented Nov 6, 2018

After starting rootston drm and switching to X, switching back to rootston (more often than not) results in blackscreen and renders the keyboard useless. The only way I've found to recover is ssh in and kill rootston. This also happens in wayfire. This is a backtrace from gdb while rootston is in this state:

(gdb) bt full
#0  0x00007f9b2f8d55d7 in ioctl () at ../sysdeps/unix/syscall-template.S:78
#1  0x00007f9b2e8f21c8 in drmIoctl () at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#2  0x00007f9b2e8f918f in drmModeAtomicCommit () at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#3  0x00007f9b308ab593 in atomic_commit (drm_fd=9, atom=0x7ffde3b60f90, conn=0x55bc4b343040, flags=1025, modeset=true) at ../backend/drm/atomic.c:52
        ret = 50
#4  0x00007f9b308abaa5 in atomic_crtc_pageflip (drm=0x55bc4af77430, conn=0x55bc4b343040, crtc=0x55bc4af77e20, fb_id=99, mode=0x55bc4b2c0890) at ../backend/drm/atomic.c:131
        flags = 1025
        atom = {req = 0x55bc4b4fd370, cursor = 0, failed = false}
#5  0x00007f9b308adbd0 in drm_connector_start_renderer (conn=0x55bc4b343040) at ../backend/drm/drm.c:372
        drm = 0x55bc4af77430
        crtc = 0x55bc4af77e20
        plane = 0x55bc4af788d0
        bo = 0x55bc4b603850
        fb_id = 99
        mode = 0x55bc4b2c0870
#6  0x00007f9b308ae575 in drm_connector_set_mode (output=0x55bc4b343040, mode=0x55bc4b2c0870) at ../backend/drm/drm.c:524
        conn = 0x55bc4b343040
        drm = 0x55bc4af77430
#7  0x00007f9b308e8f37 in wlr_output_set_mode (output=0x55bc4b343040, mode=0x55bc4b2c0870) at ../types/wlr_output.c:161
#8  0x00007f9b308ac4a3 in session_signal (listener=0x55bc4af774f8, data=0x55bc4af6d640) at ../backend/drm/backend.c:96
        plane = 0x7f9b308b546c <session_signal+77>
        conn = 0x55bc4b343040
        drm = 0x55bc4af77430
        session = 0x55bc4af6d640
#9  0x00007f9b308f996b in wlr_signal_emit_safe (signal=0x55bc4af6d648, data=0x55bc4af6d640) at ../util/signal.c:29
        pos = 0x55bc4af774f8
        l = 0x55bc4af774f8
        cursor = {link = {prev = 0x55bc4af774f8, next = 0x7ffde3b61140}, notify = 0x7f9b308f98b5 <handle_noop>}
        end = {link = {prev = 0x7ffde3b61120, next = 0x55bc4af6d648}, notify = 0x7f9b308f98b5 <handle_noop>}
#10 0x00007f9b308bf1fe in resume_device (msg=0x55bc4b50b370, userdata=0x55bc4af6d640, ret_error=0x7ffde3b61210) at ../backend/session/logind.c:312
        dev = 0x55bc4af75640
        session = 0x55bc4af6d640
        ret = 1
        fd = 25
        major = 226
        minor = 0
#11 0x00007f9b2f395de5 in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#12 0x00007f9b2f395b1f in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#13 0x00007f9b2f39607e in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#14 0x00007f9b2f395b1f in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#15 0x00007f9b2f39607e in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#16 0x00007f9b2f395b1f in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#17 0x00007f9b2f39607e in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#18 0x00007f9b2f395b1f in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#19 0x00007f9b2f39607e in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#20 0x00007f9b2f395b1f in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#21 0x00007f9b2f395bfe in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#22 0x00007f9b2f395a45 in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
---Type <return> to continue, or q <return> to quit---
#23 0x00007f9b2f3442d3 in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#24 0x00007f9b2f369c19 in  () at /lib/x86_64-linux-gnu/libsystemd.so.0
#25 0x00007f9b308bf982 in dbus_event (fd=4, mask=1, data=0x55bc4af6e8b0) at ../backend/session/logind.c:473
        bus = 0x55bc4af6e8b0
#26 0x00007f9b30675da2 in wl_event_loop_dispatch (loop=0x55bc4af64f10, timeout=timeout@entry=-1) at src/event-loop.c:641
        ep = 
              {{events = 1, data = {ptr = 0x55bc4af740a0, fd = 1257717920, u32 = 1257717920, u64 = 94267199930528}}, {events = 1, data = {ptr = 0x55bc4af740a0, fd = 1257717920, u32 = 1257717920, u64 = 94267199930528}}, {events = 824194608, data = {ptr = 0x2037343a31333a32, fd = 825440818, u32 = 825440818, u64 = 2321381557470968370}}, {events = 8237, data = {ptr = 0x55bc4af75cd8, fd = 1257725144, u32 = 1257725144, u64 = 94267199937752}}, {events = 814717109, data = {ptr = 0x1a3f820000007f9b, fd = 32667, u32 = 32667, u64 = 1891373305030541211}}, {events = 3763373954, data = {ptr = 0x7ffde3b61d80, fd = -474604160, u32 = 3820363136, u64 = 140728423816576}}, {events = 814710213, data = {ptr = 0x3090278000007f9b, fd = 32667, u32 = 32667, u64 = 3499340341176205211}}, {events = 32667, data = {ptr = 0x34af75cd8, fd = 1257725144, u32 = 1257725144, u64 = 14142627032}}, {events = 32, data = {ptr = 0xe3b61d9000000030, fd = 48, u32 = 48, u64 = 16408334796683477040}}, {events = 32765, data = {ptr = 0x2, fd = 2, u32 = 2, u64 = 2}}, {events = 0, data = {ptr = 0x0, fd = 0, u32 = 0, u64 = 0}} <repeats 22 times>}
        source = <optimized out>
        i = <optimized out>
        count = <optimized out>
#27 0x00007f9b306749ba in wl_display_run (display=0x55bc4af67700) at src/wayland-server.c:1260
#28 0x000055bc49eb5105 in main (argc=1, argv=0x7ffde3b61f68) at ../rootston/main.c:74
        __PRETTY_FUNCTION__ = "main"
        socket = 0x55bc4b3401c9 "wayland-0"
(gdb)

From wayfire:
(gdb) bt full
#0  0x00007f54c6d105d7 in ioctl () at ../sysdeps/unix/syscall-template.S:78
#1  0x00007f54c90a0880 in ioctl () at /usr/lib/x86_64-linux-gnu/libasan.so.4
#2  0x00007f54c590e1c8 in drmIoctl () at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#3  0x00007f54c591518f in drmModeAtomicCommit ()
    at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#4  0x00007f54c8962483 in atomic_commit (drm_fd=9, atom=0x7ffde98c0b00, conn=0x61700000ba00, flags=1025, modeset=true) at ../backend/drm/atomic.c:52
        ret = 50
#5  0x00007f54c8962995 in atomic_crtc_pageflip (drm=0x613000000200, conn=0x61700000ba00, crtc=0x616000005040, fb_id=98, mode=0x60b00002b8d0)
    at ../backend/drm/atomic.c:131
        flags = 1025
        atom = {req = 0x60200032f630, cursor = 0, failed = false}
#6  0x00007f54c8964ac0 in drm_connector_start_renderer (conn=0x61700000ba00)
    at ../backend/drm/drm.c:372
        drm = 0x613000000200
        crtc = 0x616000005040
        plane = 0x61d000006800
        bo = 0x6070002e87f0
        fb_id = 98
        mode = 0x60b00002b8b0
#7  0x00007f54c8965465 in drm_connector_set_mode (output=0x61700000ba00, mode=0x60b00002b8b0) at ../backend/drm/drm.c:524
---Type <return> to continue, or q <return> to quit---
@emersion
Copy link
Member

emersion commented Nov 6, 2018

Can you provide debug logs?

@soreau
Copy link
Contributor Author

soreau commented Nov 6, 2018

@emersion Can you say what you're looking for exactly? Do you just want stdout+stderr from rootston or something else?

@soreau
Copy link
Contributor Author

soreau commented Nov 6, 2018

After looking for logs, I found this in dmesg:

[70050.542745] WARNING: CPU: 0 PID: 27920 at /build/linux-CuEUJv/linux-4.15.0/drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3786 prepare_flip_isr+0x6c/0x70 [amdgpu]
[70050.542746] Modules linked in: rfcomm vmw_vsock_vmci_transport vsock vmw_vmci bnep btusb btrtl btbcm btintel hid_sony bluetooth ff_memless ecdh_generic pci_stub vboxpci(OE) vboxnetadp(OE) vboxnetflt(OE) vboxdrv(OE) binfmt_misc usblp input_leds joydev nls_iso8859_1 hid_generic usbhid hid uvcvideo videobuf2_vmalloc videobuf2_memops intel_rapl videobuf2_v4l2 videobuf2_core x86_pkg_temp_thermal intel_powerclamp videodev kvm_intel media kvm snd_usb_audio snd_usbmidi_lib irqbypass crct10dif_pclmul crc32_pclmul ghash_clmulni_intel gpio_ich pcbc snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm eeepc_wmi snd_seq_midi aesni_intel asus_wmi snd_seq_midi_event snd_rawmidi aes_x86_64 crypto_simd glue_helper sparse_keymap cryptd intel_cstate
[70050.542792] wmi_bmof intel_rapl_perf snd_seq serio_raw snd_seq_device snd_timer snd mei_me mei lpc_ich soundcore shpchp mac_hid sch_fq_codel nct6775 hwmon_vid lm75 coretemp parport_pc sunrpc ppdev lp parport ip_tables x_tables autofs4 uas usb_storage amdkfd amd_iommu_v2 amdgpu chash i2c_algo_bit ttm r8169 mii drm_kms_helper i2c_i801 psmouse syscopyarea sysfillrect sysimgblt fb_sys_fops ahci drm libahci wmi video
[70050.542827] CPU: 0 PID: 27920 Comm: rootston Tainted: G W OE 4.15.0-38-generic #41-Ubuntu
[70050.542828] Hardware name: System manufacturer System Product Name/P8Z68-V LX, BIOS 4105 07/01/2013
[70050.542883] RIP: 0010:prepare_flip_isr+0x6c/0x70 [amdgpu]
[70050.542885] RSP: 0018:ffffb16a497bfa78 EFLAGS: 00010082
[70050.542887] RAX: 0000000000000001 RBX: 0000000000000202 RCX: 0000000000000001
[70050.542888] RDX: 0000000000000001 RSI: 0000000000000202 RDI: ffff9b4f00f4e000
[70050.542889] RBP: ffffb16a497bfa78 R08: 0000000000000000 R09: ffff9b4e9aecc100
[70050.542891] R10: ffff9b4f00f4e000 R11: ffff9b4d8dc91000 R12: 0000000000000000
[70050.542892] R13: ffff9b4f00f4e000 R14: ffff9b4e9aecc100 R15: 0000000000000004
[70050.542895] FS: 00007f369dc6e940(0000) GS:ffff9b4f1ec00000(0000) knlGS:0000000000000000
[70050.542896] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[70050.542898] CR2: 00007f5188312000 CR3: 0000000272712003 CR4: 00000000000606f0
[70050.542899] Call Trace:
[70050.542953] amdgpu_dm_atomic_commit_tail+0x6c9/0xa50 [amdgpu]
[70050.542956] ? wake_up_q+0x80/0x80
[70050.542966] commit_tail+0x42/0x70 [drm_kms_helper]
[70050.542974] drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper]
[70050.543027] amdgpu_dm_atomic_commit+0x87/0xa0 [amdgpu]
[70050.543043] drm_atomic_commit+0x51/0x60 [drm]
[70050.543058] drm_mode_atomic_ioctl+0x8b2/0xa50 [drm]
[70050.543073] ? drm_atomic_set_property+0x4c0/0x4c0 [drm]
[70050.543086] drm_ioctl_kernel+0x5f/0xb0 [drm]
[70050.543099] drm_ioctl+0x31b/0x3d0 [drm]
[70050.543112] ? drm_atomic_set_property+0x4c0/0x4c0 [drm]
[70050.543151] amdgpu_drm_ioctl+0x4f/0x90 [amdgpu]
[70050.543155] do_vfs_ioctl+0xa8/0x630
[70050.543159] ? SyS_futex+0x13b/0x180
[70050.543162] SyS_ioctl+0x79/0x90
[70050.543165] do_syscall_64+0x73/0x130
[70050.543169] entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[70050.543171] RIP: 0033:0x7f369c83b5d7
[70050.543172] RSP: 002b:00007ffc0e314f18 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[70050.543175] RAX: ffffffffffffffda RBX: 0000559af4768cb0 RCX: 00007f369c83b5d7
[70050.543176] RDX: 00007ffc0e314f70 RSI: 00000000c03864bc RDI: 0000000000000009
[70050.543177] RBP: 00007ffc0e314f70 R08: 0000559af4768b80 R09: 0000000000000036
[70050.543179] R10: 0000000000000002 R11: 0000000000000246 R12: 00000000c03864bc
[70050.543180] R13: 0000000000000009 R14: 0000559af44a4090 R15: 0000000000000401
[70050.543182] Code: 07 00 00 48 c7 80 00 02 00 00 00 00 00 00 48 c7 c2 10 a2 6c c0 8b 8f b0 04 00 00 48 c7 c7 06 c7 6d c0 e8 98 2e e0 ff 5d c3 0f 0b <0f> 0b eb b0 66 66 66 66 90 55 48 89 e5 41 54 53 8b 86 48 02 00
[70050.543227] ---[ end trace 90f775ae9a2a04da ]---
[70060.782214] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] ERROR [CRTC:50:crtc-4] flip_done timed out
[70071.022421] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] ERROR [CRTC:50:crtc-4] flip_done timed out
[70081.262628] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] ERROR [PLANE:40:plane-4] flip_done timed out

so looking like it's a problem with amdgpu.

@emersion
Copy link
Member

emersion commented Nov 6, 2018

Ah, interesting. Yeah, this is definitely an amdgpu bug.

@soreau
Copy link
Contributor Author

soreau commented Nov 6, 2018

Sorry for the noise.

@soreau soreau closed this as completed Nov 6, 2018
@emersion
Copy link
Member

emersion commented Nov 6, 2018

Nah, no problem. You should report this to amdgpu, they have a bug tracker on freedesktop.org.

@ammen99
Copy link
Member

ammen99 commented Nov 6, 2018

Just a note to those that have the same issues:

After a bit of experimenting, it seems the bug causes even kernel panics for newer versions of the kernel/amdgpu. However the issue is most probably related to atomic modesetting and disabling atomic in wlroots can be used as a workaround - by using the WLR_DRM_NO_ATOMIC=1 environment variable

@emersion
Copy link
Member

emersion commented Nov 6, 2018

Extra note: if WLR_DRM_NO_ATOMIC=1 is set, no need to set WLR_DRM_NO_ATOMIC_GAMMA=1.

@ammen99
Copy link
Member

ammen99 commented Nov 6, 2018

Extra note: if WLR_DRM_NO_ATOMIC=1 is set, no need to set WLR_DRM_NO_ATOMIC_GAMMA=1.

Thanks, updated my comment.

@soreau
Copy link
Contributor Author

soreau commented Nov 6, 2018

@emersion That extra note could be added to https://github.com/swaywm/wlroots/blob/master/docs/env_vars.md

@emersion
Copy link
Member

emersion commented Nov 6, 2018

Sure, can you send a pull request?

@soreau
Copy link
Contributor Author

soreau commented Nov 6, 2018

FWIW, this was from kernel 4.15. I tested 4.18 and rootston worked but wayfire locked up the machine without setting WLR_DRM_NO_ATOMIC=1. With kernel 4.19, rootston and wayfire launch fine (without disabling atomic) and I am able to switch to and from X without lockup so far.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants