All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Add ww context to intel_dpt_pin
@ 2021-09-10  8:19 ` Maarten Lankhorst
  0 siblings, 0 replies; 10+ messages in thread
From: Maarten Lankhorst @ 2021-09-10  8:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel, Maarten Lankhorst

Ensure i915_vma_pin_iomap and vma_unpin are done with dpt->obj lock held.

I don't think there's much of a point in merging intel_dpt_pin() with
intel_pin_fb_obj_dpt(), they touch different objects.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dpt.c | 40 +++++++++++++++---------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dpt.c b/drivers/gpu/drm/i915/display/intel_dpt.c
index de62bd77b15e..edd6f1aa2626 100644
--- a/drivers/gpu/drm/i915/display/intel_dpt.c
+++ b/drivers/gpu/drm/i915/display/intel_dpt.c
@@ -121,32 +121,42 @@ struct i915_vma *intel_dpt_pin(struct i915_address_space *vm)
 	intel_wakeref_t wakeref;
 	struct i915_vma *vma;
 	void __iomem *iomem;
+	struct i915_gem_ww_ctx ww;
+	int err;
 
 	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
 	atomic_inc(&i915->gpu_error.pending_fb_pin);
 
-	vma = i915_gem_object_ggtt_pin(dpt->obj, NULL, 0, 4096,
-				       HAS_LMEM(i915) ? 0 : PIN_MAPPABLE);
-	if (IS_ERR(vma))
-		goto err;
+	for_i915_gem_ww(&ww, err, true) {
+		err = i915_gem_object_lock(dpt->obj, &ww);
+		if (err)
+			continue;
 
-	iomem = i915_vma_pin_iomap(vma);
-	i915_vma_unpin(vma);
-	if (IS_ERR(iomem)) {
-		vma = ERR_CAST(iomem);
-		goto err;
-	}
+		vma = i915_gem_object_ggtt_pin_ww(dpt->obj, &ww, NULL, 0, 4096,
+						  HAS_LMEM(i915) ? 0 : PIN_MAPPABLE);
+		if (IS_ERR(vma)) {
+			err = PTR_ERR(vma);
+			continue;
+		}
+
+		iomem = i915_vma_pin_iomap(vma);
+		i915_vma_unpin(vma);
 
-	dpt->vma = vma;
-	dpt->iomem = iomem;
+		if (IS_ERR(iomem)) {
+			err = PTR_ERR(vma);
+			continue;
+		}
 
-	i915_vma_get(vma);
+		dpt->vma = vma;
+		dpt->iomem = iomem;
+
+		i915_vma_get(vma);
+	}
 
-err:
 	atomic_dec(&i915->gpu_error.pending_fb_pin);
 	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
-	return vma;
+	return err ? ERR_PTR(err) : vma;
 }
 
 void intel_dpt_unpin(struct i915_address_space *vm)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] drm/i915: fix odd_ptr_err.cocci warnings
@ 2020-09-27  7:54 Julia Lawall
  0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2020-09-27  7:54 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

From: kernel test robot <lkp@intel.com>

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Fixes: 6b05030496f7 ("drm/i915: Convert i915_gem_object/client_blt.c to use ww locking as well, v2.")
CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   20dc779fdefc40bf7dd9736cea01704f29228fae
commit: 6b05030496f773f35f24299b1bd49dc8aa10a580 [4922/11173] drm/i915: Convert i915_gem_object/client_blt.c to use ww locking as well, v2.
:::::: branch date: 2 days ago
:::::: commit date: 3 weeks ago

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

--- a/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
@@ -364,7 +364,7 @@ int i915_gem_object_copy_blt(struct drm_

 	vma[1] = i915_vma_instance(dst, vm, NULL);
 	if (IS_ERR(vma[1]))
-		return PTR_ERR(vma);
+		return PTR_ERR(vma[1]);

 	i915_gem_ww_ctx_init(&ww, true);
 	intel_engine_pm_get(ce->engine);

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [linux-next:master 4922/11173] drivers/gpu/drm/i915/gem/i915_gem_object_blt.c:366:5-11: inconsistent IS_ERR and PTR_ERR on line 367.
@ 2020-09-27  6:30 kernel test robot
  2020-09-27  6:30 ` [PATCH] drm/i915: fix odd_ptr_err.cocci warnings kernel test robot
  0 siblings, 1 reply; 10+ messages in thread
From: kernel test robot @ 2020-09-27  6:30 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
CC: "Thomas Hellström" <thomas.hellstrom@intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   20dc779fdefc40bf7dd9736cea01704f29228fae
commit: 6b05030496f773f35f24299b1bd49dc8aa10a580 [4922/11173] drm/i915: Convert i915_gem_object/client_blt.c to use ww locking as well, v2.
:::::: branch date: 2 days ago
:::::: commit date: 3 weeks ago
config: i386-randconfig-c001-20200927 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/i915/gem/i915_gem_object_blt.c:366:5-11: inconsistent IS_ERR and PTR_ERR on line 367.

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36318 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH] drm/i915: fix odd_ptr_err.cocci warnings
@ 2020-04-01 10:22 Julia Lawall
  0 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2020-04-01 10:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

From: kbuild test robot <lkp@intel.com>

 PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

Fixes: 06f66e50fb72 ("drm/i915: Convert i915_gem_object/client_blt.c to use ww locking as well, v2.")
CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

url:    https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/Revert-drm-i915-gem-Drop-relocation-slowpath/20200401-005710
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago

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

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

--- a/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object_blt.c
@@ -368,7 +368,7 @@ int i915_gem_object_copy_blt(struct drm_

 	vma[1] = i915_vma_instance(dst, vm, NULL);
 	if (IS_ERR(vma[1]))
-		return PTR_ERR(vma);
+		return PTR_ERR(vma[1]);

 	i915_gem_ww_ctx_init(&ww, true);
 	intel_engine_pm_get(ce->engine);

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

end of thread, other threads:[~2021-09-11  1:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10  8:19 [PATCH] drm/i915: Add ww context to intel_dpt_pin Maarten Lankhorst
2021-09-10  8:19 ` [Intel-gfx] " Maarten Lankhorst
2021-09-10  9:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-09-10 11:27 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-09-11  1:14 ` [PATCH] drm/i915: fix odd_ptr_err.cocci warnings kernel test robot
2021-09-11  1:14   ` kernel test robot
2021-09-11  1:14   ` [Intel-gfx] " kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-09-27  7:54 Julia Lawall
2020-09-27  6:30 [linux-next:master 4922/11173] drivers/gpu/drm/i915/gem/i915_gem_object_blt.c:366:5-11: inconsistent IS_ERR and PTR_ERR on line 367 kernel test robot
2020-09-27  6:30 ` [PATCH] drm/i915: fix odd_ptr_err.cocci warnings kernel test robot
2020-04-01 10:22 Julia Lawall

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.