diff mbox

[2/3] drm/i915: Special case kernel_context switch request

Message ID 20180522145152.1342-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson May 22, 2018, 2:51 p.m. UTC
From: Mika Kuoppala <mika.kuoppala@intel.com>

When checking if engine is idling on a kernel context,
the last request emitted to it could have been the exact
request to switch into kernel context.

Do not bail out early even if engine has requests,
if the last request was for kernel context.

Fixes: a89d1f921c15 ("drm/i915: Split i915_gem_timeline into individual timelines")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

kernel test robot May 24, 2018, 2:16 p.m. UTC | #1
Hi Mika,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20180517]
[cannot apply to drm-intel/for-linux-next v4.17-rc6 v4.17-rc5 v4.17-rc4 v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Prepare-GEM-for-suspend-earlier/20180524-214128
config: x86_64-randconfig-x015-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/i915/i915_gem_context.c: In function 'engine_has_idle_kernel_context':
>> drivers/gpu//drm/i915/i915_gem_context.c:608:15: error: 'struct i915_request' has no member named 'gem_context'
      if (rq && rq->gem_context != engine->i915->kernel_context)
                  ^~

vim +608 drivers/gpu//drm/i915/i915_gem_context.c

   596	
   597	static bool engine_has_idle_kernel_context(struct intel_engine_cs *engine)
   598	{
   599		struct list_head * const active_rings = &engine->i915->gt.active_rings;
   600		struct intel_ring *ring;
   601	
   602		lockdep_assert_held(&engine->i915->drm.struct_mutex);
   603	
   604		list_for_each_entry(ring, active_rings, active_link) {
   605			struct i915_request *rq =
   606				last_request_on_engine(ring->timeline, engine);
   607	
 > 608			if (rq && rq->gem_context != engine->i915->kernel_context)
   609				return false;
   610		}
   611	
   612		return intel_engine_has_kernel_context(engine);
   613	}
   614	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 24, 2018, 2:22 p.m. UTC | #2
Hi Mika,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20180517]
[cannot apply to drm-intel/for-linux-next v4.17-rc6 v4.17-rc5 v4.17-rc4 v4.17-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Prepare-GEM-for-suspend-earlier/20180524-214128
config: i386-randconfig-x071-201820 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/bitops.h:16:0,
                    from include/linux/bitops.h:38,
                    from include/linux/log2.h:16,
                    from drivers/gpu//drm/i915/i915_gem_context.c:88:
   drivers/gpu//drm/i915/i915_gem_context.c: In function 'engine_has_idle_kernel_context':
   drivers/gpu//drm/i915/i915_gem_context.c:608:15: error: 'struct i915_request' has no member named 'gem_context'
      if (rq && rq->gem_context != engine->i915->kernel_context)
                  ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/gpu//drm/i915/i915_gem_context.c:608:3: note: in expansion of macro 'if'
      if (rq && rq->gem_context != engine->i915->kernel_context)
      ^~
   drivers/gpu//drm/i915/i915_gem_context.c:608:15: error: 'struct i915_request' has no member named 'gem_context'
      if (rq && rq->gem_context != engine->i915->kernel_context)
                  ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/gpu//drm/i915/i915_gem_context.c:608:3: note: in expansion of macro 'if'
      if (rq && rq->gem_context != engine->i915->kernel_context)
      ^~
   drivers/gpu//drm/i915/i915_gem_context.c:608:15: error: 'struct i915_request' has no member named 'gem_context'
      if (rq && rq->gem_context != engine->i915->kernel_context)
                  ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/gpu//drm/i915/i915_gem_context.c:608:3: note: in expansion of macro 'if'
      if (rq && rq->gem_context != engine->i915->kernel_context)
      ^~

vim +/if +608 drivers/gpu//drm/i915/i915_gem_context.c

   596	
   597	static bool engine_has_idle_kernel_context(struct intel_engine_cs *engine)
   598	{
   599		struct list_head * const active_rings = &engine->i915->gt.active_rings;
   600		struct intel_ring *ring;
   601	
   602		lockdep_assert_held(&engine->i915->drm.struct_mutex);
   603	
   604		list_for_each_entry(ring, active_rings, active_link) {
   605			struct i915_request *rq =
   606				last_request_on_engine(ring->timeline, engine);
   607	
 > 608			if (rq && rq->gem_context != engine->i915->kernel_context)
   609				return false;
   610		}
   611	
   612		return intel_engine_has_kernel_context(engine);
   613	}
   614	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index b69b18ef8120..3fe1212b0f7e 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -595,7 +595,10 @@  static bool engine_has_idle_kernel_context(struct intel_engine_cs *engine)
 	lockdep_assert_held(&engine->i915->drm.struct_mutex);
 
 	list_for_each_entry(ring, active_rings, active_link) {
-		if (last_request_on_engine(ring->timeline, engine))
+		struct i915_request *rq =
+			last_request_on_engine(ring->timeline, engine);
+
+		if (rq && rq->gem_context != engine->i915->kernel_context)
 			return false;
 	}