Received: by 10.223.185.116 with SMTP id b49csp1414752wrg; Sun, 11 Feb 2018 11:24:09 -0800 (PST) X-Google-Smtp-Source: AH8x227sqJhLsHtRL2ZtHEC+bH5ZCdC1tJWawfwHco8rSHgGzjNfCp3xzA5oHsvWAnLwyC1WUMyK X-Received: by 2002:a17:902:2e03:: with SMTP id q3-v6mr8976311plb.362.1518377049201; Sun, 11 Feb 2018 11:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518377049; cv=none; d=google.com; s=arc-20160816; b=XLgT49QKrjh63jG9Q78Gu2fbkztmOyeOlTJE5j/56StMQVWyot/qa6X6ywQFeq6jpg unv2t3vngiip/hsQqJpTzGLqJ85YqtpjnyeroF1+vtYEw4j1wmI83nxom8H0bskD6ld0 n2E7F4/qGVkzbizXNNWl2B/sVeVWaJ53/i6U9MXZ6Mlh48bo/Ik72qgBd9am5A38Ve+G PLbfxsTxxeDF80IUU3nLplm+AKEdVMxZNE/g+c35FM6vbGm3v3JCDcxgxCvgP9xY4jcA J7PKFZF3lVVndOfGJiZ/VQBC1o3NkWWwuoeJawXGFUggJNBwtiAYuW1wyJ4geJBBqJso R/Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=IIxWvXCD3UUUYRcS7W/SQ/V+EHtwZWO9tRXuBDhPWWc=; b=e6bq9vovf3h3vV6Ry+tHV08g89FepG5S69KHcsllqYJL7mX8UOrGEcWIbzeTB0shuo u8XD8AlHgJA/k9fli7ut0I6kMCVX556lmODpmk+oWH5rfHh+8JmQTdyGVhtRB1noY6ol AnfmHjZiyelv7yIPkRCSkVSSxgaQ7eXiZYszBrEV/9WpE6I0ftxCOsiIz2NfHkEJ/iM0 Vj9ZIWO81U8pXeyG07zzdwVf69gDvtd4T8bzehaISJZCcVFQxmDwh3uxQ6p9xogW+UKf ls3L+CKtc3YswdZSVrvwGY3YLN8166LopIRIi05m7w8zTPpbb/T0yqzm9po8+2gSOATk JFZA== 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 u6-v6si2121871pld.31.2018.02.11.11.23.54; Sun, 11 Feb 2018 11:24:09 -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 S932093AbeBKTXR (ORCPT + 99 others); Sun, 11 Feb 2018 14:23:17 -0500 Received: from bmailout2.hostsharing.net ([83.223.90.240]:37125 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753103AbeBKTXQ (ORCPT ); Sun, 11 Feb 2018 14:23:16 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 0C0602800B4A1; Sun, 11 Feb 2018 20:23:15 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B2C19EA2D; Sun, 11 Feb 2018 20:23:14 +0100 (CET) Date: Sun, 11 Feb 2018 20:23:14 +0100 From: Lukas Wunner To: Mike Lothian Cc: Tejun Heo , Lai Jiangshan , Alex Deucher , Dave Airlie , Ben Skeggs , Ismo Toijala , nouveau@lists.freedesktop.org, Intel Graphics Development , Liviu Dudau , Linux Kernel Mailing List , Maling list - DRI developers , Hans de Goede , Peter Wu Subject: Re: [PATCH 0/5] Fix deadlock on runtime suspend in DRM drivers Message-ID: <20180211192314.GA22869@wunner.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 11, 2018 at 06:58:11PM +0000, Mike Lothian wrote: > On 11 February 2018 at 09:38, Lukas Wunner wrote: > > The patches for radeon and amdgpu are compile-tested only, I only have a > > MacBook Pro with an Nvidia GK107 to test. To test the patches, add an > > "msleep(12*1000);" at the top of the driver's ->runtime_suspend hook. > > This ensures that the poll worker runs after ->runtime_suspend has begun. > > Wait 12 sec after the GPU has begun runtime suspend, then check > > /sys/bus/pci/devices/0000:01:00.0/power/runtime_status. Without this > > series, the status will be stuck at "suspending" and you'll get hung task > > errors in dmesg after a few minutes. > > I wasn't quite sure where to add that msleep. I've tested the patches > as is on top of agd5f's wip branch without ill effects > > I've had a radeon and now a amdgpu PRIME setup and don't believe I've > ever seen this issue > > If you could pop a patch together for the msleep I'll give it a test on > amdgpu Here you go, this is for all 3 drivers. Should deadlock without the series. Thanks! diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 50afcf6..eefa0d4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -718,6 +718,9 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev) return -EBUSY; } + printk("waiting 12 sec\n"); + msleep(12*1000); + printk("done waiting 12 sec\n"); drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; drm_kms_helper_poll_disable(drm_dev); vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF); diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 555fbe5..ee7cf0d 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -586,6 +586,7 @@ static void output_poll_execute(struct work_struct *work) repoll = true; goto out; } + dev_info(&dev->pdev->dev, "begin poll\n"); drm_connector_list_iter_begin(dev, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) { @@ -651,6 +652,7 @@ static void output_poll_execute(struct work_struct *work) if (repoll) schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); + dev_info(&dev->pdev->dev, "end poll\n"); } /** diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 3e29302..f9da5bc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -855,6 +855,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev, return -EBUSY; } + printk("waiting 12 sec\n"); + msleep(12*1000); + printk("done waiting 12 sec\n"); drm_kms_helper_poll_disable(drm_dev); vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF); nouveau_switcheroo_optimus_dsm(); diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 31dd04f..707b8aa 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -413,6 +413,9 @@ static int radeon_pmops_runtime_suspend(struct device *dev) return -EBUSY; } + printk("waiting 12 sec\n"); + msleep(12*1000); + printk("done waiting 12 sec\n"); drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; drm_kms_helper_poll_disable(drm_dev); vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);