Skip to contentSkip to conversation

drm: fix call_kern.cocci warnings (fwd)

PATCH NAK Julia Lawall 7 participants 11 messages Oct 24, 2018 – Oct 25, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Chunming Zhou <[email protected]>
CC: "Christian König" <[email protected]>
CC: Gustavo Padovan <[email protected]>
CC: Maarten Lankhorst <[email protected]>
CC: Sean Paul <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]

From: kbuild test robot <[email protected]>

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 <[email protected]>

---

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(-)
drivers/gpu/drm/drm_syncobj.c +1 -1
@@ -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;

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

#1 lore raw

✗ Fi.CI.CHECKPATCH: warning for drm: fix call_kern.cocci warnings (fwd)

== Series Details ==

== Series Details ==

Series: drm: fix call_kern.cocci warnings (fwd)
URL : https://patchwork.freedesktop.org/series/51481/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
fd425f4226a8 drm: fix call_kern.cocci warnings (fwd)
-:30: WARNING:BAD_SIGN_OFF: Duplicate signature
#30: 
CC: [email protected]

total: 0 errors, 1 warnings, 0 checks, 8 lines checked

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

#2 lore raw

✓ Fi.CI.BAT: success for drm: fix call_kern.cocci warnings (fwd)

In reply to Julia Lawall
== Series Details ==

== Series Details ==

Series: drm: fix call_kern.cocci warnings (fwd)
URL : https://patchwork.freedesktop.org/series/51481/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5030 -> Patchwork_10567 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/51481/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_10567 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362, fdo#103191)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       DMESG-WARN (fdo#102614) -> PASS

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b-frame-sequence:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS

fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718

== Participating hosts (47 -> 42) ==

Missing (5): fi-kbl-soraka fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600

== Build changes ==

* Linux: CI_DRM_5030 -> Patchwork_10567

CI_DRM_5030: 65e711c22c1a1e1a8167db501ebe8385119f9e5b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4691: d445be01f5edc7e7a324444c73e221c9ed75602e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10567: fd425f4226a832af3e63001390ca48ef6eeebae9 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

fd425f4226a8 drm: fix call_kern.cocci warnings (fwd)

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10567/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.IGT: success for drm: fix call_kern.cocci warnings (fwd)

In reply to Julia Lawall
== Series Details ==

== Series Details ==

Series: drm: fix call_kern.cocci warnings (fwd)
URL : https://patchwork.freedesktop.org/series/51481/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5030_full -> Patchwork_10567_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10567_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10567_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10567_full:

=== IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS

== Known issues ==

