Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8893697ybl; Fri, 17 Jan 2020 03:01:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwp9GWFYc2FW8HwDdtQuywa1ysj2+pNTJ2+ZD7fqa4//o1iX19MmAQjNd0fkOjvv7V5jQjH X-Received: by 2002:a9d:65da:: with SMTP id z26mr5609561oth.197.1579258861111; Fri, 17 Jan 2020 03:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579258861; cv=none; d=google.com; s=arc-20160816; b=T+VqTacYox+VbxPHuL0C+vsTiwZZV5iTJrhzU20QotmyN5eUZCR1MJ9pgynAiK1P7k 3Z5JZ8DjG4QLloo0l0/cderxAhEYbx2KY0GKu31a4g3szHWz+lH00U0HmtzfxAMhNy5F V6w+ZRpf1lwcUxzBLaxxeyeyd0Xn4T++hT2uBjV64OMWSTlnJcMj00CQFFbXdZbJKLq9 11D39Of2JYudS02Q5WRTSmjFGogjHzUOpT20Bhu1GDvLcHvO0P6FrRg9l8MDPx8JYpx3 rF55sQvPF0qL3yZv0BYXNj5484xZoUYLw59wpj4Zjp4Sso59e7UUlA73Tk1Yg/+dy+2v WCQg== 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=b1W+1tNt7mzVWLiRP9zTR54IrHdo1Wi4KI2T1N1KRn4=; b=XWEYAvD9/xAJ/Snss56FNlMPBcme2ed5CrfXhpDrBT8Rj4Fi+oTv42MyLwxBLtlmnB OHPF+JlKqHZcU+TuEJsic1wjDEF4mLpp2uGccRAFHIdY/J712DZlTEoGC55ggg87w66z 0gUpq4fGpQNzJxRM+a3ok8h8U5fSAGpJj8RZ4FKJwMSFDym/WhP/gOH89K5w49lG67C5 ezVm3e+X68S0Hca+JnC9yN3kQyUOd7O1DiRkIkHobuy5rDjKDLKIfU7YCcIe8N7luAHt PwwlbukM6UnIurYVPKwG6mz4yNtQMYXbXZ4iv/773hbjQkzFP6mLLP+J6Z/wuUUfYQVL p06g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SYiiJAtI; 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 g1si14759609otj.115.2020.01.17.03.00.48; Fri, 17 Jan 2020 03:01:01 -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=SYiiJAtI; 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 S1726979AbgAQK7v (ORCPT + 99 others); Fri, 17 Jan 2020 05:59:51 -0500 Received: from mail-io1-f65.google.com ([209.85.166.65]:43049 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgAQK7v (ORCPT ); Fri, 17 Jan 2020 05:59:51 -0500 Received: by mail-io1-f65.google.com with SMTP id n21so25500279ioo.10 for ; Fri, 17 Jan 2020 02:59:50 -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=b1W+1tNt7mzVWLiRP9zTR54IrHdo1Wi4KI2T1N1KRn4=; b=SYiiJAtI6qekuwlu7bpgNew9pgGNZCZJUy4S3w9CfPWXyCM+0ZalBOBDT+O2A6CJfd 3WnYFeoni3+tmsT8p1DnvGoDACfbwksQsP6qlkOVcFsTVzWGD/2xLns96iAsXQH4XjHG EjnyFqcFcSJ8w47Ml7pEmu+OhuoWIHYDZbGcUyMEJpcewLzF7sxoTDh+6EG0ML8oBLAF nMzKTg6A3fG0DQ9HU4cR74pAX9zob/xtno1yIiI5xGYtwpmOhKbreKkUy4NeZdSdi+CF v6Q2Q1qkIY89bsLZWHJjmev2ospDdRLecLTsPDbtjVa6yBOlPQIHjAK2nTfLljIxaxrX VGVQ== 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=b1W+1tNt7mzVWLiRP9zTR54IrHdo1Wi4KI2T1N1KRn4=; b=pbQIEx/DF7fRSB6woeY4LrKieBMPgGRkR6Qy7TEhCuEU5T2vpSt0BYFuqCxaZpyDE6 T0nbyMm5ndsh3l/Na1rBMJII2NeH5n7mSlBddyaSn8vGH5uLfqjUzBa0hk1kbTDy9pqQ nXOtdktiwqlPwlh3bRI+c6n7gNyEyAiZlGSwZ9hMa2IJda/q1ca+eWXRyrf87OMWvHAj 2SgRcgMebcq9x7hExgIMq5Th+eF/JLnNoivltoaeMH59hhFbEce038ZZYv+naNtzYVuM tBtBHlxHDoQgu6QwtlmfV9+grVSsmaTrWO4VWM3w7cvyXeCqhnJDzQvHI4YlY7RnXuA0 KWZQ== X-Gm-Message-State: APjAAAWqfK/kXuSI8K6lg1hjZX6yRDEnikNTQQVp3z+wOesnu/lphkha tJtSpSJFnPlmkgqosgXHCqtqSZpJTo2wx+ftTO8= X-Received: by 2002:a5d:9f05:: with SMTP id q5mr30837264iot.199.1579258790129; Fri, 17 Jan 2020 02:59:50 -0800 (PST) MIME-Version: 1.0 References: <20200104122217.148883-1-dor.askayo@gmail.com> In-Reply-To: <20200104122217.148883-1-dor.askayo@gmail.com> From: Dor Askayo Date: Fri, 17 Jan 2020 12:59:39 +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 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