tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next-5.2-wip
head:   5666aea3ea494d4dd96df8f092cab32dbeeac321
commit: 95db8d6001df8966e3370a66c9f358925fbcc890 [21/42] drm/amdgpu: replace 
get_user_pages with HMM mirror helpers
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 95db8d6001df8966e3370a66c9f358925fbcc890
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

Note: the radeon-alex/drm-next-5.2-wip HEAD 
5666aea3ea494d4dd96df8f092cab32dbeeac321 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:713:19: error: field 'range' has 
incomplete type
     struct hmm_range range;
                      ^~~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c: In function 
'amdgpu_ttm_tt_get_user_pages':
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:738:7: error: dereferencing pointer 
to incomplete type 'struct hmm_range'
     range->vma = find_vma(mm, gtt->userptr);
          ^~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:756:32: error: 'HMM_PFN_VALID' 
>> undeclared (first use in this function); did you mean '_PAGE_VALID'?
     range->pfns[0] = range->flags[HMM_PFN_VALID];
                                   ^~~~~~~~~~~~~
                                   _PAGE_VALID
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:756:32: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:758:22: error: 'HMM_PFN_WRITE' 
undeclared (first use in this function); did you mean 'HMM_PFN_VALID'?
        0 : range->flags[HMM_PFN_WRITE];
                         ^~~~~~~~~~~~~
                         HMM_PFN_VALID
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:763:6: error: implicit declaration 
of function 'hmm_vma_fault'; did you mean 'hmm_mm_init'? 
[-Werror=implicit-function-declaration]
     r = hmm_vma_fault(range, true);
         ^~~~~~~~~~~~~
         hmm_mm_init
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:770:14: error: implicit declaration 
of function 'hmm_pfn_to_page'; did you mean '__pfn_to_page'? 
[-Werror=implicit-function-declaration]
      pages[i] = hmm_pfn_to_page(range, range->pfns[i]);
                 ^~~~~~~~~~~~~~~
                 __pfn_to_page
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c: In function 
'amdgpu_ttm_tt_get_user_pages_done':
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:798:7: error: implicit declaration 
of function 'hmm_vma_range_done'; did you mean 'drm_vma_node_size'? 
[-Werror=implicit-function-declaration]
      r = hmm_vma_range_done(&gtt->range);
          ^~~~~~~~~~~~~~~~~~
          drm_vma_node_size
   cc1: some warnings being treated as errors

vim +756 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

   703  
   704  /*
   705   * TTM backend functions.
   706   */
   707  struct amdgpu_ttm_tt {
   708          struct ttm_dma_tt       ttm;
   709          u64                     offset;
   710          uint64_t                userptr;
   711          struct task_struct      *usertask;
   712          uint32_t                userflags;
 > 713          struct hmm_range        range;
   714  };
   715  
   716  /**
   717   * amdgpu_ttm_tt_get_user_pages - get device accessible pages that back 
user
   718   * memory and start HMM tracking CPU page table update
   719   *
   720   * Calling function must call amdgpu_ttm_tt_userptr_range_done() once 
and only
   721   * once afterwards to stop HMM tracking
   722   */
   723  int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page 
**pages)
   724  {
   725          struct amdgpu_ttm_tt *gtt = (void *)ttm;
   726          struct mm_struct *mm = gtt->usertask->mm;
   727          unsigned long end = gtt->userptr + ttm->num_pages * PAGE_SIZE;
   728          struct hmm_range *range = &gtt->range;
   729          int r = 0, i;
   730  
   731          if (!mm) /* Happens during process shutdown */
   732                  return -ESRCH;
   733  
   734          amdgpu_hmm_init_range(range);
   735  
   736          down_read(&mm->mmap_sem);
   737  
   738          range->vma = find_vma(mm, gtt->userptr);
   739          if (!range_in_vma(range->vma, gtt->userptr, end))
   740                  r = -EFAULT;
   741          else if ((gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) &&
   742                  range->vma->vm_file)
   743                  r = -EPERM;
   744          if (r)
   745                  goto out;
   746  
   747          range->pfns = kvmalloc_array(ttm->num_pages, sizeof(uint64_t),
   748                                       GFP_KERNEL);
   749          if (range->pfns == NULL) {
   750                  r = -ENOMEM;
   751                  goto out;
   752          }
   753          range->start = gtt->userptr;
   754          range->end = end;
   755  
 > 756          range->pfns[0] = range->flags[HMM_PFN_VALID];
   757          range->pfns[0] |= amdgpu_ttm_tt_is_readonly(ttm) ?
   758                                  0 : range->flags[HMM_PFN_WRITE];
   759          for (i = 1; i < ttm->num_pages; i++)
   760                  range->pfns[i] = range->pfns[0];
   761  
   762          /* This may trigger page table update */
   763          r = hmm_vma_fault(range, true);
   764          if (r)
   765                  goto out_free_pfns;
   766  
   767          up_read(&mm->mmap_sem);
   768  
   769          for (i = 0; i < ttm->num_pages; i++)
   770                  pages[i] = hmm_pfn_to_page(range, range->pfns[i]);
   771  
   772          return 0;
   773  
   774  out_free_pfns:
   775          kvfree(range->pfns);
   776          range->pfns = NULL;
   777  out:
   778          up_read(&mm->mmap_sem);
   779          return r;
   780  }
   781  

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to