Skip to contentSkip to conversation

drm/amdgpu: avoid sleep while executing atombios table

PATCH In review Shirish S 3 participants 3 messages May 30, 2018 – May 31, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
index bfd98f0..da4558c 100644
@@ -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;
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1527675547-24093-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Shirish S
Sent: Wednesday, May 30, 2018 6:19 AM
To: [email protected]; Wentland, Harry <[email protected]>; Zhu, Rex <[email protected]>
Cc: S, Shirish <[email protected]>
Subject: [PATCH] drm/amdgpu: avoid sleep while executing atombios table

Quoted 4 lines

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

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

Alex

Quoted 22 lines
---
 drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -2
index bfd98f0..da4558c 100644
@@ -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

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB18097D387053C065DF4E0B99F76C0-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw
Quoted 9 lines · Alexander
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Shirish S
Sent: Wednesday, May 30, 2018 6:19 AM
To: [email protected]; Wentland, Harry <[email protected]>; Zhu, Rex <[email protected]>
Cc: S, Shirish <[email protected]>
Subject: [PATCH] drm/amdgpu: avoid sleep while executing atombios table

Quoted 5 lines
Quoted 4 lines

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

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

Quoted 28 lines

Alex

Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/atom.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -2
index bfd98f0..da4558c 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Signature · 7 lines
Regards,
Shirish S

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx