Re: [PATCH] drm: fix call_kern.cocci warnings (fwd)

From: Christian KÃnig
Date: Thu Oct 25 2018 - 02:53:30 EST


Am 25.10.18 um 03:28 schrieb Zhou, David(ChunMing):
Reviewed-by: Chunming Zhou <david1.zhou@xxxxxxx>

NAK, GFP_ATOMIC should be avoided.

The correct solution is to move the allocation out of the spinlock or drop the lock and reacquire.

Christian.


-----Original Message-----
From: Julia Lawall <julia.lawall@xxxxxxx>
Sent: Thursday, October 25, 2018 2:57 AM
To: Zhou, David(ChunMing) <David1.Zhou@xxxxxxx>
Cc: kbuild-all@xxxxxx; intel-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-
devel@xxxxxxxxxxxxxxxxxxxxx; Christian KÃnig
<easy2remember.chk@xxxxxxxxxxxxxx>; Gustavo Padovan
<gustavo@xxxxxxxxxxx>; Maarten Lankhorst
<maarten.lankhorst@xxxxxxxxxxxxxxx>; Sean Paul <sean@xxxxxxxxxx>; David
Airlie <airlied@xxxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx; linux-
kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] drm: fix call_kern.cocci warnings (fwd)

The containing function is called with a spin_lock held, so GFP_KERNEL can't
be used.

julia

---------- Forwarded message ----------
Date: Tue, 23 Oct 2018 17:14:25 +0800
From: kbuild test robot <lkp@xxxxxxxxx>
To: kbuild@xxxxxx
Cc: Julia Lawall <julia.lawall@xxxxxxx>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: kbuild-all@xxxxxx
CC: intel-gfx@xxxxxxxxxxxxxxxxxxxxx
CC: dri-devel@xxxxxxxxxxxxxxxxxxxxx
TO: Chunming Zhou <david1.zhou@xxxxxxx>
CC: "Christian KÃnig" <easy2remember.chk@xxxxxxxxxxxxxx>
CC: Gustavo Padovan <gustavo@xxxxxxxxxxx>
CC: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
CC: Sean Paul <sean@xxxxxxxxxx>
CC: David Airlie <airlied@xxxxxxxx>
CC: dri-devel@xxxxxxxxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx

From: kbuild test robot <fengguang.wu@xxxxxxxxx>

drivers/gpu/drm/drm_syncobj.c:202:4-14: ERROR: function
drm_syncobj_find_signal_pt_for_point called on line 390 inside lock on line
389 but uses GFP_KERNEL

Find functions that refer to GFP_KERNEL but are called with locks held.

Semantic patch information:
The proposed change of converting the GFP_KERNEL is not necessarily the
correct one. It may be desired to unlock the lock, or to not call the function
under the lock in the first place.

Generated by: scripts/coccinelle/locks/call_kern.cocci

Fixes: 48197bc564c7 ("drm: add syncobj timeline support v9")
CC: Chunming Zhou <david1.zhou@xxxxxxx>
Signed-off-by: kbuild test robot <fengguang.wu@xxxxxxxxx>
---

tree: git://anongit.freedesktop.org/drm/drm-tip drm-tip
head: 8d7ffd2298c607c3e1a16f94d51450d7940fd6a7
commit: 48197bc564c7a1888c86024a1ba4f956e0ec2300 [1968/2033] drm: add
syncobj timeline support v9
:::::: branch date: 4 hours ago
:::::: commit date: 5 days ago

Please take the patch only if it's a positive warning. Thanks!

drm_syncobj.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -199,7 +199,7 @@ static struct dma_fence
(point <= syncobj->timeline)) {
struct drm_syncobj_stub_fence *fence =
kzalloc(sizeof(struct drm_syncobj_stub_fence),
- GFP_KERNEL);
+ GFP_ATOMIC);

if (!fence)
return NULL;