* [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily @ 2020-01-04 12:22 Dor Askayo 2020-01-17 10:59 ` Dor Askayo 0 siblings, 1 reply; 4+ messages in thread From: Dor Askayo @ 2020-01-04 12:22 UTC (permalink / raw) To: amd-gfx, dri-devel, linux-kernel Cc: David (ChunMing) Zhou, Dor Askayo, Leo Li, David Airlie, Daniel Vetter, Alex Deucher, Harry Wentland, Christian König 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 <dor.askayo@gmail.com> --- 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 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily 2020-01-04 12:22 [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily Dor Askayo @ 2020-01-17 10:59 ` Dor Askayo 2020-01-24 10:18 ` Dor Askayo 0 siblings, 1 reply; 4+ messages in thread From: Dor Askayo @ 2020-01-17 10:59 UTC (permalink / raw) To: amd-gfx, dri-devel, linux-kernel, Alex Deucher, David Airlie, Daniel Vetter Cc: Leo Li, David (ChunMing) Zhou, Harry Wentland, Christian König On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo <dor.askayo@gmail.com> 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 <dor.askayo@gmail.com> > --- > 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 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily 2020-01-17 10:59 ` Dor Askayo @ 2020-01-24 10:18 ` Dor Askayo 2020-01-24 16:41 ` Leo 0 siblings, 1 reply; 4+ messages in thread From: Dor Askayo @ 2020-01-24 10:18 UTC (permalink / raw) To: amd-gfx, dri-devel, linux-kernel, Alex Deucher, David Airlie, Daniel Vetter Cc: Leo Li, David (ChunMing) Zhou, Harry Wentland, Christian König On Fri, Jan 17, 2020 at 12:59 PM Dor Askayo <dor.askayo@gmail.com> wrote: > > On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo <dor.askayo@gmail.com> 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 <dor.askayo@gmail.com> > > --- > > 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 <dor.askayo@gmail.com> wrote: > > On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo <dor.askayo@gmail.com> 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 <dor.askayo@gmail.com> > > --- > > 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 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily 2020-01-24 10:18 ` Dor Askayo @ 2020-01-24 16:41 ` Leo 0 siblings, 0 replies; 4+ messages in thread From: Leo @ 2020-01-24 16:41 UTC (permalink / raw) To: Dor Askayo, amd-gfx, dri-devel, linux-kernel, Alex Deucher, David Airlie, Daniel Vetter Cc: David (ChunMing) Zhou, Harry Wentland, Christian König Sorry for the delay, change LGTM. Reviewed-by: Leo Li <sunpeng.li@amd.com> , and applied. Thanks! Leo On 2020-01-24 5:18 a.m., Dor Askayo wrote: > On Fri, Jan 17, 2020 at 12:59 PM Dor Askayo <dor.askayo@gmail.com> wrote: >> >> On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo <dor.askayo@gmail.com> 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 <dor.askayo@gmail.com>>>> --- >>> 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 <dor.askayo@gmail.com> wrote: >> >> On Sat, Jan 4, 2020 at 2:23 PM Dor Askayo <dor.askayo@gmail.com> 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 <dor.askayo@gmail.com> >>> --- >>> 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 _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-25 15:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-01-04 12:22 [PATCH] drm/amd/display: do not allocate display_mode_lib unnecessarily Dor Askayo 2020-01-17 10:59 ` Dor Askayo 2020-01-24 10:18 ` Dor Askayo 2020-01-24 16:41 ` Leo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).