CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Jan Kara <[email protected]>
CC: Jens Axboe <[email protected]>
CC: "Michal Koutný" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 
for-5.17/block
head:   0ba4566cd8a4e645b542e6ddbe3dd26c85ad2408
commit: 76f1df88bbc2f984eb0418cc90de0a8384e63604 [47/90] bfq: Limit number of 
requests consumed by each cgroup
:::::: branch date: 6 hours ago
:::::: commit date: 2 weeks ago
config: riscv-randconfig-c006-20211212 
(https://download.01.org/0day-ci/archive/20211214/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
097a1cb1d5ebb3a0ec4bcaed8ba3ff6a8e33c00a)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=76f1df88bbc2f984eb0418cc90de0a8384e63604
        git remote add axboe-block 
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
        git fetch --no-tags axboe-block for-5.17/block
        git checkout 76f1df88bbc2f984eb0418cc90de0a8384e63604
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3347:7: note: Returning from 'IS_ERR'
                   if (IS_ERR(device)) {
                       ^~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3347:3: note: Taking true branch
                   if (IS_ERR(device)) {
                   ^
   fs/btrfs/extent_io.c:3349:4: note: Control jumps to line 3356
                           goto error;
                           ^
   fs/btrfs/extent_io.c:3356:2: note: Null pointer value stored to 
'bio_ctrl.bio'
           bio_ctrl->bio = NULL;
           ^~~~~~~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3407:10: note: Returning from 'alloc_new_bio'
                           ret = alloc_new_bio(inode, bio_ctrl, wbc, opf,
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3411:8: note: 'ret' is >= 0
                           if (ret < 0)
                               ^~~
   fs/btrfs/extent_io.c:3411:4: note: Taking false branch
                           if (ret < 0)
                           ^
   fs/btrfs/extent_io.c:3418:3: note: Taking false branch
                   if (bio_flags & EXTENT_BIO_COMPRESSED)
                   ^
   fs/btrfs/extent_io.c:3423:12: note: Calling 'btrfs_bio_add_page'
                           added = btrfs_bio_add_page(bio_ctrl, page,
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3211:2: note: 'bio' initialized to a null pointer value
           struct bio *bio = bio_ctrl->bio;
           ^~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:3212:17: note: Dereference of null pointer
           u32 bio_size = bio->bi_iter.bi_size;
                          ^~~~~~~~~~~~~~~~~~~~
   fs/btrfs/extent_io.c:5698:4: warning: Value stored to 'ret' is never read 
[clang-analyzer-deadcode.DeadStores]
                           ret = 0;
                           ^     ~
   fs/btrfs/extent_io.c:5698:4: note: Value stored to 'ret' is never read
                           ret = 0;
                           ^     ~
   Suppressed 8 warnings (8 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   15 warnings generated.
   drivers/usb/dwc2/hcd.c:2893:2: warning: Value stored to 'qspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
           qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:2893:2: note: Value stored to 'qspcavail' is never 
read
           qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:2895:2: warning: Value stored to 'fspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
           fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:2895:2: note: Value stored to 'fspcavail' is never 
read
           fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3023:2: warning: Value stored to 'qspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
           qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3023:2: note: Value stored to 'qspcavail' is never 
read
           qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3025:2: warning: Value stored to 'fspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
           fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3025:2: note: Value stored to 'fspcavail' is never 
read
           fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
           ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3083:3: warning: Value stored to 'qspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
                   qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
                   ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3083:3: note: Value stored to 'qspcavail' is never 
read
                   qspcavail = (tx_status & TXSTS_QSPCAVAIL_MASK) >>
                   ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3085:3: warning: Value stored to 'fspcavail' is never 
read [clang-analyzer-deadcode.DeadStores]
                   fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
                   ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3085:3: note: Value stored to 'fspcavail' is never 
read
                   fspcavail = (tx_status & TXSTS_FSPCAVAIL_MASK) >>
                   ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3682:4: warning: Value stored to 'hprt0' is never 
read [clang-analyzer-deadcode.DeadStores]
                           hprt0 = dwc2_read_hprt0(hsotg);
                           ^       ~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:3682:4: note: Value stored to 'hprt0' is never read
                           hprt0 = dwc2_read_hprt0(hsotg);
                           ^       ~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:5679:2: warning: Value stored to 'hprt0' is never 
read [clang-analyzer-deadcode.DeadStores]
           hprt0 = dwc2_readl(hsotg, HPRT0);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/dwc2/hcd.c:5679:2: note: Value stored to 'hprt0' is never read
           hprt0 = dwc2_readl(hsotg, HPRT0);
           ^       ~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   7 warnings generated.
   Suppressed 7 warnings (7 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   11 warnings generated.
>> block/bfq-iosched.c:631:11: warning: Division by zero 
>> [clang-analyzer-core.DivideZero]
                   limit = DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
                           ^
   include/linux/math.h:92:26: note: expanded from macro 'DIV_ROUND_CLOSEST'
                   (((__x) + ((__d) / 2)) / (__d)) :       \
                                          ^
   block/bfq-iosched.c:672:27: note: Assuming 'bic' is non-null
           struct bfq_queue *bfqq = bic ? bic_to_bfqq(bic, op_is_sync(op)) : 
NULL;
                                    ^~~
   block/bfq-iosched.c:672:27: note: '?' condition is true
   block/bfq-iosched.c:677:6: note: Assuming the condition is true
           if (op_is_sync(op) && !op_is_write(op)) {
               ^~~~~~~~~~~~~~
   block/bfq-iosched.c:677:6: note: Left side of '&&' is true
   block/bfq-iosched.c:677:24: note: Assuming the condition is true
           if (op_is_sync(op) && !op_is_write(op)) {
                                 ^~~~~~~~~~~~~~~~
   block/bfq-iosched.c:677:2: note: Taking true branch
           if (op_is_sync(op) && !op_is_write(op)) {
           ^
   block/bfq-iosched.c:689:6: note: Assuming 'bfqq' is non-null
           if (bfqq && bfqq_request_over_limit(bfqq, limit))
               ^~~~
   block/bfq-iosched.c:689:6: note: Left side of '&&' is true
   block/bfq-iosched.c:689:14: note: Calling 'bfqq_request_over_limit'
           if (bfqq && bfqq_request_over_limit(bfqq, limit))
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   block/bfq-iosched.c:583:6: note: Assuming field 'on_st_or_in_serv' is true
           if (!entity->on_st_or_in_serv)
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   block/bfq-iosched.c:583:2: note: Taking false branch
           if (!entity->on_st_or_in_serv)
           ^
   block/bfq-iosched.c:588:6: note: Assuming 'depth' is <= 
BFQ_LIMIT_INLINE_DEPTH
           if (depth > BFQ_LIMIT_INLINE_DEPTH) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   block/bfq-iosched.c:588:2: note: Taking false branch
           if (depth > BFQ_LIMIT_INLINE_DEPTH) {
           ^
   block/bfq-iosched.c:598:2: note: Loop condition is true.  Entering loop body
           for_each_entity(entity) {
           ^
   block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
           for (; entity ; entity = entity->parent)
           ^
   block/bfq-iosched.c:604:7: note: Assuming field 'on_st_or_in_serv' is true
                   if (!entity->on_st_or_in_serv)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~
   block/bfq-iosched.c:604:3: note: Taking false branch
                   if (!entity->on_st_or_in_serv)
                   ^
   block/bfq-iosched.c:607:20: note: Assuming 'level' is < 'depth'
                   if (WARN_ON_ONCE(level >= depth))
                                    ^
   include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_on = !!(condition);                      \
                                  ^~~~~~~~~
   block/bfq-iosched.c:607:7: note: Taking false branch
                   if (WARN_ON_ONCE(level >= depth))
                       ^
   include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_on))                            \
           ^
   block/bfq-iosched.c:607:3: note: Taking false branch
                   if (WARN_ON_ONCE(level >= depth))
                   ^
   block/bfq-iosched.c:598:2: note: Loop condition is false. Execution 
continues on line 611
           for_each_entity(entity) {
           ^
   block/bfq-iosched.h:1028:2: note: expanded from macro 'for_each_entity'
           for (; entity ; entity = entity->parent)
           ^
   block/bfq-iosched.c:611:15: note: Assuming 'level' is equal to 'depth'
           WARN_ON_ONCE(level != depth);
                        ^
   include/asm-generic/bug.h:104:25: note: expanded from macro 'WARN_ON_ONCE'
           int __ret_warn_on = !!(condition);                      \
                                  ^~~~~~~~~
   block/bfq-iosched.c:611:2: note: Taking false branch
           WARN_ON_ONCE(level != depth);
           ^
   include/asm-generic/bug.h:105:2: note: expanded from macro 'WARN_ON_ONCE'
           if (unlikely(__ret_warn_on))                            \
           ^
   block/bfq-iosched.c:612:2: note: Loop condition is true.  Entering loop body
           for (level--; level >= 0; level--) {
           ^
   block/bfq-iosched.c:614:7: note: 'level' is <= 0
                   if (level > 0) {
                       ^~~~~
   block/bfq-iosched.c:614:3: note: Taking false branch
                   if (level > 0) {
                   ^
   block/bfq-iosched.c:625:4: note: The value 0 is assigned to 'wsum'
                           wsum = 0;
                           ^~~~~~~~
   block/bfq-iosched.c:626:16: note: Assuming 'i' is > 'class_idx'
                           for (i = 0; i <= class_idx; i++) {
                                       ^~~~~~~~~~~~~~
   block/bfq-iosched.c:626:4: note: Loop condition is false. Execution 
continues on line 631
                           for (i = 0; i <= class_idx; i++) {

vim +631 block/bfq-iosched.c

76f1df88bbc2f9 Jan Kara 2021-11-25  569  
76f1df88bbc2f9 Jan Kara 2021-11-25  570  #ifdef CONFIG_BFQ_GROUP_IOSCHED
76f1df88bbc2f9 Jan Kara 2021-11-25  571  static bool 
bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25  572  {
76f1df88bbc2f9 Jan Kara 2021-11-25  573         struct bfq_data *bfqd = 
bfqq->bfqd;
76f1df88bbc2f9 Jan Kara 2021-11-25  574         struct bfq_entity *entity = 
&bfqq->entity;
76f1df88bbc2f9 Jan Kara 2021-11-25  575         struct bfq_entity 
*inline_entities[BFQ_LIMIT_INLINE_DEPTH];
76f1df88bbc2f9 Jan Kara 2021-11-25  576         struct bfq_entity **entities = 
inline_entities;
76f1df88bbc2f9 Jan Kara 2021-11-25  577         int depth, level;
76f1df88bbc2f9 Jan Kara 2021-11-25  578         int class_idx = 
bfqq->ioprio_class - 1;
76f1df88bbc2f9 Jan Kara 2021-11-25  579         struct bfq_sched_data 
*sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25  580         unsigned long wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25  581         bool ret = false;
76f1df88bbc2f9 Jan Kara 2021-11-25  582  
76f1df88bbc2f9 Jan Kara 2021-11-25  583         if (!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25  584                 return false;
76f1df88bbc2f9 Jan Kara 2021-11-25  585  
76f1df88bbc2f9 Jan Kara 2021-11-25  586         /* +1 for bfqq entity, root 
cgroup not included */
76f1df88bbc2f9 Jan Kara 2021-11-25  587         depth = 
bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1;
76f1df88bbc2f9 Jan Kara 2021-11-25  588         if (depth > 
BFQ_LIMIT_INLINE_DEPTH) {
76f1df88bbc2f9 Jan Kara 2021-11-25  589                 entities = 
kmalloc_array(depth, sizeof(*entities), GFP_NOIO);
76f1df88bbc2f9 Jan Kara 2021-11-25  590                 if (!entities)
76f1df88bbc2f9 Jan Kara 2021-11-25  591                         return false;
76f1df88bbc2f9 Jan Kara 2021-11-25  592         }
76f1df88bbc2f9 Jan Kara 2021-11-25  593  
76f1df88bbc2f9 Jan Kara 2021-11-25  594         spin_lock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25  595         sched_data = entity->sched_data;
76f1df88bbc2f9 Jan Kara 2021-11-25  596         /* Gather our ancestors as we 
need to traverse them in reverse order */
76f1df88bbc2f9 Jan Kara 2021-11-25  597         level = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25  598         for_each_entity(entity) {
76f1df88bbc2f9 Jan Kara 2021-11-25  599                 /*
76f1df88bbc2f9 Jan Kara 2021-11-25  600                  * If at some level 
entity is not even active, allow request
76f1df88bbc2f9 Jan Kara 2021-11-25  601                  * queueing so that BFQ 
knows there's work to do and activate
76f1df88bbc2f9 Jan Kara 2021-11-25  602                  * entities.
76f1df88bbc2f9 Jan Kara 2021-11-25  603                  */
76f1df88bbc2f9 Jan Kara 2021-11-25  604                 if 
(!entity->on_st_or_in_serv)
76f1df88bbc2f9 Jan Kara 2021-11-25  605                         goto out;
76f1df88bbc2f9 Jan Kara 2021-11-25  606                 /* Uh, more parents 
than cgroup subsystem thinks? */
76f1df88bbc2f9 Jan Kara 2021-11-25  607                 if (WARN_ON_ONCE(level 
>= depth))
76f1df88bbc2f9 Jan Kara 2021-11-25  608                         break;
76f1df88bbc2f9 Jan Kara 2021-11-25  609                 entities[level++] = 
entity;
76f1df88bbc2f9 Jan Kara 2021-11-25  610         }
76f1df88bbc2f9 Jan Kara 2021-11-25  611         WARN_ON_ONCE(level != depth);
76f1df88bbc2f9 Jan Kara 2021-11-25  612         for (level--; level >= 0; 
level--) {
76f1df88bbc2f9 Jan Kara 2021-11-25  613                 entity = 
entities[level];
76f1df88bbc2f9 Jan Kara 2021-11-25  614                 if (level > 0) {
76f1df88bbc2f9 Jan Kara 2021-11-25  615                         wsum = 
bfq_entity_service_tree(entity)->wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25  616                 } else {
76f1df88bbc2f9 Jan Kara 2021-11-25  617                         int i;
76f1df88bbc2f9 Jan Kara 2021-11-25  618                         /*
76f1df88bbc2f9 Jan Kara 2021-11-25  619                          * For bfqq 
itself we take into account service trees
76f1df88bbc2f9 Jan Kara 2021-11-25  620                          * of all 
higher priority classes and multiply their
76f1df88bbc2f9 Jan Kara 2021-11-25  621                          * weights so 
that low prio queue from higher class
76f1df88bbc2f9 Jan Kara 2021-11-25  622                          * gets more 
requests than high prio queue from lower
76f1df88bbc2f9 Jan Kara 2021-11-25  623                          * class.
76f1df88bbc2f9 Jan Kara 2021-11-25  624                          */
76f1df88bbc2f9 Jan Kara 2021-11-25  625                         wsum = 0;
76f1df88bbc2f9 Jan Kara 2021-11-25  626                         for (i = 0; i 
<= class_idx; i++) {
76f1df88bbc2f9 Jan Kara 2021-11-25  627                                 wsum = 
wsum * IOPRIO_BE_NR +
76f1df88bbc2f9 Jan Kara 2021-11-25  628                                         
sched_data->service_tree[i].wsum;
76f1df88bbc2f9 Jan Kara 2021-11-25  629                         }
76f1df88bbc2f9 Jan Kara 2021-11-25  630                 }
76f1df88bbc2f9 Jan Kara 2021-11-25 @631                 limit = 
DIV_ROUND_CLOSEST(limit * entity->weight, wsum);
76f1df88bbc2f9 Jan Kara 2021-11-25  632                 if (entity->allocated 
>= limit) {
76f1df88bbc2f9 Jan Kara 2021-11-25  633                         
bfq_log_bfqq(bfqq->bfqd, bfqq,
76f1df88bbc2f9 Jan Kara 2021-11-25  634                                 "too 
many requests: allocated %d limit %d level %d",
76f1df88bbc2f9 Jan Kara 2021-11-25  635                                 
entity->allocated, limit, level);
76f1df88bbc2f9 Jan Kara 2021-11-25  636                         ret = true;
76f1df88bbc2f9 Jan Kara 2021-11-25  637                         break;
76f1df88bbc2f9 Jan Kara 2021-11-25  638                 }
76f1df88bbc2f9 Jan Kara 2021-11-25  639         }
76f1df88bbc2f9 Jan Kara 2021-11-25  640  out:
76f1df88bbc2f9 Jan Kara 2021-11-25  641         spin_unlock_irq(&bfqd->lock);
76f1df88bbc2f9 Jan Kara 2021-11-25  642         if (entities != inline_entities)
76f1df88bbc2f9 Jan Kara 2021-11-25  643                 kfree(entities);
76f1df88bbc2f9 Jan Kara 2021-11-25  644         return ret;
76f1df88bbc2f9 Jan Kara 2021-11-25  645  }
76f1df88bbc2f9 Jan Kara 2021-11-25  646  #else
76f1df88bbc2f9 Jan Kara 2021-11-25  647  static bool 
bfqq_request_over_limit(struct bfq_queue *bfqq, int limit)
76f1df88bbc2f9 Jan Kara 2021-11-25  648  {
76f1df88bbc2f9 Jan Kara 2021-11-25  649         return false;
76f1df88bbc2f9 Jan Kara 2021-11-25  650  }
76f1df88bbc2f9 Jan Kara 2021-11-25  651  #endif
76f1df88bbc2f9 Jan Kara 2021-11-25  652  

---
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