Hi Roman,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17-rc5 next-20180517]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Roman-Pen/InfiniBand-Transport-IBTRS-and-Network-Block-Device-IBNBD/20180520-222445
config: m68k-allmodconfig (attached as .config)
compiler: m68k-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
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   In file included from arch/m68k/include/asm/atomic.h:7:0,
                    from include/linux/atomic.h:5,
                    from include/linux/spinlock.h:399,
                    from include/linux/seqlock.h:36,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/module.h:10,
                    from drivers/infiniband//ulp/ibtrs/ibtrs-clt.c:34:
   drivers/infiniband//ulp/ibtrs/ibtrs-clt.c: In function 
'ibtrs_clt_remove_path_from_arr':
   arch/m68k/include/asm/cmpxchg.h:122:3: warning: value computed is not used 
[-Wunused-value]
     ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o),     \
     ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (unsigned long)(n), sizeof(*(ptr))))
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/infiniband//ulp/ibtrs/ibtrs-clt.c:1456:3: note: in expansion of 
>> macro 'cmpxchg'
      cmpxchg(ppcpu_path, sess, next);
      ^~~~~~~

vim +/cmpxchg +1456 drivers/infiniband//ulp/ibtrs/ibtrs-clt.c

44463323 Roman Pen 2018-05-18  1396  
44463323 Roman Pen 2018-05-18  1397  static void 
ibtrs_clt_remove_path_from_arr(struct ibtrs_clt_sess *sess)
44463323 Roman Pen 2018-05-18  1398  {
44463323 Roman Pen 2018-05-18  1399     struct ibtrs_clt *clt = sess->clt;
44463323 Roman Pen 2018-05-18  1400     struct ibtrs_clt_sess *next;
44463323 Roman Pen 2018-05-18  1401     int cpu;
44463323 Roman Pen 2018-05-18  1402  
44463323 Roman Pen 2018-05-18  1403     mutex_lock(&clt->paths_mutex);
44463323 Roman Pen 2018-05-18  1404     list_del_rcu(&sess->s.entry);
44463323 Roman Pen 2018-05-18  1405  
44463323 Roman Pen 2018-05-18  1406     /* Make sure everybody observes path 
removal. */
44463323 Roman Pen 2018-05-18  1407     synchronize_rcu();
44463323 Roman Pen 2018-05-18  1408  
44463323 Roman Pen 2018-05-18  1409     /*
44463323 Roman Pen 2018-05-18  1410      * Decrement paths number only after 
grace period, because
44463323 Roman Pen 2018-05-18  1411      * caller of do_each_path() must 
firstly observe list without
44463323 Roman Pen 2018-05-18  1412      * path and only then decremented paths 
number.
44463323 Roman Pen 2018-05-18  1413      *
44463323 Roman Pen 2018-05-18  1414      * Otherwise there can be the following 
situation:
44463323 Roman Pen 2018-05-18  1415      *    o Two paths exist and IO is 
coming.
44463323 Roman Pen 2018-05-18  1416      *    o One path is removed:
44463323 Roman Pen 2018-05-18  1417      *      CPU#0                          
CPU#1
44463323 Roman Pen 2018-05-18  1418      *      do_each_path():                
ibtrs_clt_remove_path_from_arr():
44463323 Roman Pen 2018-05-18  1419      *          path = get_next_path()
44463323 Roman Pen 2018-05-18  1420      *          ^^^                         
   list_del_rcu(path)
44463323 Roman Pen 2018-05-18  1421      *          [!CONNECTED path]           
   clt->paths_num--
44463323 Roman Pen 2018-05-18  1422      *                                      
        ^^^^^^^^^
44463323 Roman Pen 2018-05-18  1423      *          load clt->paths_num         
        from 2 to 1
44463323 Roman Pen 2018-05-18  1424      *                    ^^^^^^^^^
44463323 Roman Pen 2018-05-18  1425      *                    sees 1
44463323 Roman Pen 2018-05-18  1426      *
44463323 Roman Pen 2018-05-18  1427      *      path is observed as !CONNECTED, 
but do_each_path() loop
44463323 Roman Pen 2018-05-18  1428      *      ends, because expression i < 
clt->paths_num is false.
44463323 Roman Pen 2018-05-18  1429      */
44463323 Roman Pen 2018-05-18  1430     clt->paths_num--;
44463323 Roman Pen 2018-05-18  1431  
44463323 Roman Pen 2018-05-18  1432     next = 
list_next_or_null_rr_rcu(&clt->paths_list, &sess->s.entry,
44463323 Roman Pen 2018-05-18  1433                                     
typeof(*next), s.entry);
44463323 Roman Pen 2018-05-18  1434  
44463323 Roman Pen 2018-05-18  1435     /*
44463323 Roman Pen 2018-05-18  1436      * Pcpu paths can still point to the 
path which is going to be
44463323 Roman Pen 2018-05-18  1437      * removed, so change the pointer 
manually.
44463323 Roman Pen 2018-05-18  1438      */
44463323 Roman Pen 2018-05-18  1439     for_each_possible_cpu(cpu) {
44463323 Roman Pen 2018-05-18  1440             struct ibtrs_clt_sess 
**ppcpu_path;
44463323 Roman Pen 2018-05-18  1441  
44463323 Roman Pen 2018-05-18  1442             ppcpu_path = 
per_cpu_ptr(clt->pcpu_path, cpu);
44463323 Roman Pen 2018-05-18  1443             if (*ppcpu_path != sess)
44463323 Roman Pen 2018-05-18  1444                     /*
44463323 Roman Pen 2018-05-18  1445                      * synchronize_rcu() 
was called just after deleting
44463323 Roman Pen 2018-05-18  1446                      * entry from the list, 
thus IO code path cannot
44463323 Roman Pen 2018-05-18  1447                      * change pointer back 
to the pointer which is going
44463323 Roman Pen 2018-05-18  1448                      * to be removed, we 
are safe here.
44463323 Roman Pen 2018-05-18  1449                      */
44463323 Roman Pen 2018-05-18  1450                     continue;
44463323 Roman Pen 2018-05-18  1451  
44463323 Roman Pen 2018-05-18  1452             /*
44463323 Roman Pen 2018-05-18  1453              * We race with IO code path, 
which also changes pointer,
44463323 Roman Pen 2018-05-18  1454              * thus we have to be careful 
not to override it.
44463323 Roman Pen 2018-05-18  1455              */
44463323 Roman Pen 2018-05-18 @1456             cmpxchg(ppcpu_path, sess, next);
44463323 Roman Pen 2018-05-18  1457     }
44463323 Roman Pen 2018-05-18  1458     mutex_unlock(&clt->paths_mutex);
44463323 Roman Pen 2018-05-18  1459  }
44463323 Roman Pen 2018-05-18  1460  

:::::: The code at line 1456 was first introduced by commit
:::::: 4446332354bf8cf878755e55a221c59eb55a0f1f ibtrs: client: main 
functionality

:::::: TO: Roman Pen <[email protected]>
:::::: CC: 0day robot <[email protected]>

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

Attachment: .config.gz
Description: application/gzip

Reply via email to