tree:
git://people.freedesktop.org/~mlankhorst/linux locking-rework
head: c19d2554f1d542e2aac63116de7321ef2bb09672
commit: 97ef20a5c69f47783e9b5a015348e0bfdc5863bf [12/36] drm/i915: Reject UNSYNCHRONIZED
for userptr
config: i386-randconfig-a012-20200918 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git checkout 97ef20a5c69f47783e9b5a015348e0bfdc5863bf
# 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(a)intel.com>
All errors (new ones prefixed by >>):
drivers/gpu/drm/i915/gem/i915_gem_userptr.c: In function
'i915_gem_userptr_ioctl':
> drivers/gpu/drm/i915/gem/i915_gem_userptr.c:746:6: error: unused
variable 'handle' [-Werror=unused-variable]
746 | u32 handle;
| ^~~~~~
> drivers/gpu/drm/i915/gem/i915_gem_userptr.c:745:6: error: unused
variable 'ret' [-Werror=unused-variable]
745 | int ret;
| ^~~
> drivers/gpu/drm/i915/gem/i915_gem_userptr.c:741:31: error: unused
variable 'lock_class' [-Werror=unused-variable]
741 | static struct
lock_class_key lock_class;
| ^~~~~~~~~~
At top level:
> drivers/gpu/drm/i915/gem/i915_gem_userptr.c:741:31: error:
'lock_class' defined but not used [-Werror=unused-variable]
cc1: all
warnings being treated as errors
git remote add mlankhorst
git://people.freedesktop.org/~mlankhorst/linux
git fetch --no-tags mlankhorst locking-rework
git checkout 97ef20a5c69f47783e9b5a015348e0bfdc5863bf
vim +/handle +746 drivers/gpu/drm/i915/gem/i915_gem_userptr.c
97ef20a5c69f47 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Maarten Lankhorst 2020-09-11
700
a5a5ae2abe3ba7 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-02-08
701 /*
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
702 * Creates a new mm object that wraps some normal memory from the process
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
703 * context - user memory.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
704 *
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
705 * We impose several restrictions upon the memory being mapped
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
706 * into the GPU.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
707 * 1. It must be page aligned (both start/end addresses, i.e ptr and size).
ec8b0dd51c50e3 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-07-21
708 * 2. It must be normal system memory, not a pointer into another map of IO
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
709 * space (e.g. it must not be a GTT mmapping of another object).
ec8b0dd51c50e3 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-07-21
710 * 3. We only allow a bo as large as we could in theory map into the GTT,
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
711 * that is we limit the size to the total size of the GTT.
ec8b0dd51c50e3 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-07-21
712 * 4. The bo is marked as being snoopable. The backing pages are left
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
713 * accessible directly by the CPU, but reads and writes by the GPU may
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
714 * incur the cost of a snoop (unless you have an LLC architecture).
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
715 *
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
716 * Synchronisation between multiple users and the GPU is left to userspace
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
717 * through the normal set-domain-ioctl. The kernel will enforce that the
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
718 * GPU relinquishes the VMA before it is returned back to the system
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
719 * i.e. upon free(), munmap() or process termination. However, the userspace
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
720 * malloc() library may not immediately relinquish the VMA after free() and
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
721 * instead reuse it whilst the GPU is still reading and writing to the VMA.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
722 * Caveat emptor.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
723 *
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
724 * Also note, that the object created here is not currently a "first
class"
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
725 * object, in that several ioctls are banned. These are the CPU access
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
726 * ioctls: mmap(), pwrite and pread. In practice, you are expected to use
cc917ab43541db drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2015-10-13
727 * direct access via your pointer rather than use those ioctls. Another
cc917ab43541db drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2015-10-13
728 * restriction is that we do not allow userptr surfaces to be pinned to the
cc917ab43541db drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2015-10-13
729 * hardware and so we reject any attempt to create a framebuffer out of a
cc917ab43541db drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2015-10-13
730 * userptr.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
731 *
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
732 * If you think this is a good interface to use to pass GPU memory between
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
733 * drivers, please use dma-buf instead. In fact, wherever possible use
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
734 * dma-buf instead.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
735 */
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
736 int
a5a5ae2abe3ba7 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-02-08
737 i915_gem_userptr_ioctl(struct drm_device *dev,
a5a5ae2abe3ba7 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-02-08
738 void *data,
a5a5ae2abe3ba7 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-02-08
739 struct drm_file *file)
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
740 {
7867d709959927 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Chris Wilson 2019-10-22
@741 static struct lock_class_key lock_class;
0031fb96859caa drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-11-04
742 struct drm_i915_private *dev_priv = to_i915(dev);
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
743 struct drm_i915_gem_userptr *args = data;
97ef20a5c69f47 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Maarten Lankhorst 2020-09-11
744 struct drm_i915_gem_object __maybe_unused *obj;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
@745 int ret;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
@746 u32 handle;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
747
0031fb96859caa drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-11-04
748 if (!HAS_LLC(dev_priv) && !HAS_SNOOP(dev_priv)) {
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
749 /* We cannot support coherent userptr objects on hw without
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
750 * LLC and broken snooping.
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
751 */
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
752 return -ENODEV;
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
753 }
ca377809d657ea drivers/gpu/drm/i915/i915_gem_userptr.c Tvrtko Ursulin 2016-03-02
754
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
755 if (args->flags & ~(I915_USERPTR_READ_ONLY |
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
756 I915_USERPTR_UNSYNCHRONIZED))
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
757 return -EINVAL;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
758
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
759 /*
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
760 * XXX: There is a prevalence of the assumption that we fit the
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
761 * object's page count inside a 32bit _signed_ variable. Let's document
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
762 * this and catch if we ever need to fix it. In the meantime, if you do
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
763 * spot such a local variable, please consider fixing!
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
764 *
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
765 * Aside from our own locals (for which we have no excuse!):
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
766 * - sg_table embeds unsigned int for num_pages
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
767 * - get_user_pages*() mixed ints with longs
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
768 */
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
769
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
770 if (args->user_size >> PAGE_SHIFT > INT_MAX)
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
771 return -E2BIG;
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
772
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
773 if (overflows_type(args->user_size, obj->base.size))
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
774 return -E2BIG;
24860ad748688b drivers/gpu/drm/i915/gem/i915_gem_userptr.c Matthew Auld 2020-01-17
775
c11c7bfd213495 drivers/gpu/drm/i915/i915_gem_userptr.c Matthew Auld 2018-05-02
776 if (!args->user_size)
c11c7bfd213495 drivers/gpu/drm/i915/i915_gem_userptr.c Matthew Auld 2018-05-02
777 return -EINVAL;
c11c7bfd213495 drivers/gpu/drm/i915/i915_gem_userptr.c Matthew Auld 2018-05-02
778
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
779 if (offset_in_page(args->user_ptr | args->user_size))
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
780 return -EINVAL;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
781
96d4f267e40f95 drivers/gpu/drm/i915/i915_gem_userptr.c Linus Torvalds 2019-01-03
782 if (!access_ok((char __user *)(unsigned long)args->user_ptr,
args->user_size))
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
783 return -EFAULT;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
784
97ef20a5c69f47 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Maarten Lankhorst 2020-09-11
785 if (args->flags & I915_USERPTR_UNSYNCHRONIZED)
97ef20a5c69f47 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Maarten Lankhorst 2020-09-11
786 return -ENODEV;
97ef20a5c69f47 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Maarten Lankhorst 2020-09-11
787
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
788 if (args->flags & I915_USERPTR_READ_ONLY) {
0b100760e3e8cb drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-07-12
789 /*
0b100760e3e8cb drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-07-12
790 * On almost all of the older hw, we cannot tell the GPU that
0b100760e3e8cb drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2018-07-12
791 * a page is readonly.
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
792 */
e6ba76480299a0 drivers/gpu/drm/i915/gem/i915_gem_userptr.c Chris Wilson 2019-12-21
793 if (!dev_priv->gt.vm->has_read_only)
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
794 return -ENODEV;
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
795 }
5cc9ed4b9a7ac5 drivers/gpu/drm/i915/i915_gem_userptr.c Chris Wilson 2014-05-16
796
:::::: The code at line 746 was first introduced by commit
:::::: 5cc9ed4b9a7ac579362ccebac67f7a4cdb36de06 drm/i915: Introduce mapping of user pages
into video memory (userptr) ioctl
:::::: TO: Chris Wilson <chris(a)chris-wilson.co.uk>
:::::: CC: Daniel Vetter <daniel.vetter(a)ffwll.ch>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org