diff mbox series

[1/1] drm/i915/gt: Declare when we enabled timeslicing

Message ID 20210525140156.244831-2-tejaskumarx.surendrakumar.upadhyay@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/gt: Introduce timeslicing for userspace | expand

Commit Message

Tejas Upadhyay May 25, 2021, 2:01 p.m. UTC
Let userspace know if they can trust timeslicing by including it as part
of the I915_PARAM_HAS_SCHEDULER::I915_SCHEDULER_CAP_TIMESLICING

v2: Only declare timeslicing if we can safely preempt userspace.

Fixes: 8ee36e048c98 ("drm/i915/execlists: Minimalistic timeslicing")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_user.c | 1 +
 include/uapi/drm/i915_drm.h                 | 1 +
 2 files changed, 2 insertions(+)

Comments

kernel test robot May 25, 2021, 5:09 p.m. UTC | #1
Hi Tejas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip linus/master v5.13-rc3 next-20210525]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Tejas-Upadhyay/drm-i915-gt-Introduce-timeslicing-for-userspace/20210525-221509
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-r005-20210525 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/f2b7eecbbed425bfed1aea378181b5629bbcb34f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tejas-Upadhyay/drm-i915-gt-Introduce-timeslicing-for-userspace/20210525-221509
        git checkout f2b7eecbbed425bfed1aea378181b5629bbcb34f
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:13,
                    from include/linux/list.h:9,
                    from drivers/gpu/drm/i915/gt/intel_engine_user.c:6:
   drivers/gpu/drm/i915/gt/intel_engine_user.c: In function 'set_scheduler_caps':
>> drivers/gpu/drm/i915/gt/intel_engine_user.c:97:27: error: 'I915_ENGINE_TIMESLICE_BIT' undeclared (first use in this function); did you mean 'I915_ENGINE_HAS_TIMESLICES'?
      97 | #define MAP(x, y) { ilog2(I915_ENGINE_##x), ilog2(I915_SCHEDULER_CAP_##y) }
         |                           ^~~~~~~~~~~~
   include/linux/log2.h:158:23: note: in definition of macro 'ilog2'
     158 |  __builtin_constant_p(n) ? \
         |                       ^
   drivers/gpu/drm/i915/gt/intel_engine_user.c:101:3: note: in expansion of macro 'MAP'
     101 |   MAP(TIMESLICE_BIT, TIMESLICING),
         |   ^~~
   drivers/gpu/drm/i915/gt/intel_engine_user.c:97:27: note: each undeclared identifier is reported only once for each function it appears in
      97 | #define MAP(x, y) { ilog2(I915_ENGINE_##x), ilog2(I915_SCHEDULER_CAP_##y) }
         |                           ^~~~~~~~~~~~
   include/linux/log2.h:158:23: note: in definition of macro 'ilog2'
     158 |  __builtin_constant_p(n) ? \
         |                       ^
   drivers/gpu/drm/i915/gt/intel_engine_user.c:101:3: note: in expansion of macro 'MAP'
     101 |   MAP(TIMESLICE_BIT, TIMESLICING),
         |   ^~~


vim +97 drivers/gpu/drm/i915/gt/intel_engine_user.c

