Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp517155imm; Mon, 4 Jun 2018 23:18:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIpLyvLpTp30MRKTS3sXiVs0N+lXfO86oX4rnqNPX9zX7JeqT3/LkZ+IZoLNtmVuPAE2mQI X-Received: by 2002:a65:4a04:: with SMTP id s4-v6mr19433139pgq.376.1528179501544; Mon, 04 Jun 2018 23:18:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528179501; cv=none; d=google.com; s=arc-20160816; b=KFpIAXBCKqV/lf5o6Lsz8uyg4nnirpnT/wR0NU93J1sMzz4mt4sujDF4uQJHv8MrDE fnVFQ7AdOvBUR0ifCwnKFTzMOcMqWDnpD4Oyp8sKWG9qdEdtWidoR0N5pfO+BvRK+/hC KWCFxucu/4ACFldNo2TB54x23pE+saRS6nDjz4Tv8Tcm/HpvHezNkRkCzK9P5OJ6PdVH 1Ue7ykLSQtiX0bZygTzeplLg51i/yBxTMTVFK69x5vnd/S3E4lEkj338NzP0mu2oAaZG unV2gFWVXtS1eA+x1IB4e6ohMAhtYQI8ym/J4ygnWewQ7G1iecPBj2wceA9BJH86Ug93 EWlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=V2GbDBrq+IjDThcUvrtyCuJW5bxbCNGCuHRtxD/NztU=; b=e4ea5fbLAsjsk2O64iMXfkD8cGvOjzjnen/o07cP2H8PzNMfFms9/q7/To1xPcAhpr HKw7Uk9zspTyMBY47csPg50lNr3rYM0ChP95Jn+IGMuOwk8HS6GFylJqsa67ykFY8t11 Oqxg1gvw6QEbwwboiCHFdFkwvXHHcnWDDg9ddwS+8FMH0cuTZVTYW9UTPLnx5wLE59i/ 211Dij2PoCjkDttClDbV908wtlSgH8o02lE2jkLp6+fCsLDQWd3p4CvcbjGkCUV1Es86 FN4mifH/rVxDHZcv0+CmDiuPHNBQJEZogrG4VCQpM3DKk741KH1ZgMEaOcRVxCAeepry yAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AHnhtra7; 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 n4-v6si2896334pga.340.2018.06.04.23.18.07; Mon, 04 Jun 2018 23:18:21 -0700 (PDT) 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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AHnhtra7; 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 S1751437AbeFEGQz (ORCPT + 99 others); Tue, 5 Jun 2018 02:16:55 -0400 Received: from mail-by2nam01on0071.outbound.protection.outlook.com ([104.47.34.71]:7414 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751619AbeFEGQu (ORCPT ); Tue, 5 Jun 2018 02:16:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V2GbDBrq+IjDThcUvrtyCuJW5bxbCNGCuHRtxD/NztU=; b=AHnhtra7KxaJjMYhhsyi2V+7JcRhCl8KHq0H9ysoJnX/epTMAeJZCnNuBPhG/cs0YWAtwccvQjMp4zwFHH4XNkiHlBeIqaCt8cUrLhh+h+LrsPL4bx9U/j4SL2hgDCazMsrmIfnLGUJkzjjlrbEkPH4jYn9O1fhcF68gvLZ/7G8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Christian.Koenig@amd.com; Received: from [IPv6:2a02:908:1257:4460:1ab8:55c1:a639:6740] (2a02:908:1257:4460:1ab8:55c1:a639:6740) by MWHPR12MB1725.namprd12.prod.outlook.com (2603:10b6:300:112::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.14; Tue, 5 Jun 2018 06:16:46 +0000 Subject: Re: [PATCH] drm/amdgpu: Grab/put runtime PM references in atomic_commit_tail() To: Lyude Paul , amd-gfx@lists.freedesktop.org Cc: Alex Deucher , "David (ChunMing) Zhou" , David Airlie , Harry Wentland , Andrey Grodzovsky , Tony Cheng , "Leo (Sunpeng) Li" , Shirish S , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20180604193509.29153-1-lyude@redhat.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <1a4e687c-f5f4-4716-0461-2b549f17fdc6@amd.com> Date: Tue, 5 Jun 2018 08:16:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180604193509.29153-1-lyude@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [2a02:908:1257:4460:1ab8:55c1:a639:6740] X-ClientProxiedBy: AM5PR0201CA0013.eurprd02.prod.outlook.com (2603:10a6:203:3d::23) To MWHPR12MB1725.namprd12.prod.outlook.com (2603:10b6:300:112::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:MWHPR12MB1725; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1725;3:bt4C4xqH9KNSp7nt28xxsUkgIyKJzTDc4caM5OwR3w7w54an5EBiKAdHoYNYo1Kt4QCy65L3DrWaJ0ccBDru42acsxLeCxeakZNLnL+atRMBIcwEl8ojW4BTqa1FslcqYnEvsj+iCb6XrRgUIOmRn0EAAsLCNNvw0ltrn76zzWNqIYW7f+LR5lrhrOWLrStsunrZCw8noZK/EUk6HJ/VRlnGoQUjFolBegu/nOfgNi3uzRoxXiu09oCw4Mnnzmrr;25:t5ovQsdcy+hGNx6o/S2B+d6TFb0OrPMg5cyloOrv0I2TcDj9XwkEaC7CrUvlPAa28JPCc4MtuxReRgNi2a3K5Md1HSr0NFPPyQmJEMSHlXTzyRWulbCw3DNft7HGenPviOtXzJwV82ZEAyT6GBf1YCLw22nhk4NhV6mDfY6w9VTb/7yjVj5PXzIJLnnPUjeEMTxWBRaPL1Ek5pTzbQhJFuAd7ZNkTFixYAX2KRTkOBnECq4iuVG3u91NhAJVW7hNTQexUDmvQAI1wVfMOgLYdnhGitLHoz24HohGqtH1kEkWpsBgC1euij+VJ6lGXNFdGFEnJUIMKu+EkFjvZnjXjA==;31:0QVp2qdVGdYWUuXhst3Jp+gAdDFRTrlVF9uJAY7gN9vYBI70QnpI72s1L+6lkbtiWKv3CRxM+rR+BLGE+ymw//Kx9+9sk4ieL7n/0eGFh+7+QB8XvEJectg3J63Y+wIBUVC/27m0S8PDB5BEc1lBEtLs126cALcwnf42csIw3bb6+vFnj9uU9C7TzAQvABXu9fggEkZDhIzOqvbqkL8U0i+sBPWvGCBSlCBXLAbInh0= X-MS-TrafficTypeDiagnostic: MWHPR12MB1725: X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1725;20:fWWh9LgsO2WzGb3g+9ltLysyjra9m8BXKFQMWMScaDTZX30d1Fd9dvzUCFfZSCbM57+8Y70t3Ani2rMWODRR+LNvuD75kt2GTHEMFUxAGWanafj7g7BE6L8olN7SFrPPk5rkv/dQTBlFr056/zek72Ef6x1TPEPQBfz5HS6okMzzYYXMDnhJIgzR2laP4iRYx0HbT4X2jxhuHyna0e8xSHaLgf0w31AJ+RH+uaEsq+E0gUgnxFauRLf6iYZXgFUHkJwtbJQalDsRQhLU23Yf5ZSsQt6ltTqv5t43ZFPxYJAHbTg/Qk72Yx8YpcUzuz2nkqhJzN0noR6Jo2WCcDt6glC7/z80bP2BLHy91CeXN4gqnm1epnf16MrYehaTgtnIW6F8fQmisHn3XvzjPfPEp6dtfpzqAsUIFC8s+nxpYIxQCLfqvuUNtKo3Lenj+BHx0V0D6M6MIUQ0v0uhNaEV9beP1CZ3WahGWUywtLeU6HCmKgTLGUpTFwi0aiPQIgOy;4:3iWfYmqkZy1xyf7rnhw2JJvOCvlXQ5Nv9ib06l62fcQw8LTSWAOeGWoWZ4E1PJHsIkcpekh8IZWqu8woYiLmj7ceTUtrIDs8/vWK/hMkCrksBQyPRGGjrSPi+lydSNMFIGGL6xg3UhMpDRzQhQ2luUOuWwYff+hKZDeTA5Z090rYWEHH4VfTqh87xvOV8AmhGbxEF+F66rGtUJPtKSsC4/Y0UUqaqjONpqPHDchlDvu0WeLbZ8sj2WZ49cSkNDVV3VunwuNOk2uiRZbPYDNc6kN4AyIp0PpTgW9Z3ZG1Mw6vR3og0QwwNp0uxaX9YiPJ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:MWHPR12MB1725;BCL:0;PCL:0;RULEID:;SRVR:MWHPR12MB1725; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(366004)(346002)(396003)(39380400002)(199004)(189003)(478600001)(65806001)(305945005)(386003)(81156014)(54906003)(6666003)(81166006)(72206003)(229853002)(6486002)(5660300001)(67846002)(65826007)(68736007)(1706002)(65956001)(186003)(105586002)(59450400001)(486006)(6246003)(16526019)(316002)(7736002)(6116002)(50466002)(58126008)(2486003)(4326008)(52146003)(8676002)(97736004)(52116002)(53936002)(36756003)(31686004)(8936002)(106356001)(25786009)(47776003)(2870700001)(52396003)(23676004)(31696002)(11346002)(2616005)(476003)(64126003)(46003)(86362001)(76176011)(2906002)(446003);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1725;H:[IPv6:2a02:908:1257:4460:1ab8:55c1:a639:6740];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxNzI1OzIzOlR6ZlpPaVpDUU5FNndpR29mOVdkNjBQeUZN?= =?utf-8?B?a1EyOFpLZmVjWmhwbjhYdFM3VTF1cTNlbGZEMHVhMkJKMGlvRG5VR29rSi9U?= =?utf-8?B?NHBUWE42NUxVL1JzYzF2YW40Q0gvc2RROVRrMGZIU3lJNjdpNEpvdXJVTUdj?= =?utf-8?B?bUIzeGVZVEozc3VlZ2pnaWV4cHlHQllTWFZSY01HZzgxWHNOcVo1VitxN3h5?= =?utf-8?B?R3JHM2tHNHJBYXRlNzZlSDZPZ25wOERMY00zZUFoYTFuZ0lMbVMvNUpkdXY0?= =?utf-8?B?a2owMk5rMHZaMThndmNjN1h0T0g3OGhlLzFXVllIWUYzMWVTVWRGajRNbmJ2?= =?utf-8?B?Mnl2K2tDWFJ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5tMpwsxWd5sd/lZVVbVIL0UTsRQ8MBKP/5GHmIcQtgoqLX+1rG6q9HWJiRW4KaTHvLa3qMTP6NWdtlH4/DlHrubrROLBjOOM5giYFgX1OST8N/MiR2ukDjJZzdj6g8I17mZgYREUieDmoFObdzaY6JxKzwlfJ5jD5z2wgHSx5diqzvTF7k1xFyHU8oQm8gviit0iH0KMtht9Xswsj6H1sRG8G X-MS-Office365-Filtering-Correlation-Id: 26e8d48e-54d4-4ece-0f41-08d5caabebde X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 06:16:46.2897 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26e8d48e-54d4-4ece-0f41-08d5caabebde X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 04.06.2018 um 21:35 schrieb Lyude Paul: > So, unfortunately I recently made the discovery that in the upstream > kernel, the only reason that amdgpu is not currently suffering from > issues with runtime PM putting the GPU into suspend while it's driving > displays is due to the fact that on most prime systems, we have sound > devices associated with the GPU that hold their own runtime PM ref for > the GPU. > > What this means however, is that in the event that there isn't any kind > of sound device active (which can easily be reproduced by building a > kernel with sound drivers disabled), the GPU will fall asleep even when > there's displays active. This appears to be in part due to the fact that > amdgpu has not actually ever relied on it's rpm_idle() function to be > the only thing keeping it running, and normally grabs it's own power > references whenever there are displays active (as can be seen with the > original pre-DC codepath in amdgpu_display_crtc_set_config() in > amdgpu_display.c). This means it's very likely that this bug was > introduced during the switch over the DC. > > So to fix this, we start grabbing runtime PM references every time we > enable a previously disabled CRTC in atomic_commit_tail(). This appears > to be the correct solution, as it matches up with what i915 does in > i915/intel_runtime_pm.c. > > The one sideaffect of this is that we ignore the variable that the > pre-DC code used to use for tracking when it needed runtime PM refs, > adev->have_disp_power_ref. This is mainly because there's no way for a > driver to tell whether or not all of it's CRTCs are enabled or disabled > when we've begun committing an atomic state, as there may be CRTC > commits happening in parallel that aren't contained within the atomic > state being committed. So, it's safer to just get/put a reference for > each CRTC being enabled or disabled in the new atomic state. > > Signed-off-by: Lyude Paul The final decision is with Harray, but at least the explanation makes perfect sense to me. Acked-by: Christian König . Harry do you want to pick that up and push it into our internal branch while Alex is on vacation or should I do that? Regards, Christian. > --- > As a note, I'm not entirely happy with this fix and I wouldn't be > surprised if I missed something while looking through amdgpu. So, please > don't hesistate to suggest a better fix :). > > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index 1dd1142246c2..361b81ef6997 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -46,6 +46,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -4211,6 +4212,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) > if (dm_old_crtc_state->stream) > remove_stream(adev, acrtc, dm_old_crtc_state->stream); > > + pm_runtime_get_noresume(dev->dev); > + > acrtc->enabled = true; > acrtc->hw_mode = new_crtc_state->mode; > crtc->hwmode = new_crtc_state->mode; > @@ -4396,6 +4399,16 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) > drm_atomic_helper_wait_for_flip_done(dev, state); > > drm_atomic_helper_cleanup_planes(dev, state); > + > + /* Finally, drop a runtime PM reference for each newly disabled CRTC, > + * so we can put the GPU into runtime suspend if we're not driving any > + * displays anymore > + */ > + pm_runtime_mark_last_busy(dev->dev); > + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { > + if (old_crtc_state->active && !new_crtc_state->active) > + pm_runtime_put_autosuspend(dev->dev); > + } > } > >