All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling
@ 2017-10-17 14:14 Daniel Vetter
  2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Daniel Vetter @ 2017-10-17 14:14 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter, Daniel Vetter, Dan Carpenter

One of the original patches got this right, but then in an attempt to
make the error handling more correct it got worse. Try again.

The problem here is that we clear err to 0 when mm->mn != NULL, which
will then leak the workqueue

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 4d712a4db63b..d3df780ee581 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -209,8 +209,10 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
 		return mn;
 
 	mn = i915_mmu_notifier_create(mm->mm);
-	if (IS_ERR(mn))
+	if (IS_ERR(mn)) {
 		err = PTR_ERR(mn);
+		mn = NULL;
+	}
 
 	down_write(&mm->mm->mmap_sem);
 	mutex_lock(&mm->i915->mm_lock);
-- 
2.14.1

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

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

* [PATCH v2] drm/i915: Fixup userptr mmu notifier registration error handling
  2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
@ 2017-10-17 15:09 ` Tvrtko Ursulin
  2017-10-17 15:32   ` Chris Wilson
  2017-10-18  9:07   ` Daniel Vetter
  2017-10-17 15:12 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Tvrtko Ursulin @ 2017-10-17 15:09 UTC (permalink / raw)
  To: Intel-gfx; +Cc: Dan Carpenter

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Avoid dereferencing the error pointer and also avoid returning NULL
from i915_mmu_notifier_find since the callers do not expect that.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index cdc9be799eee..e26b23171b56 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -221,15 +221,17 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
 			/* Protected by mm_lock */
 			mm->mn = fetch_and_zero(&mn);
 		}
-	} else {
-		/* someone else raced and successfully installed the mmu
-		 * notifier, we can cancel our own errors */
+	} else if (mm->mn) {
+		/*
+		 * Someone else raced and successfully installed the mmu
+		 * notifier, we can cancel our own errors.
+		 */
 		err = 0;
 	}
 	mutex_unlock(&mm->i915->mm_lock);
 	up_write(&mm->mm->mmap_sem);
 
-	if (mn) {
+	if (mn && !IS_ERR(mn)) {
 		destroy_workqueue(mn->wq);
 		kfree(mn);
 	}
-- 
2.9.5

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

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

* ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling
  2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
  2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
@ 2017-10-17 15:12 ` Patchwork
  2017-10-17 16:07 ` ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2) Patchwork
  2017-10-18  2:37 ` ✗ Fi.CI.IGT: warning " Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2017-10-17 15:12 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Fixup userptr mmu notifier registration error handling
URL   : https://patchwork.freedesktop.org/series/32136/
State : success

== Summary ==

Series 32136v1 drm/i915: Fixup userptr mmu notifier registration error handling
https://patchwork.freedesktop.org/api/1.0/series/32136/revisions/1/mbox/

Test chamelium:
        Subgroup dp-edid-read:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102672
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                fail       -> PASS       (fi-gdg-551) fdo#102618
        Subgroup basic-flip-after-cursor-varying-size:
                skip       -> PASS       (fi-hsw-4770r)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:443s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:454s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:372s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:514s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:262s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:495s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:494s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:487s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:481s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:553s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:418s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:249s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:574s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:418s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:431s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:485s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:458s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:485s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:566s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:580s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:542s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:449s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:641s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:516s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:495s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:453s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:561s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:416s

920fa3252916e0ec9da1df709744c568f621a43d drm-tip: 2017y-10m-17d-09h-45m-06s UTC integration manifest
9106dd9ce661 drm/i915: Fixup userptr mmu notifier registration error handling

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6073/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915: Fixup userptr mmu notifier registration error handling
  2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
@ 2017-10-17 15:32   ` Chris Wilson
  2017-10-18  9:07   ` Daniel Vetter
  1 sibling, 0 replies; 9+ messages in thread
From: Chris Wilson @ 2017-10-17 15:32 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx; +Cc: Dan Carpenter

