Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp392181ybl; Fri, 24 Jan 2020 02:20:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzBJwPynuiQhkwwHGJW7wh+ddvtohzHXpySMWHwO2U1TV8km+WBaE6C2jrUsDdphSigJYqR X-Received: by 2002:aca:dfd5:: with SMTP id w204mr1518239oig.95.1579861205730; Fri, 24 Jan 2020 02:20:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579861205; cv=none; d=google.com; s=arc-20160816; b=SWq0oZT2QbDSqPQ71/7QBF8Oh6LohByhILvWxiT2TA4Ffmp0T7gbO4x6FexPUZQ5fl qQCCL9UCY3DpsaZKJWstNKGBGV0H0C4nvTDZIP1G5TBd8czqX+pag8WJxcfI1juCpBFQ kbtfzerD9eeIyj7QlWCaRC/nn9XLgzu0f6uruZa5zUyhkJrTFaJ2vIRuAy6Ol7jiWb45 BsWLe3L8n57M8t2pKf0JQ/cisEOH+xkNB/ttkBUQZa+8Zpg542LM5hcC1rzmXmE+a1vu 0kXaJNYqV26wuApFP8kXR4tC+SAbg7WFEbQp11P7L3roYiJNnq5+2fexYKsT8jN1DF1f DlEw== 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=g0veyCUqrTy58lbkF11Bet/SvIre531kekpYNQJUe2M=; b=DoS0KbdwpHgSTBV2sjIeYkno95vyjLXmIgFVZzh7tFiqlUgOaeOSgtkoe6qKA2OkHU c4qF88dnn7EEAJOq8G8qukXv0HwtFv8Yc96R7xrT05a1UybxQPYlqRfovt4t42xBX3qM kk5t8dgyWBzX7VtubHN7iiMY961uTEDxNTeNuMJ59CvLClXwyyC54so3xwNsDBEu0ufM PYp5f5Xm5OgsvZ0Mqu4l3AmtySCZkp8XCGEn3BITlyoTUDNgNdznyfCKmWZ3Czih9G+B 6rmKF2W1Jv/J8F2l8eONE4l4DYryoQHZBlrDnAD0F3gHhtUQHSI55Op6QDo7vGSzgOkg j3Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="g9QS/q0u"; 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 u12si2177893oiv.13.2020.01.24.02.19.53; Fri, 24 Jan 2020 02:20:05 -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="g9QS/q0u"; 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 S1733027AbgAXKS5 (ORCPT + 99 others); Fri, 24 Jan 2020 05:18:57 -0500 Received: from mail-qv1-f66.google.com ([209.85.219.66]:46784 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731659AbgAXKS4 (ORCPT ); Fri, 24 Jan 2020 05:18:56 -0500 Received: by mail-qv1-f66.google.com with SMTP id u1so620560qvk.13 for ; Fri, 24 Jan 2020 02:18:55 -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=g0veyCUqrTy58lbkF11Bet/SvIre531kekpYNQJUe2M=; b=g9QS/q0utfNTJTVotzHW2LuXRhtmHrDBaZ7INqs9fp0LdVBrqNtJGfG/mw0j78osZk 6WCR6u7G6HydfuwzEIhK7mHJhRcTj3vTC87VaV5D3fy85bufhdvjOI7mhQ/6fN0Ly0W6 YK+MpRw6o8mH31CL2cPNRCo+KPxh9YiGw0UMYawRPXidLjRsFXVflE77/nQEYQnalhzr iSg2edYXGHopQ8aBLufSs9rEEkAhklydmvpak8JLgGgNwjxo1oX+96L1UwAZPp69W9I0 X+kgjFWfW3Jl0QYejYB2hEfx7jC9bfWzTdXDcogQ+DWfBfKymw/0HY65t89a8g+199u5 QkFw== 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=g0veyCUqrTy58lbkF11Bet/SvIre531kekpYNQJUe2M=; b=MSHomrIC1eFsXcCk2dxYORG1LbsgoECoxgfAY2sTHv9yr7dybsY1m2PTVKGr4iYN3Z amD0TZizv1suJva8vAJDk9qa3Wutyis8jvpdsE1hs741hcfEh/t9jBSX8sVgb7TrQkIC Y8U9fO0BPW+Co9Zm9lB9svujASo7/q3+jSSfTHTZDEWrCEtu/GF5RoHBzuKBaDwrrESN IDoWLhGUebvOdWQn5eMUgSMaW88aF4Xjk52GP5E1WcHvxDf6NI0dtS7i4GYxu/Y0CM55 fNmxMRcJRO9hHqcnGOwaCr5XI+ayLT60FHHrbvKUgbfUDjRE8AWBu3XsrooTM48RFnLM wduQ== X-Gm-Message-State: APjAAAW8G4kF+JCVE4qL4s/YWUc7LTGAmA26hzkF2jEHxVTBU0Q+M1A3 QaKwi1EDpzlTEsOTBc9hunuGbLhcTeSEZvhdghA= X-Received: by 2002:a05:6214:707:: with SMTP id b7mr1936520qvz.97.1579861135198; Fri, 24 Jan 2020 02:18:55 -0800 (PST) MIME-Version: 1.0 References: <20200104122217.148883-1-dor.askayo@gmail.com> In-Reply-To: From: Dor Askayo Date: Fri, 24 Jan 2020 12:18:43 +0200 Message-ID: Subject: Re: [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alex Deucher , David Airlie , Daniel Vetter Cc: Harry Wentland , Leo Li , =?UTF-8?Q?Christian_K=C3=B6nig?= , "David (ChunMing) Zhou" 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 Fri, Jan 17, 2020 at 12:59 PM Dor Askayo wrote: > > On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo wrote: > > > > This allocation isn't required and can fail when resuming from suspend. > > > > Bug: https://gitlab.freedesktop.org/drm/amd/issues/1009 > > Signed-off-by: Dor Askayo > > --- > > drivers/gpu/drm/amd/display/dc/core/dc.c | 17 +++++++++-------- > > 1 file changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c > > index dd4731ab935c..83ebb716166b 100644 > > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c > > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c > > @@ -2179,12 +2179,7 @@ void dc_set_power_state( > > enum dc_acpi_cm_power_state power_state) > > { > > struct kref refcount; > > - struct display_mode_lib *dml = kzalloc(sizeof(struct display_mode_lib), > > - GFP_KERNEL); > > - > > - ASSERT(dml); > > - if (!dml) > > - return; > > + struct display_mode_lib *dml; > > > > switch (power_state) { > > case DC_ACPI_CM_POWER_STATE_D0: > > @@ -2206,6 +2201,12 @@ void dc_set_power_state( > > * clean state, and dc hw programming optimizations will not > > * cause any trouble. > > */ > > + dml = kzalloc(sizeof(struct display_mode_lib), > > + GFP_KERNEL); > > + > > + ASSERT(dml); > > + if (!dml) > > + return; > > > > /* Preserve refcount */ > > refcount = dc->current_state->refcount; > > @@ -2219,10 +2220,10 @@ void dc_set_power_state( > > dc->current_state->refcount = refcount; > > dc->current_state->bw_ctx.dml = *dml; > > > > + kfree(dml); > > + > > break; > > } > > - > > - kfree(dml); > > } > > > > void dc_resume(struct dc *dc) > > -- > > 2.24.1 > > > > I've been running with this fix applied on top of Fedora's > 5.3.16-300.fc31.x86_64 kernel for the past two weeks, suspending > and resuming often. This the first time since I bought my RX 580 8GB > more than a year ago that I can suspend and resume reliably. > > I'd appreciate a quick review for the above, it really is a trivial change. > > Thanks, > Dor Bumping this up again. I've been running with this change for the past 20 days without issues. Thanks, Dor On Fri, Jan 17, 2020 at 12:59 PM Dor Askayo wrote: > > On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo wrote: > > > > This allocation isn't required and can fail when resuming from suspend. > > > > Bug: https://gitlab.freedesktop.org/drm/amd/issues/1009 > > Signed-off-by: Dor Askayo > > --- > > drivers/gpu/drm/amd/display/dc/core/dc.c | 17 +++++++++-------- > > 1 file changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c > > index dd4731ab935c..83ebb716166b 100644 > > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c > > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c > > @@ -2179,12 +2179,7 @@ void dc_set_power_state( > > enum dc_acpi_cm_power_state power_state) > > { > > struct kref refcount; > > - struct display_mode_lib *dml = kzalloc(sizeof(struct display_mode_lib), > > - GFP_KERNEL); > > - > > - ASSERT(dml); > > - if (!dml) > > - return; > > + struct display_mode_lib *dml; > > > > switch (power_state) { > > case DC_ACPI_CM_POWER_STATE_D0: > > @@ -2206,6 +2201,12 @@ void dc_set_power_state( > > * clean state, and dc hw programming optimizations will not > > * cause any trouble. > > */ > > + dml = kzalloc(sizeof(struct display_mode_lib), > > + GFP_KERNEL); > > + > > + ASSERT(dml); > > + if (!dml) > > + return; > > > > /* Preserve refcount */ > > refcount = dc->current_state->refcount; > > @@ -2219,10 +2220,10 @@ void dc_set_power_state( > > dc->current_state->refcount = refcount; > > dc->current_state->bw_ctx.dml = *dml; > > > > + kfree(dml); > > + > > break; > > } > > - > > - kfree(dml); > > } > > > > void dc_resume(struct dc *dc) > > -- > > 2.24.1 > > > > I've been running with this fix applied on top of Fedora's > 5.3.16-300.fc31.x86_64 kernel for > the past two weeks, suspending and resuming often. This the first time > since I bought my > RX 580 8GB more than a year ago that I can suspend and resume reliably. > > I'd appreciate a quick review for the above, it really is a trivial change. > > Thanks, > Dor