All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: avoid sleep while executing atombios table
@ 2018-05-30 10:19 Shirish S
       [not found] ` <1527675547-24093-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Shirish S @ 2018-05-30 10:19 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Harry.Wentland-5C7GfCeVMHo, Rex.Zhu-5C7GfCeVMHo
  Cc: Shirish S

This patch replaces kzalloc's flag from GFP_KERNEL to
GFP_ATOMIC to avoid sleeping in atomic context.

Signed-off-by: Shirish S <shirish.s@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index bfd98f0..da4558c 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -1221,7 +1221,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
 	ectx.abort = false;
 	ectx.last_jump = 0;
 	if (ws)
-		ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
+		ectx.ws = kzalloc(4 * ws, GFP_ATOMIC);
 	else
 		ectx.ws = NULL;
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: avoid sleep while executing atombios table
       [not found] ` <1527675547-24093-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-30 15:21   ` Deucher, Alexander
       [not found]     ` <BN6PR12MB18097D387053C065DF4E0B99F76C0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Deucher, Alexander @ 2018-05-30 15:21 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Wentland, Harry, Zhu, Rex
  Cc: S, Shirish

> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> Of Shirish S
> Sent: Wednesday, May 30, 2018 6:19 AM
> To: amd-gfx@lists.freedesktop.org; Wentland, Harry
> <Harry.Wentland@amd.com>; Zhu, Rex <Rex.Zhu@amd.com>
> Cc: S, Shirish <Shirish.S@amd.com>
> Subject: [PATCH] drm/amdgpu: avoid sleep while executing atombios table
> 
> This patch replaces kzalloc's flag from GFP_KERNEL to GFP_ATOMIC to avoid
> sleeping in atomic context.
> 
> Signed-off-by: Shirish S <shirish.s@amd.com>

Does this actually fix a bug or is it just to be safe.  Do actually call atom command tables in an atomic context?

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c
> b/drivers/gpu/drm/amd/amdgpu/atom.c
> index bfd98f0..da4558c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c
> @@ -1221,7 +1221,7 @@ static int
> amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
>  	ectx.abort = false;
>  	ectx.last_jump = 0;
>  	if (ws)
> -		ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
> +		ectx.ws = kzalloc(4 * ws, GFP_ATOMIC);
>  	else
>  		ectx.ws = NULL;
> 
> --
> 2.7.4
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: avoid sleep while executing atombios table
       [not found]     ` <BN6PR12MB18097D387053C065DF4E0B99F76C0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2018-05-31  9:54       ` S, Shirish
  0 siblings, 0 replies; 3+ messages in thread
From: S, Shirish @ 2018-05-31  9:54 UTC (permalink / raw)
  To: Deucher, Alexander, S, Shirish,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Wentland, Harry, Zhu,
	Rex



On 5/30/2018 8:51 PM, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
>> Of Shirish S
>> Sent: Wednesday, May 30, 2018 6:19 AM
>> To: amd-gfx@lists.freedesktop.org; Wentland, Harry
>> <Harry.Wentland@amd.com>; Zhu, Rex <Rex.Zhu@amd.com>
>> Cc: S, Shirish <Shirish.S@amd.com>
>> Subject: [PATCH] drm/amdgpu: avoid sleep while executing atombios table
>>
>> This patch replaces kzalloc's flag from GFP_KERNEL to GFP_ATOMIC to avoid
>> sleeping in atomic context.
>>
>> Signed-off-by: Shirish S <shirish.s@amd.com>
> Does this actually fix a bug or is it just to be safe.  Do actually call atom command tables in an atomic context?
I have re-spun V2 patch, with the stack trace so that you can see the 
path taken.

For reference below is the trace:

BUG: sleeping function called from invalid context at mm/slab.h:419
in_atomic(): 1, irqs_disabled(): 0, pid: 1137, name: DrmThread
CPU: 1 PID: 1137 Comm: DrmThread Tainted: G        W       4.14.43 #10
Call Trace:
  dump_stack+0x4d/0x63
  ___might_sleep+0x11f/0x12e
  __kmalloc+0x76/0x126
  amdgpu_atom_execute_table_locked+0xfc/0x285
  amdgpu_atom_execute_table+0x5d/0x72
  transmitter_control_v1_5+0xef/0x11a
  hwss_edp_backlight_control+0x132/0x151
  dce110_disable_stream+0x133/0x16e
  core_link_disable_stream+0x1c5/0x23b
  dce110_reset_hw_ctx_wrap+0xb4/0x1aa
  dce110_apply_ctx_to_hw+0x4e/0x6da
  ? generic_reg_get+0x1f/0x33
  dc_commit_state+0x33f/0x3d2
  amdgpu_dm_atomic_commit_tail+0x2cf/0x5d2
  ? wait_for_common+0x5b/0x69
  commit_tail+0x42/0x64
  drm_atomic_helper_commit+0xdc/0xf9
  drm_atomic_helper_set_config+0x5c/0x76
  __drm_mode_set_config_internal+0x64/0x105

I see it on Stoney when the system's display turns off while entering 
idle-suspend.

Its caused when a BUG hit in the kernel.

Thanks & Regards,
Shirish S
> Alex
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c
>> b/drivers/gpu/drm/amd/amdgpu/atom.c
>> index bfd98f0..da4558c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/atom.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c
>> @@ -1221,7 +1221,7 @@ static int
>> amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
>>   	ectx.abort = false;
>>   	ectx.last_jump = 0;
>>   	if (ws)
>> -		ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
>> +		ectx.ws = kzalloc(4 * ws, GFP_ATOMIC);
>>   	else
>>   		ectx.ws = NULL;
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-31  9:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30 10:19 [PATCH] drm/amdgpu: avoid sleep while executing atombios table Shirish S
     [not found] ` <1527675547-24093-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org>
2018-05-30 15:21   ` Deucher, Alexander
     [not found]     ` <BN6PR12MB18097D387053C065DF4E0B99F76C0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2018-05-31  9:54       ` S, Shirish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.