Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1198808imj; Sat, 16 Feb 2019 23:57:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IYrpmNMorPKEvthbKYrbPdh8batCoGY3HZWbC9J44GOhZzRzKne687uEVPyhUqPIASvBOzI X-Received: by 2002:a17:902:b097:: with SMTP id p23mr17804916plr.36.1550390232698; Sat, 16 Feb 2019 23:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550390232; cv=none; d=google.com; s=arc-20160816; b=RDaZF3qY0+i32hrWAwW1dQ3eIBVh04KiMDmBZkgdizE7mFxxVIFbBu5rd7YevZIwew sesU56+gWlRZ145FE1V0bxmhvEuYzFYXdaHHHA32eYMwf5aP4x4btyyUpsYL9EAhMg77 Ik8W9Tp24P86Gl4QBgCf/5D+gx1F947DtiDIZvTFQBXkMd09KVKGjESGEm8TcrLMu/CX VTz9nbJKyjLkpmka9bZ4LYbMYyQ0aVz7UnIEk67vrWBxBiNSm75mozXUerOLpi8+YSES 4/33EpqT72lEacKKsdGXEZT0X3f7HkTD5qojZqwphVUomwC5smSg7zvfTRHALUxXFen7 xzOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=j3vihQgKqfgjXdWkIV1rQ1oSJIgvuAd1lUf0NOIzM6U=; b=cd2AxyqIak5nWSRSWUzGQYoJOm9naXwKnPY5qWkeSIlR/u2VZ8vWVWuPdBan58ka7b wZmyXAFa2IDCSUnCLmknhKLKl/aA5L2h1gaNXOxGYSpveCVafAs2BLBEeTY9wo1w3rw+ g1mQIWu/UfxB/whIH+dxsnK/VBS9SzTEg7wrQQbtQdwHHH6IXH8cVgDPVKlFX+wS12tP Gh717ottSEMjnoG2oKFJCTx7wkSeNqm7c59CXZkUf1Rd9Fvh4lz+B5uukYB5s189YAI1 Z/Lx3bGyY17rl+BR+GrvKPLRADj+7+yV6VoYF7jM7VgNQ9xXid66TUpc7RJ7p4Mr21td c6jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l1u2uNgu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e192si9816236pfc.28.2019.02.16.23.56.56; Sat, 16 Feb 2019 23:57:12 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l1u2uNgu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727711AbfBPXha (ORCPT + 99 others); Sat, 16 Feb 2019 18:37:30 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:32825 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727284AbfBPXha (ORCPT ); Sat, 16 Feb 2019 18:37:30 -0500 Received: by mail-wm1-f68.google.com with SMTP id h22so9341209wmb.0; Sat, 16 Feb 2019 15:37:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j3vihQgKqfgjXdWkIV1rQ1oSJIgvuAd1lUf0NOIzM6U=; b=l1u2uNgutoFuX/iuAtplf9sjKqfc1oxyWb6GdKO2CpLqqjwY7U3x3xht8U+AHokdur 5sfNWzncQQmGiTpv60NllLzbtHQ3PiaTnAqqaLEqKajgamuRE3MugkLSgF+GNBmZQ3Ux XOmqeLsZT+bjaE2aaCQqzTzZFKfdoCdAd8hs4o+J6Ut1g/gMgyn0rIiqjn/OJov9Fcz4 v8qICK6Aw3Ktv1XYX4bYbomVd70+7l2stRE0r45DVzVr1O8NUNPUK37WRNfc/PMvcyun Lgo0ImmLjB5rHOW4bo92k++g3pQySOmMF+RCW9KMUlJV3cQfMV4PBliq6j0s9v+ip0pa eGYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j3vihQgKqfgjXdWkIV1rQ1oSJIgvuAd1lUf0NOIzM6U=; b=fjPvEk73hXFcHQrlB7uAPxgt1cvZvBrynlQXTHK8LfP7N3PwsAvG++MOaICqhPEJ4t +2Im7B43w4GWXMTS1X1eKG2yT1WBkZL9B4R2gSHmksjYSZj+MCRP4csjZUFMLxiw+qXw FqUO77ZPBOk0sM5Ug7Av44jalU4EGn6yVpv2h1p9uz4goGLNlGXURno/gOhIsI3b3itf zLG2M8KPUzxzraNYxsG+1kfjrIRbStb3oI7x/4QK/QePdHbCExOHSnJzDfjJyINaciBi XVY0nN6aXEnarN4FEa5uDjWDGIHYx8sZacBKy1Fl2RuMEVjRtWO8W42DcIbgTTgEUqZi xSIg== X-Gm-Message-State: AHQUAua1VzhyuL/UJvK1I8jWH9iAwQepZhlXj0qixGQat6mNwJCfD2nh 7NrIi65ZnPiPDmFUxLx5MP9fz1Yhwd2fvNMLVBA= X-Received: by 2002:a1c:f701:: with SMTP id v1mr10629504wmh.153.1550360247027; Sat, 16 Feb 2019 15:37:27 -0800 (PST) MIME-Version: 1.0 References: <2281684.8tZHfIXjiu@aspire.rjw.lan> <20190216060058.gsiddsmj3f27e6v7@wunner.de> In-Reply-To: <20190216060058.gsiddsmj3f27e6v7@wunner.de> From: Alex Deucher Date: Sat, 16 Feb 2019 18:37:13 -0500 Message-ID: Subject: Re: [PATCH] gpu: drm: radeon: Set DPM_FLAG_NEVER_SKIP when enabling PM-runtime To: Lukas Wunner Cc: "Rafael J. Wysocki" , Alex Deucher , David Zhou , Linux PM , LKML , amd-gfx list , "?????????????? ????????????????" , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 16, 2019 at 1:01 AM Lukas Wunner wrote: > > On Fri, Feb 15, 2019 at 11:01:04AM -0500, Alex Deucher wrote: > > On Fri, Feb 15, 2019 at 10:39 AM Rafael J. Wysocki wrote: > > > On HP ProBook 4540s, if PM-runtime is enabled in the radeon driver > > > and the direct-complete optimization is used for the radeon device > > > during system-wide suspend, the system doesn't resume. > > > > > > Preventing direct-complete from being used with the radeon device by > > > setting the DPM_FLAG_NEVER_SKIP driver flag for it makes the problem > > > go away, which indicates that direct-complete is not safe for the > > > radeon driver in general and should not be used with it (at least > > > for now). > > > > > > This fixes a regression introduced by commit c62ec4610c40 > > > ("PM / core: Fix direct_complete handling for devices with no > > > callbacks") which allowed direct-complete to be applied to > > > devices without PM callbacks (again) which in turn unlocked > > > direct-complete for radeon on HP ProBook 4540s. > > > > Do other similar drivers like amdgpu and nouveau need the same fix? > > I'm not too familiar with the direct_complete feature in general. > > direct_complete means that a discrete GPU which is in D3cold upon > entering system sleep is left as is, i.e. it is not woken. It is > also expected to still be in D3cold when resuming from system sleep > from the PM core's point of view. (If it is in D0uninitialized, the > GPU's driver needs to ensure it is transitioned to D3cold again.) > > I know for a fact that resuming the discrete GPU is not necessary > on my MacBook Pro with Nvidia GPU. I'd expect those with AMD GPUs > to behave the same. The apple-gmux driver takes care of putting > the GPU into D3cold on resume from system sleep if it was in D3cold > when entering system sleep (see drivers/platform/x86/apple-gmux.c, > gmux_resume()). > > I think it is desirable to use direct_complete because it saves power > (no need to gratuitously wake the GPU upon entering system sleep, > only to immediately cut its power) and it also speeds up the suspend > process by about half a second. Thanks for the info. It sounds like we need a similar patch for amdgpu. With dGPUs controlled by the ACPI ATPX method, I believe the dGPU is powered by automatically on resume from S3/S4. I think there may be a way to change that behavior in some revisions of ATPX (i.e., to keep the state across suspend cycles), but it's not the default. I'm not sure about the newer _PR3 stuff in Hybrid Graphics laptops. I think it retains state. In both radeon and amdgpu we probably need to check if the system is using ATPX or _PR3 and disable direct complete for ATPX at least. Alex > > The root cause on the HP ProBook 4540s needs to be debugged, I'd > suspect a BIOS issue which could be adressed by a quirk, either for > this particular machine or for a certain class of devices (e.g. all > machines which use PR3 to transition to D3cold) if that is necessary > to behave identically to Windows. Or maybe the atpx vga_switcheroo > handler needs to be amended to put the GPU into D3cold on resume from > system sleep if it was runtime suspended before. > > Is this machine using s2idle or does it suspend to S3? > > Thanks, > > Lukas > > > > Fixes: c62ec4610c40 ("PM / core: Fix direct_complete handling for devices with no callbacks") > > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=201519 > > > Reported-by: ?????????????? ???????????????? > > > Tested-by: ?????????????? ???????????????? > > > Signed-off-by: Rafael J. Wysocki > > > --- > > > drivers/gpu/drm/radeon/radeon_kms.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > Index: linux-pm/drivers/gpu/drm/radeon/radeon_kms.c > > > =================================================================== > > > --- linux-pm.orig/drivers/gpu/drm/radeon/radeon_kms.c > > > +++ linux-pm/drivers/gpu/drm/radeon/radeon_kms.c > > > @@ -172,6 +172,7 @@ int radeon_driver_load_kms(struct drm_de > > > } > > > > > > if (radeon_is_px(dev)) { > > > + dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NEVER_SKIP); > > > pm_runtime_use_autosuspend(dev->dev); > > > pm_runtime_set_autosuspend_delay(dev->dev, 5000); > > > pm_runtime_set_active(dev->dev);