Here are the changes found in Patchwork_10567_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_await@wide-contexts:
      shard-apl:          PASS -> FAIL (fdo#106680)

    igt@gem_exec_schedule@pi-ringfull-bsd:
      shard-glk:          NOTRUN -> FAIL (fdo#103158) +2
      shard-skl:          NOTRUN -> FAIL (fdo#103158)

    igt@kms_busy@extended-modeset-hang-newfb-render-a:
      shard-skl:          NOTRUN -> DMESG-WARN (fdo#107956) +1
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
      shard-hsw:          PASS -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-modeset-hang-oldfb-with-reset-render-d:
      shard-snb:          NOTRUN -> INCOMPLETE (fdo#105411)

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
      shard-glk:          NOTRUN -> DMESG-WARN (fdo#107956) +4

    igt@kms_color@pipe-a-degamma:
      shard-apl:          PASS -> FAIL (fdo#104782, fdo#108145)

    igt@kms_color@pipe-c-degamma:
      shard-apl:          PASS -> FAIL (fdo#104782)

    igt@kms_flip@2x-blocking-absolute-wf_vblank:
      shard-glk:          PASS -> INCOMPLETE (fdo#103359, k.org#198133)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-skl:          PASS -> FAIL (fdo#105363)

    igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-mmap-gtt:
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107469)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
      shard-apl:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen:
      shard-glk:          NOTRUN -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-pwrite:
      shard-skl:          PASS -> FAIL (fdo#105682)

    igt@kms_plane@pixel-format-pipe-a-planes:
      shard-glk:          NOTRUN -> FAIL (fdo#103166)

    igt@kms_plane@pixel-format-pipe-c-planes:
      shard-skl:          NOTRUN -> DMESG-FAIL (fdo#106885, fdo#103166)

    igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
      shard-skl:          NOTRUN -> FAIL (fdo#108145) +1

    igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
      shard-skl:          PASS -> FAIL (fdo#107815, fdo#108145)

    igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
      shard-glk:          NOTRUN -> FAIL (fdo#108146)

    igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
      shard-skl:          NOTRUN -> FAIL (fdo#107815, fdo#108145)
      shard-apl:          NOTRUN -> FAIL (fdo#108145)

    igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
      shard-glk:          NOTRUN -> FAIL (fdo#108145) +4

    igt@kms_plane_lowres@pipe-a-tiling-y:
      shard-kbl:          PASS -> DMESG-WARN (fdo#105345)

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-apl:          PASS -> FAIL (fdo#103166)

    igt@kms_sysfs_edid_timing:
      shard-skl:          NOTRUN -> FAIL (fdo#100047)

    igt@pm_backlight@fade_with_suspend:
      shard-skl:          NOTRUN -> FAIL (fdo#107847)

    igt@pm_rpm@cursor-dpms:
      shard-skl:          PASS -> INCOMPLETE (fdo#107807)

    igt@pm_rpm@system-suspend-execbuf:
      shard-skl:          PASS -> INCOMPLETE (fdo#107773, fdo#107807, fdo#104108)

    
    ==== Possible fixes ====

    igt@gem_bad_reloc@negative-reloc-blt:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-apl:          FAIL (fdo#106641) -> PASS

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
      shard-kbl:          DMESG-WARN (fdo#107956) -> PASS

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-skl:          FAIL (fdo#100368) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103158 https://bugs.freedesktop.org/show_bug.cgi?id=103158
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105345 https://bugs.freedesktop.org/show_bug.cgi?id=105345
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105682 https://bugs.freedesktop.org/show_bug.cgi?id=105682
fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
fdo#106680 https://bugs.freedesktop.org/show_bug.cgi?id=106680
fdo#106885 https://bugs.freedesktop.org/show_bug.cgi?id=106885
fdo#107469 https://bugs.freedesktop.org/show_bug.cgi?id=107469
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107815 https://bugs.freedesktop.org/show_bug.cgi?id=107815
fdo#107847 https://bugs.freedesktop.org/show_bug.cgi?id=107847
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108146 https://bugs.freedesktop.org/show_bug.cgi?id=108146
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5030 -> Patchwork_10567

CI_DRM_5030: 65e711c22c1a1e1a8167db501ebe8385119f9e5b @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4691: d445be01f5edc7e7a324444c73e221c9ed75602e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10567: fd425f4226a832af3e63001390ca48ef6eeebae9 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10567/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#4 lore raw
In reply to Julia Lawall
Quoted 72 lines

-----Original Message-----
From: Julia Lawall <[email protected]>
Sent: Thursday, October 25, 2018 2:57 AM
To: Zhou, David(ChunMing) <[email protected]>
Cc: [email protected]; [email protected]; dri- [email protected]; Christian König <[email protected]>; Gustavo Padovan <[email protected]>; Maarten Lankhorst <[email protected]>; Sean Paul <[email protected]>; David Airlie <[email protected]>; [email protected]; linux- [email protected]
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 <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Chunming Zhou <[email protected]>
CC: "Christian König" <[email protected]>
CC: Gustavo Padovan <[email protected]>
CC: Maarten Lankhorst <[email protected]>
CC: Sean Paul <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]

From: kbuild test robot <[email protected]>

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 <[email protected]>

---

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(-)

drivers/gpu/drm/drm_syncobj.c static struct dma_fence · line 205

Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +1 -1
@@ -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;

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

#5 lore raw

Am 25.10.18 um 03:28 schrieb Zhou, David(ChunMing):

Quoted 1 line

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.

Quoted 81 lines
Quoted 81 lines

-----Original Message-----
From: Julia Lawall <[email protected]>
Sent: Thursday, October 25, 2018 2:57 AM
To: Zhou, David(ChunMing) <[email protected]>
Cc: [email protected]; [email protected]; dri- [email protected]; Christian König <[email protected]>; Gustavo Padovan <[email protected]>; Maarten Lankhorst <[email protected]>; Sean Paul <[email protected]>; David Airlie <[email protected]>; [email protected]; linux- [email protected]
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 <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Chunming Zhou <[email protected]>
CC: "Christian König" <[email protected]>
CC: Gustavo Padovan <[email protected]>
CC: Maarten Lankhorst <[email protected]>
CC: Sean Paul <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]

From: kbuild test robot <[email protected]>

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 <[email protected]>

---

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(-)
drivers/gpu/drm/drm_syncobj.c +1 -1
@@ -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;
#6 lore raw

Op 25-10-18 om 08:53 schreef Christian König:

Quoted 6 lines

Am 25.10.18 um 03:28 schrieb Zhou, David(ChunMing):

Quoted 1 line

NAK, GFP_ATOMIC should be avoided.

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

Yeah +1. Especially in a case like this where it's obvious to prevent. :)

#7 lore raw

Am 25.10.18 um 09:51 schrieb Maarten Lankhorst:

Quoted 7 lines

Op 25-10-18 om 08:53 schreef Christian König:

Quoted 5 lines

Am 25.10.18 um 03:28 schrieb Zhou, David(ChunMing):

Quoted 1 line

NAK, GFP_ATOMIC should be avoided.

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

Yeah +1. Especially in a case like this where it's obvious to prevent. :)

Another possibility would to not allocate the dummy fence at all.

E.g. we just need a global instance of that which is always signaled and has a reference count of +1.

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

#8 lore raw

will send a fix soon.

Thanks,

David

Quoted 6 lines · Christian

Am 25.10.18 um 09:51 schrieb Maarten Lankhorst:

Quoted 5 lines

Op 25-10-18 om 08:53 schreef Christian König:

Quoted 4 lines

Am 25.10.18 um 03:28 schrieb Zhou, David(ChunMing):

Quoted 1 line

NAK, GFP_ATOMIC should be avoided.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

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

Yeah +1. Especially in a case like this where it's obvious to prevent. :)

Another possibility would to not allocate the dummy fence at all.

E.g. we just need a global instance of that which is always signaled and has a reference count of +1.

Christian.

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

#9 lore raw
In reply to Julia Lawall

Op 24-10-18 om 20:57 schreef Julia Lawall:

Quoted 35 lines

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 <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Chunming Zhou <[email protected]>
CC: "Christian König" <[email protected]>
CC: Gustavo Padovan <[email protected]>
CC: Maarten Lankhorst <[email protected]>
CC: Sean Paul <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]

From: kbuild test robot <[email protected]>

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.

Quoted 5 lines

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

Fixes 48197bc564c7 ("drm: add syncobj timeline support v9")
CC Chunming Zhou <[email protected]>

The issue appears to be real and the patch looks sane. Chunming Zhou, do you want to fix it like this, or preallocate a fence obj? If former, just ack. :)

~Maarten

Quoted 15 lines
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(-)

drivers/gpu/drm/drm_syncobj.c static struct dma_fence · line 205

Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +1 -1
@@ -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;

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

#10 lore raw

Am 25.10.18 um 09:50 schrieb Maarten Lankhorst:

Quoted 36 lines

Op 24-10-18 om 20:57 schreef Julia Lawall:

Quoted 35 lines

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 <[email protected]>
To: [email protected]
Cc: Julia Lawall <[email protected]>
Subject: [PATCH] drm: fix call_kern.cocci warnings

CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Chunming Zhou <[email protected]>
CC: "Christian König" <[email protected]>
CC: Gustavo Padovan <[email protected]>
CC: Maarten Lankhorst <[email protected]>
CC: Sean Paul <[email protected]>
CC: David Airlie <[email protected]>
CC: [email protected]
CC: [email protected]

From: kbuild test robot <[email protected]>

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.

Quoted 7 lines
Quoted 5 lines

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

Fixes 48197bc564c7 ("drm: add syncobj timeline support v9")
CC Chunming Zhou <[email protected]>

The issue appears to be real and the patch looks sane. Chunming Zhou, do you want to fix it like this, or preallocate a fence obj? If former, just ack. :)

Well, wait a second with that advise1

The problem here is that userspace (indirectly) controls when this allocation is made. So what you could do is to construct some code to force the kernel into doing a *lot* of GFP_ATOMIC allocations.

And when the kernel runs out of GFP_ATOMIC space, then well bad things start to happen :)

Christian.

Quoted 25 lines

~Maarten

Quoted 22 lines
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(-)
drivers/gpu/drm/drm_syncobj.c +1 -1
@@ -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;