Quoting Tvrtko Ursulin (2017-10-17 16:09:08)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Avoid dereferencing the error pointer and also avoid returning NULL
> from i915_mmu_notifier_find since the callers do not expect that.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_userptr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index cdc9be799eee..e26b23171b56 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -221,15 +221,17 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
>                         /* Protected by mm_lock */
>                         mm->mn = fetch_and_zero(&mn);
>                 }
> -       } else {
> -               /* someone else raced and successfully installed the mmu
> -                * notifier, we can cancel our own errors */
> +       } else if (mm->mn) {
> +               /*
> +                * Someone else raced and successfully installed the mmu
> +                * notifier, we can cancel our own errors.
> +                */
>                 err = 0;

residual else branch => err != 0 (i.e. mn is an ERR_PTR)

(Note that we could do
	if (mm->mn) {
	} else if (!IS_ERR(mn)) {
	} else {
		err = ERR_PTR(mn);
	}
just to have slightly more balanced branches; and is how I verified you
have all bases covered.)

>         }
>         mutex_unlock(&mm->i915->mm_lock);
>         up_write(&mm->mm->mmap_sem);
>  
> -       if (mn) {
> +       if (mn && !IS_ERR(mn)) {

Ok.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
  2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
  2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
  2017-10-17 15:12 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-10-17 16:07 ` Patchwork
  2017-10-18  8:26   ` Tvrtko Ursulin
  2017-10-18  2:37 ` ✗ Fi.CI.IGT: warning " Patchwork
  3 siblings, 1 reply; 9+ messages in thread
From: Patchwork @ 2017-10-17 16:07 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
URL   : https://patchwork.freedesktop.org/series/32136/
State : success

== Summary ==

Series 32136v2 drm/i915: Fixup userptr mmu notifier registration error handling
https://patchwork.freedesktop.org/api/1.0/series/32136/revisions/2/mbox/

Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                fail       -> PASS       (fi-gdg-551) fdo#102618
        Subgroup basic-flip-after-cursor-varying-size:
                skip       -> PASS       (fi-hsw-4770r)

fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:438s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:452s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:374s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:539s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:264s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:498s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:498s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:472s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:561s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:250s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:575s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:423s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:431s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:481s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:488s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:583s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:544s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:446s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:646s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:522s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:494s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:458s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:561s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:412s

920fa3252916e0ec9da1df709744c568f621a43d drm-tip: 2017y-10m-17d-09h-45m-06s UTC integration manifest
a9f219b93a01 drm/i915: Fixup userptr mmu notifier registration error handling

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6076/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✗ Fi.CI.IGT: warning for drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
  2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
                   ` (2 preceding siblings ...)
  2017-10-17 16:07 ` ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2) Patchwork
@ 2017-10-18  2:37 ` Patchwork
  3 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2017-10-18  2:37 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
URL   : https://patchwork.freedesktop.org/series/32136/
State : warning

== Summary ==

Test pm_rpm:
        Subgroup fences:
                pass       -> SKIP       (shard-hsw)
Test kms_cursor_crc:
        Subgroup cursor-256x256-onscreen:
                pass       -> SKIP       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-pri-indfb-multidraw:
                pass       -> SKIP       (shard-hsw)

shard-hsw        total:2553 pass:1436 dwarn:0   dfail:0   fail:11  skip:1106 time:9141s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6076/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
  2017-10-17 16:07 ` ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2) Patchwork
@ 2017-10-18  8:26   ` Tvrtko Ursulin
  0 siblings, 0 replies; 9+ messages in thread
From: Tvrtko Ursulin @ 2017-10-18  8:26 UTC (permalink / raw)
  To: intel-gfx, Patchwork, Tvrtko Ursulin


On 17/10/2017 17:07, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Fixup userptr mmu notifier registration error handling (rev2)
> URL   : https://patchwork.freedesktop.org/series/32136/
> State : success
> 
> == Summary ==
> 
> Series 32136v2 drm/i915: Fixup userptr mmu notifier registration error handling
> https://patchwork.freedesktop.org/api/1.0/series/32136/revisions/2/mbox/
> 
> Test kms_cursor_legacy:
>          Subgroup basic-busy-flip-before-cursor-legacy:
>                  fail       -> PASS       (fi-gdg-551) fdo#102618
>          Subgroup basic-flip-after-cursor-varying-size:
>                  skip       -> PASS       (fi-hsw-4770r)
> 
> fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
> 
> fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:438s
> fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:452s
> fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:374s
> fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:539s
> fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:264s
> fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:498s
> fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
> fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:498s
> fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:472s
> fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:561s
> fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:423s
> fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:250s
> fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:575s
> fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:423s
> fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:431s
> fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:481s
> fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:460s
> fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:488s
> fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:571s
> fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:473s
> fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:583s
> fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:544s
> fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:446s
> fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:646s
> fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:522s
> fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:494s
> fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:458s
> fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:561s
> fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:412s
> 
> 920fa3252916e0ec9da1df709744c568f621a43d drm-tip: 2017y-10m-17d-09h-45m-06s UTC integration manifest
> a9f219b93a01 drm/i915: Fixup userptr mmu notifier registration error handling

Pushed, hopefully we managed to change the lightbulb now! :)

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915: Fixup userptr mmu notifier registration error handling
  2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
  2017-10-17 15:32   ` Chris Wilson
@ 2017-10-18  9:07   ` Daniel Vetter
  2017-10-18  9:39     ` Tvrtko Ursulin
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2017-10-18  9:07 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: Intel-gfx, Dan Carpenter

On Tue, Oct 17, 2017 at 04:09:08PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Avoid dereferencing the error pointer and also avoid returning NULL
> from i915_mmu_notifier_find since the callers do not expect that.

How did my patch return a NULL value? At least I assume that's the reasonf
for your v2 ...
-Daniel

> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_userptr.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index cdc9be799eee..e26b23171b56 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -221,15 +221,17 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
>  			/* Protected by mm_lock */
>  			mm->mn = fetch_and_zero(&mn);
>  		}
> -	} else {
> -		/* someone else raced and successfully installed the mmu
> -		 * notifier, we can cancel our own errors */
> +	} else if (mm->mn) {
> +		/*
> +		 * Someone else raced and successfully installed the mmu
> +		 * notifier, we can cancel our own errors.
> +		 */
>  		err = 0;
>  	}
>  	mutex_unlock(&mm->i915->mm_lock);
>  	up_write(&mm->mm->mmap_sem);
>  
> -	if (mn) {
> +	if (mn && !IS_ERR(mn)) {
>  		destroy_workqueue(mn->wq);
>  		kfree(mn);
>  	}
> -- 
> 2.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915: Fixup userptr mmu notifier registration error handling
  2017-10-18  9:07   ` Daniel Vetter
@ 2017-10-18  9:39     ` Tvrtko Ursulin
  0 siblings, 0 replies; 9+ messages in thread
From: Tvrtko Ursulin @ 2017-10-18  9:39 UTC (permalink / raw)
  To: Daniel Vetter, Tvrtko Ursulin; +Cc: Intel-gfx, Dan Carpenter


On 18/10/2017 10:07, Daniel Vetter wrote:
> On Tue, Oct 17, 2017 at 04:09:08PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Avoid dereferencing the error pointer and also avoid returning NULL
>> from i915_mmu_notifier_find since the callers do not expect that.
> 
> How did my patch return a NULL value? At least I assume that's the reasonf
> for your v2 ...

The flow as I saw it was:

1. err = PTR_ERR
2. mn->mm == NULL
3. err = 0
4. return mm->mn

Which I okay-ed as well so a combined fail.

I pinged you on IRC and from your reply I understood you want me to send 
the patch I showed there, and don't want to bother thinking about it any 
longer.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-10-18  9:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
2017-10-17 15:09 ` [PATCH v2] " Tvrtko Ursulin
2017-10-17 15:32   ` Chris Wilson
2017-10-18  9:07   ` Daniel Vetter
2017-10-18  9:39     ` Tvrtko Ursulin
2017-10-17 15:12 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-17 16:07 ` ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2) Patchwork
2017-10-18  8:26   ` Tvrtko Ursulin
2017-10-18  2:37 ` ✗ Fi.CI.IGT: warning " Patchwork

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.