CC: [email protected]
CC: [email protected]
TO: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git 
locking/ww_rt_mutex
head:   513277f3c78127286fd37a34f616801bdcc3aa60
commit: 513277f3c78127286fd37a34f616801bdcc3aa60 [18/18] locking/ww_mutex: 
test_ww_rt_mutex
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
compiler: aarch64-linux-gcc (GCC) 10.3.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> kernel/locking/test-ww_rt_mutex.c:380:17: warning: Local variable stress 
>> shadows outer function [shadowFunction]
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:524:12: note: Shadowed declaration
   static int stress(int nlocks, int nthreads, unsigned int flags)
              ^
   kernel/locking/test-ww_rt_mutex.c:380:17: note: Shadow variable
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:439:17: warning: Local variable stress 
shadows outer function [shadowFunction]
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:524:12: note: Shadowed declaration
   static int stress(int nlocks, int nthreads, unsigned int flags)
              ^
   kernel/locking/test-ww_rt_mutex.c:439:17: note: Shadow variable
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:499:17: warning: Local variable stress 
shadows outer function [shadowFunction]
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:524:12: note: Shadowed declaration
   static int stress(int nlocks, int nthreads, unsigned int flags)
              ^
   kernel/locking/test-ww_rt_mutex.c:499:17: note: Shadow variable
    struct stress *stress = container_of(work, typeof(*stress), work);
                   ^
   kernel/locking/test-ww_rt_mutex.c:537:18: warning: Local variable stress 
shadows outer function [shadowFunction]
     struct stress *stress;
                    ^
   kernel/locking/test-ww_rt_mutex.c:524:12: note: Shadowed declaration
   static int stress(int nlocks, int nthreads, unsigned int flags)
              ^
   kernel/locking/test-ww_rt_mutex.c:537:18: note: Shadow variable
     struct stress *stress;
                    ^

vim +380 kernel/locking/test-ww_rt_mutex.c

513277f3c78127 Peter Zijlstra 2021-07-16  377  
513277f3c78127 Peter Zijlstra 2021-07-16  378  static void 
stress_inorder_work(struct work_struct *work)
513277f3c78127 Peter Zijlstra 2021-07-16  379  {
513277f3c78127 Peter Zijlstra 2021-07-16 @380   struct stress *stress = 
container_of(work, typeof(*stress), work);
513277f3c78127 Peter Zijlstra 2021-07-16  381   const int nlocks = 
stress->nlocks;
513277f3c78127 Peter Zijlstra 2021-07-16  382   struct ww_rt_mutex *locks = 
stress->locks;
513277f3c78127 Peter Zijlstra 2021-07-16  383   struct ww_acquire_ctx ctx;
513277f3c78127 Peter Zijlstra 2021-07-16  384   int *order;
513277f3c78127 Peter Zijlstra 2021-07-16  385  
513277f3c78127 Peter Zijlstra 2021-07-16  386   order = 
get_random_order(nlocks);
513277f3c78127 Peter Zijlstra 2021-07-16  387   if (!order)
513277f3c78127 Peter Zijlstra 2021-07-16  388           return;
513277f3c78127 Peter Zijlstra 2021-07-16  389  
513277f3c78127 Peter Zijlstra 2021-07-16  390   do {
513277f3c78127 Peter Zijlstra 2021-07-16  391           int contended = -1;
513277f3c78127 Peter Zijlstra 2021-07-16  392           int n, err;
513277f3c78127 Peter Zijlstra 2021-07-16  393  
513277f3c78127 Peter Zijlstra 2021-07-16  394           ww_acquire_init(&ctx, 
&ww_class);
513277f3c78127 Peter Zijlstra 2021-07-16  395  retry:
513277f3c78127 Peter Zijlstra 2021-07-16  396           err = 0;
513277f3c78127 Peter Zijlstra 2021-07-16  397           for (n = 0; n < nlocks; 
n++) {
513277f3c78127 Peter Zijlstra 2021-07-16  398                   if (n == 
contended)
513277f3c78127 Peter Zijlstra 2021-07-16  399                           
continue;
513277f3c78127 Peter Zijlstra 2021-07-16  400  
513277f3c78127 Peter Zijlstra 2021-07-16  401                   err = 
ww_rt_mutex_lock(&locks[order[n]], &ctx);
513277f3c78127 Peter Zijlstra 2021-07-16  402                   if (err < 0)
513277f3c78127 Peter Zijlstra 2021-07-16  403                           break;
513277f3c78127 Peter Zijlstra 2021-07-16  404           }
513277f3c78127 Peter Zijlstra 2021-07-16  405           if (!err)
513277f3c78127 Peter Zijlstra 2021-07-16  406                   
dummy_load(stress);
513277f3c78127 Peter Zijlstra 2021-07-16  407  
513277f3c78127 Peter Zijlstra 2021-07-16  408           if (contended > n)
513277f3c78127 Peter Zijlstra 2021-07-16  409                   
ww_rt_mutex_unlock(&locks[order[contended]]);
513277f3c78127 Peter Zijlstra 2021-07-16  410           contended = n;
513277f3c78127 Peter Zijlstra 2021-07-16  411           while (n--)
513277f3c78127 Peter Zijlstra 2021-07-16  412                   
ww_rt_mutex_unlock(&locks[order[n]]);
513277f3c78127 Peter Zijlstra 2021-07-16  413  
513277f3c78127 Peter Zijlstra 2021-07-16  414           if (err == -EDEADLK) {
513277f3c78127 Peter Zijlstra 2021-07-16  415                   
ww_rt_mutex_lock_slow(&locks[order[contended]], &ctx);
513277f3c78127 Peter Zijlstra 2021-07-16  416                   goto retry;
513277f3c78127 Peter Zijlstra 2021-07-16  417           }
513277f3c78127 Peter Zijlstra 2021-07-16  418  
513277f3c78127 Peter Zijlstra 2021-07-16  419           if (err) {
513277f3c78127 Peter Zijlstra 2021-07-16  420                   
pr_err_once("stress (%s) failed with %d\n",
513277f3c78127 Peter Zijlstra 2021-07-16  421                               
__func__, err);
513277f3c78127 Peter Zijlstra 2021-07-16  422                   break;
513277f3c78127 Peter Zijlstra 2021-07-16  423           }
513277f3c78127 Peter Zijlstra 2021-07-16  424  
513277f3c78127 Peter Zijlstra 2021-07-16  425           ww_acquire_fini(&ctx);
513277f3c78127 Peter Zijlstra 2021-07-16  426   } while (!time_after(jiffies, 
stress->timeout));
513277f3c78127 Peter Zijlstra 2021-07-16  427  
513277f3c78127 Peter Zijlstra 2021-07-16  428   kfree(order);
513277f3c78127 Peter Zijlstra 2021-07-16  429   kfree(stress);
513277f3c78127 Peter Zijlstra 2021-07-16  430  }
513277f3c78127 Peter Zijlstra 2021-07-16  431  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to