[PATCH] drm/amdgpu: avoid sleep while executing atombios table

S, Shirish sshankar at amd.com
Thu May 31 09:54:12 UTC 2018



On 5/30/2018 8:51 PM, Deucher, Alexander wrote:
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
>> Of Shirish S
>> Sent: Wednesday, May 30, 2018 6:19 AM
>> To: amd-gfx at lists.freedesktop.org; Wentland, Harry
>> <Harry.Wentland at amd.com>; Zhu, Rex <Rex.Zhu at amd.com>
>> Cc: S, Shirish <Shirish.S at 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 at 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 at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
Regards,
Shirish S



More information about the amd-gfx mailing list