[Intel-gfx] [PATCH v2 1/5] drm/i915/gem: Implement object migration

kernel test robot lkp at intel.com
Mon Jun 28 12:54:33 UTC 2021


Hi "Thomas,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210628]
[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/Thomas-Hellstr-m/drm-i915-gem-Introduce-a-migrate-interface/20210628-171204
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a003-20210628 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4c92e31dd0f1bd152eda883af20ff7fbcaa14945)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e4e5a7f5c031252f26c868a2aa17a031a1558336
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Thomas-Hellstr-m/drm-i915-gem-Introduce-a-migrate-interface/20210628-171204
        git checkout e4e5a7f5c031252f26c868a2aa17a031a1558336
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

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

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/gem/i915_gem_wait.c:184: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Waits for rendering to the object to be completed
>> drivers/gpu/drm/i915/gem/i915_gem_wait.c:307: warning: expecting prototype for i915_gem_object_wait_migrate(). Prototype was for i915_gem_object_wait_migration() instead


vim +307 drivers/gpu/drm/i915/gem/i915_gem_wait.c

   182	
   183	/**
 > 184	 * Waits for rendering to the object to be completed
   185	 * @obj: i915 gem object
   186	 * @flags: how to wait (under a lock, for all rendering or just for writes etc)
   187	 * @timeout: how long to wait
   188	 */
   189	int
   190	i915_gem_object_wait(struct drm_i915_gem_object *obj,
   191			     unsigned int flags,
   192			     long timeout)
   193	{
   194		might_sleep();
   195		GEM_BUG_ON(timeout < 0);
   196	
   197		timeout = i915_gem_object_wait_reservation(obj->base.resv,
   198							   flags, timeout);
   199		return timeout < 0 ? timeout : 0;
   200	}
   201	
   202	static inline unsigned long nsecs_to_jiffies_timeout(const u64 n)
   203	{
   204		/* nsecs_to_jiffies64() does not guard against overflow */
   205		if (NSEC_PER_SEC % HZ &&
   206		    div_u64(n, NSEC_PER_SEC) >= MAX_JIFFY_OFFSET / HZ)
   207			return MAX_JIFFY_OFFSET;
   208	
   209		return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1);
   210	}
   211	
   212	static unsigned long to_wait_timeout(s64 timeout_ns)
   213	{
   214		if (timeout_ns < 0)
   215			return MAX_SCHEDULE_TIMEOUT;
   216	
   217		if (timeout_ns == 0)
   218			return 0;
   219	
   220		return nsecs_to_jiffies_timeout(timeout_ns);
   221	}
   222	
   223	/**
   224	 * i915_gem_wait_ioctl - implements DRM_IOCTL_I915_GEM_WAIT
   225	 * @dev: drm device pointer
   226	 * @data: ioctl data blob
   227	 * @file: drm file pointer
   228	 *
   229	 * Returns 0 if successful, else an error is returned with the remaining time in
   230	 * the timeout parameter.
   231	 *  -ETIME: object is still busy after timeout
   232	 *  -ERESTARTSYS: signal interrupted the wait
   233	 *  -ENONENT: object doesn't exist
   234	 * Also possible, but rare:
   235	 *  -EAGAIN: incomplete, restart syscall
   236	 *  -ENOMEM: damn
   237	 *  -ENODEV: Internal IRQ fail
   238	 *  -E?: The add request failed
   239	 *
   240	 * The wait ioctl with a timeout of 0 reimplements the busy ioctl. With any
   241	 * non-zero timeout parameter the wait ioctl will wait for the given number of
   242	 * nanoseconds on an object becoming unbusy. Since the wait itself does so
   243	 * without holding struct_mutex the object may become re-busied before this
   244	 * function completes. A similar but shorter * race condition exists in the busy
   245	 * ioctl
   246	 */
   247	int
   248	i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
   249	{
   250		struct drm_i915_gem_wait *args = data;
   251		struct drm_i915_gem_object *obj;
   252		ktime_t start;
   253		long ret;
   254	
   255		if (args->flags != 0)
   256			return -EINVAL;
   257	
   258		obj = i915_gem_object_lookup(file, args->bo_handle);
   259		if (!obj)
   260			return -ENOENT;
   261	
   262		start = ktime_get();
   263	
   264		ret = i915_gem_object_wait(obj,
   265					   I915_WAIT_INTERRUPTIBLE |
   266					   I915_WAIT_PRIORITY |
   267					   I915_WAIT_ALL,
   268					   to_wait_timeout(args->timeout_ns));
   269	
   270		if (args->timeout_ns > 0) {
   271			args->timeout_ns -= ktime_to_ns(ktime_sub(ktime_get(), start));
   272			if (args->timeout_ns < 0)
   273				args->timeout_ns = 0;
   274	
   275			/*
   276			 * Apparently ktime isn't accurate enough and occasionally has a
   277			 * bit of mismatch in the jiffies<->nsecs<->ktime loop. So patch
   278			 * things up to make the test happy. We allow up to 1 jiffy.
   279			 *
   280			 * This is a regression from the timespec->ktime conversion.
   281			 */
   282			if (ret == -ETIME && !nsecs_to_jiffies(args->timeout_ns))
   283				args->timeout_ns = 0;
   284	
   285			/* Asked to wait beyond the jiffie/scheduler precision? */
   286			if (ret == -ETIME && args->timeout_ns)
   287				ret = -EAGAIN;
   288		}
   289	
   290		i915_gem_object_put(obj);
   291		return ret;
   292	}
   293	
   294	/**
   295	 * i915_gem_object_wait_migrate - Sync an accelerated migration operation
   296	 * @obj: The migrating object.
   297	 * @flags: waiting flags. Currently supports only I915_WAIT_INTERRUPTIBLE.
   298	 *
   299	 * Wait for any pending async migration operation on the object,
   300	 * whether it's explicitly (i915_gem_object_migrate()) or implicitly
   301	 * (swapin, initial clearing) initiated.
   302	 *
   303	 * Return: 0 if successful, -ERESTARTSYS if a signal was hit during waiting.
   304	 */
   305	int i915_gem_object_wait_migration(struct drm_i915_gem_object *obj,
   306					   unsigned int flags)
 > 307	{

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 49800 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20210628/33548cc8/attachment-0001.gz>


More information about the Intel-gfx mailing list