From patchwork Wed Feb 1 20:55:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 9550877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B4E9B60236 for ; Thu, 2 Feb 2017 00:56:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F99220242 for ; Thu, 2 Feb 2017 00:56:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 946C226E49; Thu, 2 Feb 2017 00:56:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 156EF20242 for ; Thu, 2 Feb 2017 00:56:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF5EA6E90E; Thu, 2 Feb 2017 00:55:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B47C6E005; Wed, 1 Feb 2017 20:55:38 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 01 Feb 2017 12:55:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,321,1477983600"; d="log'?scan'208";a="1089807271" Received: from ray.jf.intel.com (HELO [10.7.201.138]) ([10.7.201.138]) by orsmga001.jf.intel.com with ESMTP; 01 Feb 2017 12:55:37 -0800 Subject: Re: [PATCH] drm: Don't race connector registration To: Daniel Vetter References: <20170112161721.ewtr4nng5vwy6vcs@phenom.ffwll.local> <20170125062134.wf2pbdzfei5pex52@phenom.ffwll.local> <434d041d-396d-74f7-1a37-a502a7ee4630@intel.com> <20170125153817.zk5ees7dv7azutbg@phenom.ffwll.local> <250cde2d-e97f-e5fd-b3d3-81d033cd14e5@intel.com> <20170130091226.vclqcmpjdm2m5mj6@phenom.ffwll.local> <20170131074426.vfjr5usex7jyowe3@phenom.ffwll.local> <20170201085229.qvac6dyp4dvarufe@phenom.ffwll.local> From: Dave Hansen Message-ID: <5577335d-0060-9f09-cc99-77ec089f78b8@intel.com> Date: Wed, 1 Feb 2017 12:55:37 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170201085229.qvac6dyp4dvarufe@phenom.ffwll.local> X-Mailman-Approved-At: Thu, 02 Feb 2017 00:55:19 +0000 Cc: Daniel Vetter , Daniel Vetter , Intel Graphics Development , DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 02/01/2017 12:52 AM, Daniel Vetter wrote: > On Tue, Jan 31, 2017 at 04:27:14PM -0800, Dave Hansen wrote: >> I added some printk()s all over and gathered a bit more information >> about what's going on. It looks like the display doesn't work until the >> drm connector code cleans up the *old* connector. For some reason, it >> isn't motivated to do that until I go to the console and back. >> >> In this case, the display was connected to DP-4. >> intel_dp_destroy_mst_connector() got called on it when I switched away, >> but drm_connector_cleanup() did not get called. Upon switching back >> DP-3/5/6 get created. One of these *eventually* ends up being >> "enabled", but is not now. When I switch over to the console, >> drm_connector_cleanup() finally gets called on the old connector: DP-4 >> and I can switch back to X and I see one of DP-3/5/6 enabled and working. >> >> Here are some snippets of dmesg interspersed with what I was doing: > > Ok, so the delayed deleting seems to be involved in the bug (and we only > do that since we recently introduced refcounting for hotplugged > connectors). The question is who's getting confused, either kernel or X. > To figure this out, next time things are out of sync, please compare the > output of > > $ xrandr > > with what's reported in /sys/class/drm/*/status: > > $ grep . /sys/class/drm/card0-DP-*/status OK, I collected that 4 times: 1. When everything is OK 2. When the DVI is unplugged 3. When the DVI is re-plugged (no output) 4. After I press Ctrl-Alt-F2 (back to OK) The good vs. bad diff looks like this: HDMI2 disconnected (normal left inverted right x axis y axis) @@ -41,5 +32,5 @@ /sys/class/drm/card0-DP-1/status:disconnected /sys/class/drm/card0-DP-2/status:disconnected /sys/class/drm/card0-DP-3/status:disconnected -/sys/class/drm/card0-DP-5/status:connected +/sys/class/drm/card0-DP-4/status:connected /sys/class/drm/card0-DP-6/status:disconnected But it's very interesting that when I unplug the DVI, the xrandr output does not change. Only the /sys/class/drm/.../status does. > Another question: What desktop are you using, and if you unplug a screen, > does that general reconfigure the desktop size to disable that output? The > zombie connector only sticks around as long as someone is still using it > in the screen configuration. As soon as the reconfiguration has happened, > it should go away. You can test this by manually disabling the output when > it's stuck as on: > > $ xrandr --output DP-4 --off Yep, it does the delayed cleanup. The output still shows up in xrandr (as an 8x8 display) at this point, but it can at least be turned back on. xrandr snippet: Screen 0: minimum 8 x 8, current 8 x 8, maximum 32767 x 32767 So, if I do a pair of these: xrandr --output DP-4 --off xrandr --output DP-4 --auto it does bring the display back consistently. --- xdebug.1485980540.start.log 2017-02-01 12:22:20.328242293 -0800 +++ xdebug.1485980621.dvi-replugged.log 2017-02-01 12:23:41.964241982 -0800 @@ -25,15 +25,6 @@ DP2-1 disconnected (normal left inverted right x axis y axis) DP2-2 connected primary 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm 1920x1200 60.0*+ - 1920x1080 60.0 - 1600x1200 60.0 - 1680x1050 59.9 - 1280x1024 60.0 - 1280x960 60.0 - 1024x768 60.0 - 800x600 60.3 - 640x480 59.9 - 720x400 70.1 DP2-3 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis)