All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request()
@ 2020-07-06  1:20 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-07-06  1:20 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200703122221.591656-21-maarten.lankhorst@linux.intel.com>
References: <20200703122221.591656-21-maarten.lankhorst@linux.intel.com>
TO: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Hi Maarten,

I love your patch! Perhaps something to improve:

[auto build test WARNING on 7faedc4873dd257f4ed064ab4e0a28407690ea73]

url:    https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/drm-i915-Use-ww-locking-in-execbuf-submission/20200703-202504
base:    7faedc4873dd257f4ed064ab4e0a28407690ea73
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-m021-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/gpu/drm/i915/gt/intel_context.c:472 intel_context_create_request() error: uninitialized symbol 'rq'.

Old smatch warnings:
drivers/gpu/drm/i915/gem/i915_gem_object.h:130 __i915_gem_object_lock() error: we previously assumed 'ww' could be null (see line 122)

# https://github.com/0day-ci/linux/commit/bf4a02b288a7a2fb0b765163016a766e068b32da
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout bf4a02b288a7a2fb0b765163016a766e068b32da
vim +/rq +472 drivers/gpu/drm/i915/gt/intel_context.c

a9877da2d629589 Chris Wilson      2019-07-16  449  
5e2a0419ef7cb25 Chris Wilson      2019-04-26  450  struct i915_request *intel_context_create_request(struct intel_context *ce)
5e2a0419ef7cb25 Chris Wilson      2019-04-26  451  {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  452  	struct i915_gem_ww_ctx ww;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  453  	struct i915_request *rq;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  454  	int err;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  455  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  456  	i915_gem_ww_ctx_init(&ww, true);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  457  retry:
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  458  	err = intel_context_pin_ww(ce, &ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  459  	if (!err) {
5e2a0419ef7cb25 Chris Wilson      2019-04-26  460  		rq = i915_request_create(ce);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  461  		intel_context_unpin(ce);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  462  	} else if (err == -EDEADLK) {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  463  		err = i915_gem_ww_ctx_backoff(&ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  464  		if (!err)
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  465  			goto retry;
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  466  	} else {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  467  		rq = ERR_PTR(err);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  468  	}
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  469  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  470  	i915_gem_ww_ctx_fini(&ww);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  471  
2c5820855aff608 Maarten Lankhorst 2020-07-03 @472  	if (IS_ERR(rq))
2c5820855aff608 Maarten Lankhorst 2020-07-03  473  		return rq;
2c5820855aff608 Maarten Lankhorst 2020-07-03  474  
2c5820855aff608 Maarten Lankhorst 2020-07-03  475  	/*
2c5820855aff608 Maarten Lankhorst 2020-07-03  476  	 * timeline->mutex should be the inner lock, but is used as outer lock.
2c5820855aff608 Maarten Lankhorst 2020-07-03  477  	 * Hack around this to shut up lockdep in selftests..
2c5820855aff608 Maarten Lankhorst 2020-07-03  478  	 */
2c5820855aff608 Maarten Lankhorst 2020-07-03  479  	lockdep_unpin_lock(&ce->timeline->mutex, rq->cookie);
2c5820855aff608 Maarten Lankhorst 2020-07-03  480  	mutex_release(&ce->timeline->mutex.dep_map, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  481  	mutex_acquire(&ce->timeline->mutex.dep_map, SINGLE_DEPTH_NESTING, 0, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  482  	rq->cookie = lockdep_pin_lock(&ce->timeline->mutex);
2c5820855aff608 Maarten Lankhorst 2020-07-03  483  
5e2a0419ef7cb25 Chris Wilson      2019-04-26  484  	return rq;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  485  }
d8af05ff38ae7a4 Chris Wilson      2019-08-02  486  

---
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: 41957 bytes --]

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

* [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request()
  2020-07-14 11:44 [Intel-gfx] [PATCH 01/23] Revert "drm/i915/gem: Async GPU relocations only" Maarten Lankhorst
@ 2020-07-14 11:45 ` Maarten Lankhorst
  0 siblings, 0 replies; 5+ messages in thread
From: Maarten Lankhorst @ 2020-07-14 11:45 UTC (permalink / raw)
  To: intel-gfx

We want to get rid of intel_context_pin(), convert
intel_context_create_request() first. :)

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

diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
index 671081b0e4d6..61b05cd4c47a 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -449,15 +449,25 @@ int intel_context_prepare_remote_request(struct intel_context *ce,
 
 struct i915_request *intel_context_create_request(struct intel_context *ce)
 {
+	struct i915_gem_ww_ctx ww;
 	struct i915_request *rq;
 	int err;
 
-	err = intel_context_pin(ce);
-	if (unlikely(err))
-		return ERR_PTR(err);
+	i915_gem_ww_ctx_init(&ww, true);
+retry:
+	err = intel_context_pin_ww(ce, &ww);
+	if (!err) {
+		rq = i915_request_create(ce);
+		intel_context_unpin(ce);
+	} else if (err == -EDEADLK) {
+		err = i915_gem_ww_ctx_backoff(&ww);
+		if (!err)
+			goto retry;
+	} else {
+		rq = ERR_PTR(err);
+	}
 
-	rq = i915_request_create(ce);
-	intel_context_unpin(ce);
+	i915_gem_ww_ctx_fini(&ww);
 
 	if (IS_ERR(rq))
 		return rq;
-- 
2.27.0

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

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

* Re: [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request()
  2020-07-03 12:22 ` [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request() Maarten Lankhorst
@ 2020-07-07 14:35     ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-07-07 14:35 UTC (permalink / raw)
  To: kbuild

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

Hi Maarten,

url:    https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/drm-i915-Use-ww-locking-in-execbuf-submission/20200703-202504
base:    7faedc4873dd257f4ed064ab4e0a28407690ea73
config: i386-randconfig-m021-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/gpu/drm/i915/gt/intel_context.c:472 intel_context_create_request() error: uninitialized symbol 'rq'.

Old smatch warnings:
drivers/gpu/drm/i915/gem/i915_gem_object.h:130 __i915_gem_object_lock() error: we previously assumed 'ww' could be null (see line 122)

# https://github.com/0day-ci/linux/commit/bf4a02b288a7a2fb0b765163016a766e068b32da
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout bf4a02b288a7a2fb0b765163016a766e068b32da
vim +/rq +472 drivers/gpu/drm/i915/gt/intel_context.c

5e2a0419ef7cb25 Chris Wilson      2019-04-26  450  struct i915_request *intel_context_create_request(struct intel_context *ce)
5e2a0419ef7cb25 Chris Wilson      2019-04-26  451  {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  452  	struct i915_gem_ww_ctx ww;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  453  	struct i915_request *rq;
                                                                             ^^

5e2a0419ef7cb25 Chris Wilson      2019-04-26  454  	int err;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  455  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  456  	i915_gem_ww_ctx_init(&ww, true);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  457  retry:
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  458  	err = intel_context_pin_ww(ce, &ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  459  	if (!err) {
5e2a0419ef7cb25 Chris Wilson      2019-04-26  460  		rq = i915_request_create(ce);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  461  		intel_context_unpin(ce);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  462  	} else if (err == -EDEADLK) {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  463  		err = i915_gem_ww_ctx_backoff(&ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  464  		if (!err)
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  465  			goto retry;

rq = ERR_PTR(err); on this path presumably?

bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  466  	} else {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  467  		rq = ERR_PTR(err);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  468  	}
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  469  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  470  	i915_gem_ww_ctx_fini(&ww);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  471  
2c5820855aff608 Maarten Lankhorst 2020-07-03 @472  	if (IS_ERR(rq))
                                                                   ^^
2c5820855aff608 Maarten Lankhorst 2020-07-03  473  		return rq;
2c5820855aff608 Maarten Lankhorst 2020-07-03  474  
2c5820855aff608 Maarten Lankhorst 2020-07-03  475  	/*
2c5820855aff608 Maarten Lankhorst 2020-07-03  476  	 * timeline->mutex should be the inner lock, but is used as outer lock.
2c5820855aff608 Maarten Lankhorst 2020-07-03  477  	 * Hack around this to shut up lockdep in selftests..
2c5820855aff608 Maarten Lankhorst 2020-07-03  478  	 */
2c5820855aff608 Maarten Lankhorst 2020-07-03  479  	lockdep_unpin_lock(&ce->timeline->mutex, rq->cookie);
2c5820855aff608 Maarten Lankhorst 2020-07-03  480  	mutex_release(&ce->timeline->mutex.dep_map, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  481  	mutex_acquire(&ce->timeline->mutex.dep_map, SINGLE_DEPTH_NESTING, 0, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  482  	rq->cookie = lockdep_pin_lock(&ce->timeline->mutex);
2c5820855aff608 Maarten Lankhorst 2020-07-03  483  
5e2a0419ef7cb25 Chris Wilson      2019-04-26  484  	return rq;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  485  }

---
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: 41957 bytes --]

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

* Re: [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request()
@ 2020-07-07 14:35     ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-07-07 14:35 UTC (permalink / raw)
  To: kbuild-all

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

Hi Maarten,

url:    https://github.com/0day-ci/linux/commits/Maarten-Lankhorst/drm-i915-Use-ww-locking-in-execbuf-submission/20200703-202504
base:    7faedc4873dd257f4ed064ab4e0a28407690ea73
config: i386-randconfig-m021-20200701 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/gpu/drm/i915/gt/intel_context.c:472 intel_context_create_request() error: uninitialized symbol 'rq'.

Old smatch warnings:
drivers/gpu/drm/i915/gem/i915_gem_object.h:130 __i915_gem_object_lock() error: we previously assumed 'ww' could be null (see line 122)

# https://github.com/0day-ci/linux/commit/bf4a02b288a7a2fb0b765163016a766e068b32da
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout bf4a02b288a7a2fb0b765163016a766e068b32da
vim +/rq +472 drivers/gpu/drm/i915/gt/intel_context.c

5e2a0419ef7cb25 Chris Wilson      2019-04-26  450  struct i915_request *intel_context_create_request(struct intel_context *ce)
5e2a0419ef7cb25 Chris Wilson      2019-04-26  451  {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  452  	struct i915_gem_ww_ctx ww;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  453  	struct i915_request *rq;
                                                                             ^^

5e2a0419ef7cb25 Chris Wilson      2019-04-26  454  	int err;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  455  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  456  	i915_gem_ww_ctx_init(&ww, true);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  457  retry:
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  458  	err = intel_context_pin_ww(ce, &ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  459  	if (!err) {
5e2a0419ef7cb25 Chris Wilson      2019-04-26  460  		rq = i915_request_create(ce);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  461  		intel_context_unpin(ce);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  462  	} else if (err == -EDEADLK) {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  463  		err = i915_gem_ww_ctx_backoff(&ww);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  464  		if (!err)
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  465  			goto retry;

rq = ERR_PTR(err); on this path presumably?

bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  466  	} else {
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  467  		rq = ERR_PTR(err);
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  468  	}
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  469  
bf4a02b288a7a2f Maarten Lankhorst 2020-07-03  470  	i915_gem_ww_ctx_fini(&ww);
5e2a0419ef7cb25 Chris Wilson      2019-04-26  471  
2c5820855aff608 Maarten Lankhorst 2020-07-03 @472  	if (IS_ERR(rq))
                                                                   ^^
2c5820855aff608 Maarten Lankhorst 2020-07-03  473  		return rq;
2c5820855aff608 Maarten Lankhorst 2020-07-03  474  
2c5820855aff608 Maarten Lankhorst 2020-07-03  475  	/*
2c5820855aff608 Maarten Lankhorst 2020-07-03  476  	 * timeline->mutex should be the inner lock, but is used as outer lock.
2c5820855aff608 Maarten Lankhorst 2020-07-03  477  	 * Hack around this to shut up lockdep in selftests..
2c5820855aff608 Maarten Lankhorst 2020-07-03  478  	 */
2c5820855aff608 Maarten Lankhorst 2020-07-03  479  	lockdep_unpin_lock(&ce->timeline->mutex, rq->cookie);
2c5820855aff608 Maarten Lankhorst 2020-07-03  480  	mutex_release(&ce->timeline->mutex.dep_map, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  481  	mutex_acquire(&ce->timeline->mutex.dep_map, SINGLE_DEPTH_NESTING, 0, _RET_IP_);
2c5820855aff608 Maarten Lankhorst 2020-07-03  482  	rq->cookie = lockdep_pin_lock(&ce->timeline->mutex);
2c5820855aff608 Maarten Lankhorst 2020-07-03  483  
5e2a0419ef7cb25 Chris Wilson      2019-04-26  484  	return rq;
5e2a0419ef7cb25 Chris Wilson      2019-04-26  485  }

---
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: 41957 bytes --]

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

* [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request()
  2020-07-03 12:21 [Intel-gfx] [PATCH 00/23] drm/i915: Use ww locking in execbuf submission Maarten Lankhorst
@ 2020-07-03 12:22 ` Maarten Lankhorst
  2020-07-07 14:35     ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Maarten Lankhorst @ 2020-07-03 12:22 UTC (permalink / raw)
  To: intel-gfx

We want to get rid of intel_context_pin(), convert
intel_context_create_request() first. :)

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

diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c
index fe9fff5a63b1..e148e2d69ae1 100644
--- a/drivers/gpu/drm/i915/gt/intel_context.c
+++ b/drivers/gpu/drm/i915/gt/intel_context.c
@@ -449,15 +449,25 @@ int intel_context_prepare_remote_request(struct intel_context *ce,
 
 struct i915_request *intel_context_create_request(struct intel_context *ce)
 {
+	struct i915_gem_ww_ctx ww;
 	struct i915_request *rq;
 	int err;
 
-	err = intel_context_pin(ce);
-	if (unlikely(err))
-		return ERR_PTR(err);
+	i915_gem_ww_ctx_init(&ww, true);
+retry:
+	err = intel_context_pin_ww(ce, &ww);
+	if (!err) {
+		rq = i915_request_create(ce);
+		intel_context_unpin(ce);
+	} else if (err == -EDEADLK) {
+		err = i915_gem_ww_ctx_backoff(&ww);
+		if (!err)
+			goto retry;
+	} else {
+		rq = ERR_PTR(err);
+	}
 
-	rq = i915_request_create(ce);
-	intel_context_unpin(ce);
+	i915_gem_ww_ctx_fini(&ww);
 
 	if (IS_ERR(rq))
 		return rq;
-- 
2.27.0

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

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

end of thread, other threads:[~2020-07-14 11:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06  1:20 [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request() kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2020-07-14 11:44 [Intel-gfx] [PATCH 01/23] Revert "drm/i915/gem: Async GPU relocations only" Maarten Lankhorst
2020-07-14 11:45 ` [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request() Maarten Lankhorst
2020-07-03 12:21 [Intel-gfx] [PATCH 00/23] drm/i915: Use ww locking in execbuf submission Maarten Lankhorst
2020-07-03 12:22 ` [Intel-gfx] [PATCH 20/23] drm/i915: Use ww pinning for intel_context_create_request() Maarten Lankhorst
2020-07-07 14:35   ` Dan Carpenter
2020-07-07 14:35     ` Dan Carpenter

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.