Bug 1846191

Summary: usb adapters hotplug crashes gnome-shell
Product: Red Hat Enterprise Linux 8 Reporter: Dave Airlie <airlied>
Component: mutterAssignee: Jonas Ådahl <jadahl>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: fmuellner, jkoten, jsolomon, tpelka
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mutter-3.32.2-45.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:35:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave Airlie 2020-06-11 03:13:47 UTC
I had a RHEL7 bug filed and I wanted to test RHEL 8. I'm running 8.3 nightly.

I plug in the USB device, and it shows up, I have trouble getting the control center to apply changes to switch to dual screen.

When I unplug the device it looks like mutter doesn't notice.

When I plug it in again it looks like mutter crashes.

Comment 1 Dave Airlie 2020-06-11 03:14:55 UTC
this is in wayland session.

Comment 2 Dave Airlie 2020-06-15 04:24:54 UTC
Thread 1 "gnome-shell" received signal SIGSEGV, Segmentation fault.
0x00007f7acb71ebab in meta_gpu_get_outputs (gpu=gpu@entry=0x35) at ../src/backends/meta-gpu.c:111
111	  return priv->outputs;
(gdb) bt
#0  0x00007f7acb71ebab in meta_gpu_get_outputs (gpu=gpu@entry=0x35) at ../src/backends/meta-gpu.c:111
#1  0x00007f7acb7d6115 in get_crtc_drm_connectors (gpu=0x35, crtc=crtc@entry=0x7f7a98008770, connectors=connectors@entry=0x7ffdf0ed2790, n_connectors=n_connectors@entry=0x7ffdf0ed278c)
    at ../src/backends/native/meta-gpu-kms.c:119
#2  0x00007f7acb7d6501 in meta_gpu_kms_apply_crtc_mode (gpu_kms=gpu_kms@entry=0x55d85a380340, crtc=0x7f7a98008770, x=x@entry=0, y=y@entry=0, fb_id=fb_id@entry=0)
    at ../src/backends/native/meta-gpu-kms.c:151
#3  0x00007f7acb7e0042 in meta_renderer_native_finish_frame (renderer_native=0x55d8571c7eb0) at ../src/backends/native/meta-renderer-native.c:3640
#4  0x00007f7acbf95dda in clutter_stage_cogl_redraw (stage_window=0x55d857622190) at ../clutter/clutter/cogl/clutter-stage-cogl.c:938
#5  0x00007f7acbf54a0e in _clutter_stage_do_update (stage=<optimized out>) at ../clutter/clutter/clutter-stage.c:1127
#6  0x00007f7acbf3e1e9 in master_clock_update_stages (master_clock=0x55d857643e40, stages=0x55d859284a70 = {...}) at ../clutter/clutter/clutter-master-clock-default.c:442
#7  0x00007f7acbf3e1e9 in clutter_clock_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at ../clutter/clutter/clutter-master-clock-default.c:568
#8  0x00007f7acd2d267d in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#9  0x00007f7acd2d2a48 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#10 0x00007f7acd2d2d72 in g_main_loop_run () at /lib64/libglib-2.0.so.0
#11 0x00007f7acb767e30 in meta_run () at ../src/core/main.c:685
#12 0x000055d855872576 in main ()
(gdb) print priv
$1 = (MetaGpuPrivate *) 0x15
(gdb) up
#1  0x00007f7acb7d6115 in get_crtc_drm_connectors (gpu=0x35, crtc=crtc@entry=0x7f7a98008770, connectors=connectors@entry=0x7ffdf0ed2790, n_connectors=n_connectors@entry=0x7ffdf0ed278c)
    at ../src/backends/native/meta-gpu-kms.c:119
119	  for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
(gdb) print gpu
$2 = 0x35

Comment 3 Dave Airlie 2020-06-15 04:38:01 UTC
okay looks like we have to get some backporting done 

f3660dc60e76b13e35f361a1ea6816f8b0af66d8
Author: Hans de Goede <hdegoede>
Date:   Mon Aug 5 14:08:08 2019 +0200

    kms: Deal with GPUs being unplugged


would seem necessary.

Comment 5 Jonas Ådahl 2020-06-25 08:20:55 UTC
Backporting is not feasable, so I attempted to in the dark write something similar that might fix it. Created a scratch build for it here:

https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=29679293

Comment 6 Dave Airlie 2020-06-29 18:40:23 UTC
I'd did a couple of hotplug cycles, and it doesn't crash anymore, and seems to work.

One thing is I'm not sure if disconnects are being signalled/processed properly, since xrandr still shows two outputs when I unplug, but this isn't as urgent at the crashing was.

Comment 7 Jonas Ådahl 2020-06-29 18:49:45 UTC
(In reply to Dave Airlie from comment #6)
> I'd did a couple of hotplug cycles, and it doesn't crash anymore, and seems
> to work.
> 
> One thing is I'm not sure if disconnects are being signalled/processed
> properly, since xrandr still shows two outputs when I unplug, but this isn't
> as urgent at the crashing was.

What does `modetest` and the Display panel in Settings show?

The `remove` udev event should in the patch be treated as a hotplug event, where it should rediscover CRTCs, connectors etc as it is exposed by KMS.

Comment 8 Dave Airlie 2020-06-30 00:53:01 UTC
oh yes the displa(In reply to Jonas Ådahl from comment #7)
> (In reply to Dave Airlie from comment #6)
> > I'd did a couple of hotplug cycles, and it doesn't crash anymore, and seems
> > to work.
> > 
> > One thing is I'm not sure if disconnects are being signalled/processed
> > properly, since xrandr still shows two outputs when I unplug, but this isn't
> > as urgent at the crashing was.
> 
> What does `modetest` and the Display panel in Settings show?
> 
> The `remove` udev event should in the patch be treated as a hotplug event,
> where it should rediscover CRTCs, connectors etc as it is exposed by KMS.

oh it works fine there. so all good from me.

Comment 16 Jiri Koten 2020-08-24 07:30:50 UTC
I was able to reproduce the crash and verify the fix. Tested multiple hotplug cycles.

Comment 19 errata-xmlrpc 2020-11-04 01:35:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: GNOME security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4451