CC: [email protected]
CC: [email protected]
TO: "Ahmed S. Darwish" <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fa02fcd94b0c8dff6cc65714510cf25ad194b90d
commit: 55f3560df975f557c48aa6afc636808f31ecb87a seqlock: Extend seqcount API 
with associated locks
date:   4 months ago
:::::: branch date: 9 hours ago
:::::: commit date: 4 months ago
config: x86_64-randconfig-m001-20201126 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:262 
amdgpu_amdkfd_remove_eviction_fence() warn: statement has no effect 31

vim +262 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

a46a2cd103a8637 Felix Kuehling  2018-02-06  213  
a46a2cd103a8637 Felix Kuehling  2018-02-06  214  
2d086fded1021d6 Felix Kuehling  2019-02-04  215  /* 
amdgpu_amdkfd_remove_eviction_fence - Removes eviction fence from BO's
a46a2cd103a8637 Felix Kuehling  2018-02-06  216   *  reservation object.
a46a2cd103a8637 Felix Kuehling  2018-02-06  217   *
a46a2cd103a8637 Felix Kuehling  2018-02-06  218   * @bo: [IN] Remove eviction 
fence(s) from this BO
2d086fded1021d6 Felix Kuehling  2019-02-04  219   * @ef: [IN] This eviction 
fence is removed if it
a46a2cd103a8637 Felix Kuehling  2018-02-06  220   *  is present in the shared 
list.
a46a2cd103a8637 Felix Kuehling  2018-02-06  221   *
a46a2cd103a8637 Felix Kuehling  2018-02-06  222   * NOTE: Must be called with 
BO reserved i.e. bo->tbo.resv->lock held.
a46a2cd103a8637 Felix Kuehling  2018-02-06  223   */
a46a2cd103a8637 Felix Kuehling  2018-02-06  224  static int 
amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo,
2d086fded1021d6 Felix Kuehling  2019-02-04  225                                 
        struct amdgpu_amdkfd_fence *ef)
a46a2cd103a8637 Felix Kuehling  2018-02-06  226  {
52791eeec1d9f4a Christian König 2019-08-11  227         struct dma_resv *resv = 
bo->tbo.base.resv;
52791eeec1d9f4a Christian König 2019-08-11  228         struct dma_resv_list 
*old, *new;
e6f8d26ebbcf45f Christian König 2018-08-14  229         unsigned int i, j, k;
a46a2cd103a8637 Felix Kuehling  2018-02-06  230  
2d086fded1021d6 Felix Kuehling  2019-02-04  231         if (!ef)
a46a2cd103a8637 Felix Kuehling  2018-02-06  232                 return -EINVAL;
a46a2cd103a8637 Felix Kuehling  2018-02-06  233  
52791eeec1d9f4a Christian König 2019-08-11  234         old = 
dma_resv_get_list(resv);
e6f8d26ebbcf45f Christian König 2018-08-14  235         if (!old)
a46a2cd103a8637 Felix Kuehling  2018-02-06  236                 return 0;
a46a2cd103a8637 Felix Kuehling  2018-02-06  237  
e6f8d26ebbcf45f Christian König 2018-08-14  238         new = 
kmalloc(offsetof(typeof(*new), shared[old->shared_max]),
e6f8d26ebbcf45f Christian König 2018-08-14  239                       
GFP_KERNEL);
e6f8d26ebbcf45f Christian König 2018-08-14  240         if (!new)
e6f8d26ebbcf45f Christian König 2018-08-14  241                 return -ENOMEM;
a46a2cd103a8637 Felix Kuehling  2018-02-06  242  
e6f8d26ebbcf45f Christian König 2018-08-14  243         /* Go through all the 
shared fences in the resevation object and sort
e6f8d26ebbcf45f Christian König 2018-08-14  244          * the interesting ones 
to the end of the list.
a46a2cd103a8637 Felix Kuehling  2018-02-06  245          */
e6f8d26ebbcf45f Christian König 2018-08-14  246         for (i = 0, j = 
old->shared_count, k = 0; i < old->shared_count; ++i) {
a46a2cd103a8637 Felix Kuehling  2018-02-06  247                 struct 
dma_fence *f;
a46a2cd103a8637 Felix Kuehling  2018-02-06  248  
e6f8d26ebbcf45f Christian König 2018-08-14  249                 f = 
rcu_dereference_protected(old->shared[i],
52791eeec1d9f4a Christian König 2019-08-11  250                                 
              dma_resv_held(resv));
a46a2cd103a8637 Felix Kuehling  2018-02-06  251  
2d086fded1021d6 Felix Kuehling  2019-02-04  252                 if (f->context 
== ef->base.context)
e6f8d26ebbcf45f Christian König 2018-08-14  253                         
RCU_INIT_POINTER(new->shared[--j], f);
e6f8d26ebbcf45f Christian König 2018-08-14  254                 else
e6f8d26ebbcf45f Christian König 2018-08-14  255                         
RCU_INIT_POINTER(new->shared[k++], f);
a46a2cd103a8637 Felix Kuehling  2018-02-06  256         }
e6f8d26ebbcf45f Christian König 2018-08-14  257         new->shared_max = 
old->shared_max;
e6f8d26ebbcf45f Christian König 2018-08-14  258         new->shared_count = k;
a46a2cd103a8637 Felix Kuehling  2018-02-06  259  
e6f8d26ebbcf45f Christian König 2018-08-14  260         /* Install the new 
fence list, seqcount provides the barriers */
a46a2cd103a8637 Felix Kuehling  2018-02-06  261         preempt_disable();
a46a2cd103a8637 Felix Kuehling  2018-02-06 @262         
write_seqcount_begin(&resv->seq);
e6f8d26ebbcf45f Christian König 2018-08-14  263         
RCU_INIT_POINTER(resv->fence, new);
e6f8d26ebbcf45f Christian König 2018-08-14  264         
write_seqcount_end(&resv->seq);
e6f8d26ebbcf45f Christian König 2018-08-14  265         preempt_enable();
a46a2cd103a8637 Felix Kuehling  2018-02-06  266  
e6f8d26ebbcf45f Christian König 2018-08-14  267         /* Drop the references 
to the removed fences or move them to ef_list */
e6f8d26ebbcf45f Christian König 2018-08-14  268         for (i = j, k = 0; i < 
old->shared_count; ++i) {
a46a2cd103a8637 Felix Kuehling  2018-02-06  269                 struct 
dma_fence *f;
a46a2cd103a8637 Felix Kuehling  2018-02-06  270  
e6f8d26ebbcf45f Christian König 2018-08-14  271                 f = 
rcu_dereference_protected(new->shared[i],
52791eeec1d9f4a Christian König 2019-08-11  272                                 
              dma_resv_held(resv));
e6f8d26ebbcf45f Christian König 2018-08-14  273                 
dma_fence_put(f);
a46a2cd103a8637 Felix Kuehling  2018-02-06  274         }
e6f8d26ebbcf45f Christian König 2018-08-14  275         kfree_rcu(old, rcu);
a46a2cd103a8637 Felix Kuehling  2018-02-06  276  
a46a2cd103a8637 Felix Kuehling  2018-02-06  277         return 0;
a46a2cd103a8637 Felix Kuehling  2018-02-06  278  }
a46a2cd103a8637 Felix Kuehling  2018-02-06  279  

:::::: The code at line 262 was first introduced by commit
:::::: a46a2cd103a863724d668c86dca86bd0d93a19e4 drm/amdgpu: Add GPUVM memory 
management functions for KFD

:::::: TO: Felix Kuehling <[email protected]>
:::::: CC: Oded Gabbay <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to