750e76b4f9f63c Chris Wilson   2019-08-06   90  
750e76b4f9f63c Chris Wilson   2019-08-06   91  static void set_scheduler_caps(struct drm_i915_private *i915)
750e76b4f9f63c Chris Wilson   2019-08-06   92  {
750e76b4f9f63c Chris Wilson   2019-08-06   93  	static const struct {
750e76b4f9f63c Chris Wilson   2019-08-06   94  		u8 engine;
750e76b4f9f63c Chris Wilson   2019-08-06   95  		u8 sched;
750e76b4f9f63c Chris Wilson   2019-08-06   96  	} map[] = {
750e76b4f9f63c Chris Wilson   2019-08-06  @97  #define MAP(x, y) { ilog2(I915_ENGINE_##x), ilog2(I915_SCHEDULER_CAP_##y) }
750e76b4f9f63c Chris Wilson   2019-08-06   98  		MAP(HAS_PREEMPTION, PREEMPTION),
750e76b4f9f63c Chris Wilson   2019-08-06   99  		MAP(HAS_SEMAPHORES, SEMAPHORES),
750e76b4f9f63c Chris Wilson   2019-08-06  100  		MAP(SUPPORTS_STATS, ENGINE_BUSY_STATS),
f2b7eecbbed425 Tejas Upadhyay 2021-05-25  101  		MAP(TIMESLICE_BIT, TIMESLICING),
750e76b4f9f63c Chris Wilson   2019-08-06  102  #undef MAP
750e76b4f9f63c Chris Wilson   2019-08-06  103  	};
750e76b4f9f63c Chris Wilson   2019-08-06  104  	struct intel_engine_cs *engine;
750e76b4f9f63c Chris Wilson   2019-08-06  105  	u32 enabled, disabled;
750e76b4f9f63c Chris Wilson   2019-08-06  106  
750e76b4f9f63c Chris Wilson   2019-08-06  107  	enabled = 0;
750e76b4f9f63c Chris Wilson   2019-08-06  108  	disabled = 0;
750e76b4f9f63c Chris Wilson   2019-08-06  109  	for_each_uabi_engine(engine, i915) { /* all engines must agree! */
750e76b4f9f63c Chris Wilson   2019-08-06  110  		int i;
750e76b4f9f63c Chris Wilson   2019-08-06  111  
750e76b4f9f63c Chris Wilson   2019-08-06  112  		if (engine->schedule)
750e76b4f9f63c Chris Wilson   2019-08-06  113  			enabled |= (I915_SCHEDULER_CAP_ENABLED |
750e76b4f9f63c Chris Wilson   2019-08-06  114  				    I915_SCHEDULER_CAP_PRIORITY);
750e76b4f9f63c Chris Wilson   2019-08-06  115  		else
750e76b4f9f63c Chris Wilson   2019-08-06  116  			disabled |= (I915_SCHEDULER_CAP_ENABLED |
750e76b4f9f63c Chris Wilson   2019-08-06  117  				     I915_SCHEDULER_CAP_PRIORITY);
750e76b4f9f63c Chris Wilson   2019-08-06  118  
750e76b4f9f63c Chris Wilson   2019-08-06  119  		for (i = 0; i < ARRAY_SIZE(map); i++) {
750e76b4f9f63c Chris Wilson   2019-08-06  120  			if (engine->flags & BIT(map[i].engine))
750e76b4f9f63c Chris Wilson   2019-08-06  121  				enabled |= BIT(map[i].sched);
750e76b4f9f63c Chris Wilson   2019-08-06  122  			else
750e76b4f9f63c Chris Wilson   2019-08-06  123  				disabled |= BIT(map[i].sched);
750e76b4f9f63c Chris Wilson   2019-08-06  124  		}
750e76b4f9f63c Chris Wilson   2019-08-06  125  	}
750e76b4f9f63c Chris Wilson   2019-08-06  126  
750e76b4f9f63c Chris Wilson   2019-08-06  127  	i915->caps.scheduler = enabled & ~disabled;
750e76b4f9f63c Chris Wilson   2019-08-06  128  	if (!(i915->caps.scheduler & I915_SCHEDULER_CAP_ENABLED))
750e76b4f9f63c Chris Wilson   2019-08-06  129  		i915->caps.scheduler = 0;
750e76b4f9f63c Chris Wilson   2019-08-06  130  }
750e76b4f9f63c Chris Wilson   2019-08-06  131  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c
index 3cca7ea2d6ea..12d165566ed2 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c
@@ -98,6 +98,7 @@  static void set_scheduler_caps(struct drm_i915_private *i915)
 		MAP(HAS_PREEMPTION, PREEMPTION),
 		MAP(HAS_SEMAPHORES, SEMAPHORES),
 		MAP(SUPPORTS_STATS, ENGINE_BUSY_STATS),
+		MAP(TIMESLICE_BIT, TIMESLICING),
 #undef MAP
 	};
 	struct intel_engine_cs *engine;
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index c2c7759b7d2e..af2212d6113c 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -572,6 +572,7 @@  typedef struct drm_i915_irq_wait {
 #define   I915_SCHEDULER_CAP_PREEMPTION	(1ul << 2)
 #define   I915_SCHEDULER_CAP_SEMAPHORES	(1ul << 3)
 #define   I915_SCHEDULER_CAP_ENGINE_BUSY_STATS	(1ul << 4)
+#define   I915_SCHEDULER_CAP_TIMESLICING	(1ul << 5)
 
 #define I915_PARAM_HUC_STATUS		 42