Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5019320imu; Tue, 29 Jan 2019 11:20:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN4CPYkf+BalYj9DzCqryaGSLTAt6bXCnfI0IbY6t1s48D1JOtBNmu8E8IbeNO4ZPrDt36Ur X-Received: by 2002:a63:9402:: with SMTP id m2mr23930129pge.93.1548789658404; Tue, 29 Jan 2019 11:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548789658; cv=none; d=google.com; s=arc-20160816; b=PtWY1/rMK8szGnvVGxEwkX16XDjvlbUHCRS27xaywD/a49XfnhosY81DzN6wpRcDhD ZyMKIT/+FFsBGDp/qLEiDAz2/8PLpY60rPadmaeMZEb1ZeBgT+2iAwJ2HY3D6MqycMVj XjL9Yg0bcB+Deoj4vMZ67q4go6hgSGFmU+VOp+L/PH2ofoglG/YRZxbwG83MIAbMqgAF 5mqqlRcpavzN12pgkVLaKfYIYUf0ukYXs+weBrHt3wmtl/VrveCGrMK9bDGc1l4OnOss JvRfhu/kESfeIool0bVt7ZSYW3zON+Q3iOgXD5BJLivKJfTsNtmsDsCOxjrVdnnGiT14 gngA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version; bh=T+ja59OxH++l93YUpi6bPv16FaFIEsruXUdvPe4D49w=; b=st3wa8PvsxMagrzQDkZMMCX+S+Pn7/2iZX4x8rfQQKEjNCev3+JerSyazNahBJBnuy SnWv16VZD6eHz9XELPQ68+SSBDz8/jkjoNvb0D+OMPU0JlkmSUoTmqeBl+Ebc0uxJmjs KM5RvbQSnN6n1vASQ9Ha0dMbRY0JnLPH3LsEqiIbimlMICtbuTVUGnPYgbnzFgmE7GRB +iLrD5O4ybIG3w4VnwTfn9JlyE1QPl14xcyzNLX5cJIL3CG/hgbnDt9vTGhe9LCu1K5H RlsLK/p4iO/6OJSFI79w+JKRNtydYttby0ZJPLL9kFX+1uy5BBEhnvO5TdqkaZZF7Ouq 8cpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s66si30696pgs.115.2019.01.29.11.20.43; Tue, 29 Jan 2019 11:20:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728558AbfA2TUU convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 Jan 2019 14:20:20 -0500 Received: from mail.fireflyinternet.com ([109.228.58.192]:54763 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727056AbfA2TUU (ORCPT ); Tue, 29 Jan 2019 14:20:20 -0500 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 15394971-1500050 for multiple; Tue, 29 Jan 2019 19:20:14 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Lyude Paul , intel-gfx@lists.freedesktop.org From: Chris Wilson In-Reply-To: <20190129191001.442-2-lyude@redhat.com> Cc: Todd Previte , Dave Airlie , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Imre Deak , stable@vger.kernel.org, David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20190129191001.442-1-lyude@redhat.com> <20190129191001.442-2-lyude@redhat.com> Message-ID: <154878961170.21797.2796600824480189142@skylake-alporthouse-com> User-Agent: alot/0.6 Subject: Re: [PATCH v3 1/3] drm/i915: Block fbdev HPD processing during suspend Date: Tue, 29 Jan 2019 19:20:12 +0000 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Lyude Paul (2019-01-29 19:09:59) > When resuming, we check whether or not any previously connected > MST topologies are still present and if so, attempt to resume them. If > this fails, we disable said MST topologies and fire off a hotplug event > so that userspace knows to reprobe. > > However, sending a hotplug event involves calling > drm_fb_helper_hotplug_event(), which in turn results in fbcon doing a > connector reprobe in the caller's thread - something we can't do at the > point in which i915 calls drm_dp_mst_topology_mgr_resume() since > hotplugging hasn't been fully initialized yet. > > This currently causes some rather subtle but fatal issues. For example, > on my T480s the laptop dock connected to it usually disappears during a > suspend cycle, and comes back up a short while after the system has been > resumed. This guarantees pretty much every suspend and resume cycle, > drm_dp_mst_topology_mgr_set_mst(mgr, false); will be caused and in turn, > a connector hotplug will occur. Now it's Rute Goldberg time: when the > connector hotplug occurs, i915 reprobes /all/ of the connectors, > including eDP. However, eDP probing requires that we power on the panel > VDD which in turn, grabs a wakeref to the appropriate power domain on > the GPU (on my T480s, this is the PORT_DDI_A_IO domain). This is where > things start breaking, since this all happens before > intel_power_domains_enable() is called we end up leaking the wakeref > that was acquired and never releasing it later. Come next suspend/resume > cycle, this causes us to fail to shut down the GPU properly, which > causes it not to resume properly and die a horrible complicated death. > > (as a note: this only happens when there's both an eDP panel and MST > topology connected which is removed mid-suspend. One or the other seems > to always be OK). > > We could try to fix the VDD wakeref leak, but this doesn't seem like > it's worth it at all since we aren't able to handle hotplug detection > while resuming anyway. So, let's go with a more robust solution inspired > by nouveau: block fbdev from handling hotplug events until we resume > fbdev. This allows us to still send sysfs hotplug events to be handled > later by user space while we're resuming, while also preventing us from > actually processing any hotplug events we receive until it's safe. > > This fixes the wakeref leak observed on the T480s and as such, also > fixes suspend/resume with MST topologies connected on this machine. > > Changes since v2: > * Don't call drm_fb_helper_hotplug_event() under lock, do it after lock > (Chris Wilson) > * Don't call drm_fb_helper_hotplug_event() in > intel_fbdev_output_poll_changed() under lock (Chris Wilson) > * Always set ifbdev->hpd_waiting (Chris Wilson) > > Signed-off-by: Lyude Paul > Fixes: 0e32b39ceed6 ("drm/i915: add DP 1.2 MST support (v0.7)") > Cc: Todd Previte > Cc: Dave Airlie > Cc: Jani Nikula > Cc: Joonas Lahtinen > Cc: Rodrigo Vivi > Cc: Imre Deak > Cc: intel-gfx@lists.freedesktop.org > Cc: # v3.17+ I suspect the locking is overkill, but certainly easier to reason than trying to remember all the ins and outs of fbdev with its dubious async initialisation. Reviewed-by: Chris Wilson -Chris