CC: [email protected]
BCC: [email protected]
TO: Maarten Lankhorst <[email protected]>
CC: Junxiao Chang <[email protected]>

tree:   https://github.com/intel/linux-intel-lts.git 5.15/linux
head:   7acd0be121091f12349a4dcefd2e6deee2e73946
commit: 53956aadc1f3755f43e9a8d6741cb2b1d4c58ac6 [336/2399] kernel/locking: Add 
context to ww_mutex_trylock()
:::::: branch date: 4 days ago
:::::: commit date: 9 weeks ago
config: xtensa-randconfig-m031-20220422 
(https://download.01.org/0day-ci/archive/20220423/[email protected]/config)
compiler: xtensa-linux-gcc (GCC) 11.2.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]>

New smatch warnings:
kernel/locking/test-ww_mutex.c:172 test_aa() error: uninitialized symbol 'ret'.

Old smatch warnings:
arch/xtensa/include/asm/thread_info.h:91 current_thread_info() warn: 
inconsistent indenting

vim +/ret +172 kernel/locking/test-ww_mutex.c

f2a5fec17395f2 Chris Wilson      2016-12-01  120  
53956aadc1f375 Maarten Lankhorst 2021-09-09  121  static int test_aa(bool 
trylock)
c22fb3807fd0a3 Chris Wilson      2016-12-01  122  {
c22fb3807fd0a3 Chris Wilson      2016-12-01  123        struct ww_mutex mutex;
c22fb3807fd0a3 Chris Wilson      2016-12-01  124        struct ww_acquire_ctx 
ctx;
c22fb3807fd0a3 Chris Wilson      2016-12-01  125        int ret;
53956aadc1f375 Maarten Lankhorst 2021-09-09  126        const char *from = 
trylock ? "trylock" : "lock";
c22fb3807fd0a3 Chris Wilson      2016-12-01  127  
c22fb3807fd0a3 Chris Wilson      2016-12-01  128        ww_mutex_init(&mutex, 
&ww_class);
c22fb3807fd0a3 Chris Wilson      2016-12-01  129        ww_acquire_init(&ctx, 
&ww_class);
c22fb3807fd0a3 Chris Wilson      2016-12-01  130  
53956aadc1f375 Maarten Lankhorst 2021-09-09  131        if (!trylock) {
53956aadc1f375 Maarten Lankhorst 2021-09-09  132                ret = 
ww_mutex_lock(&mutex, &ctx);
53956aadc1f375 Maarten Lankhorst 2021-09-09  133                if (ret) {
53956aadc1f375 Maarten Lankhorst 2021-09-09  134                        
pr_err("%s: initial lock failed!\n", __func__);
53956aadc1f375 Maarten Lankhorst 2021-09-09  135                        goto 
out;
53956aadc1f375 Maarten Lankhorst 2021-09-09  136                }
53956aadc1f375 Maarten Lankhorst 2021-09-09  137        } else {
53956aadc1f375 Maarten Lankhorst 2021-09-09  138                if 
(!ww_mutex_trylock(&mutex, &ctx)) {
53956aadc1f375 Maarten Lankhorst 2021-09-09  139                        
pr_err("%s: initial trylock failed!\n", __func__);
53956aadc1f375 Maarten Lankhorst 2021-09-09  140                        goto 
out;
53956aadc1f375 Maarten Lankhorst 2021-09-09  141                }
53956aadc1f375 Maarten Lankhorst 2021-09-09  142        }
53956aadc1f375 Maarten Lankhorst 2021-09-09  143  
53956aadc1f375 Maarten Lankhorst 2021-09-09  144        if 
(ww_mutex_trylock(&mutex, NULL))  {
53956aadc1f375 Maarten Lankhorst 2021-09-09  145                pr_err("%s: 
trylocked itself without context from %s!\n", __func__, from);
53956aadc1f375 Maarten Lankhorst 2021-09-09  146                
ww_mutex_unlock(&mutex);
53956aadc1f375 Maarten Lankhorst 2021-09-09  147                ret = -EINVAL;
53956aadc1f375 Maarten Lankhorst 2021-09-09  148                goto out;
53956aadc1f375 Maarten Lankhorst 2021-09-09  149        }
c22fb3807fd0a3 Chris Wilson      2016-12-01  150  
53956aadc1f375 Maarten Lankhorst 2021-09-09  151        if 
(ww_mutex_trylock(&mutex, &ctx))  {
53956aadc1f375 Maarten Lankhorst 2021-09-09  152                pr_err("%s: 
trylocked itself with context from %s!\n", __func__, from);
c22fb3807fd0a3 Chris Wilson      2016-12-01  153                
ww_mutex_unlock(&mutex);
c22fb3807fd0a3 Chris Wilson      2016-12-01  154                ret = -EINVAL;
c22fb3807fd0a3 Chris Wilson      2016-12-01  155                goto out;
c22fb3807fd0a3 Chris Wilson      2016-12-01  156        }
c22fb3807fd0a3 Chris Wilson      2016-12-01  157  
c22fb3807fd0a3 Chris Wilson      2016-12-01  158        ret = 
ww_mutex_lock(&mutex, &ctx);
c22fb3807fd0a3 Chris Wilson      2016-12-01  159        if (ret != -EALREADY) {
53956aadc1f375 Maarten Lankhorst 2021-09-09  160                pr_err("%s: 
missed deadlock for recursing, ret=%d from %s\n",
53956aadc1f375 Maarten Lankhorst 2021-09-09  161                       
__func__, ret, from);
c22fb3807fd0a3 Chris Wilson      2016-12-01  162                if (!ret)
c22fb3807fd0a3 Chris Wilson      2016-12-01  163                        
ww_mutex_unlock(&mutex);
c22fb3807fd0a3 Chris Wilson      2016-12-01  164                ret = -EINVAL;
c22fb3807fd0a3 Chris Wilson      2016-12-01  165                goto out;
c22fb3807fd0a3 Chris Wilson      2016-12-01  166        }
c22fb3807fd0a3 Chris Wilson      2016-12-01  167  
53956aadc1f375 Maarten Lankhorst 2021-09-09  168        ww_mutex_unlock(&mutex);
c22fb3807fd0a3 Chris Wilson      2016-12-01  169        ret = 0;
c22fb3807fd0a3 Chris Wilson      2016-12-01  170  out:
c22fb3807fd0a3 Chris Wilson      2016-12-01  171        ww_acquire_fini(&ctx);
c22fb3807fd0a3 Chris Wilson      2016-12-01 @172        return ret;
c22fb3807fd0a3 Chris Wilson      2016-12-01  173  }
c22fb3807fd0a3 Chris Wilson      2016-12-01  174  

:::::: The code at line 172 was first introduced by commit
:::::: c22fb3807fd0a3bdd98c13c4d2190ab064e6c09d locking/ww_mutex: Add 
kselftests for ww_mutex AA deadlock detection

:::::: TO: Chris Wilson <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

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

Reply via email to