CC: [email protected] CC: [email protected] BCC: [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/torvalds/linux.git master head: 3bf7edc84a9eb4007dd9a0cb8878a7e1d5ec6a3b commit: 76f1df88bbc2f984eb0418cc90de0a8384e63604 bfq: Limit number of requests consumed by each cgroup date: 3 months ago :::::: branch date: 14 hours ago :::::: commit date: 3 months ago config: riscv-randconfig-c006-20220309 (https://download.01.org/0day-ci/archive/20220310/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 276ca87382b8f16a65bddac700202924228982f6) 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/torvalds/linux.git/commit/?id=76f1df88bbc2f984eb0418cc90de0a8384e63604 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master 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 >>) ^~~ drivers/i2c/i2c-core-smbus.c:541:2: note: Taking true branch if (res) ^ drivers/i2c/i2c-core-smbus.c:542:3: note: Returning without writing to 'data->byte' return res; ^ drivers/i2c/i2c-core-smbus.c:141:11: note: Returning from 'i2c_smbus_xfer' status = i2c_smbus_xfer(client->adapter, client->addr, client->flags, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:144:10: note: Assuming 'status' is >= 0 return (status < 0) ? status : data.byte; ^~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:144:9: note: '?' condition is false return (status < 0) ? status : data.byte; ^ drivers/i2c/i2c-core-smbus.c:144:2: note: Undefined or garbage value returned to caller return (status < 0) ? status : data.byte; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:184:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] return (status < 0) ? status : data.word; ^ drivers/i2c/i2c-core-smbus.c:645:6: note: Assuming 'length' is <= I2C_SMBUS_BLOCK_MAX if (length > I2C_SMBUS_BLOCK_MAX) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:645:2: note: Taking false branch if (length > I2C_SMBUS_BLOCK_MAX) ^ drivers/i2c/i2c-core-smbus.c:648:2: note: Taking false branch if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) ^ drivers/i2c/i2c-core-smbus.c:651:2: note: Taking false branch if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) ^ drivers/i2c/i2c-core-smbus.c:654:2: note: Taking true branch if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_WORD_DATA)) { ^ drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true while ((i + 2) <= length) { ^~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body while ((i + 2) <= length) { ^ drivers/i2c/i2c-core-smbus.c:657:8: note: 'status' is >= 0 if (status < 0) ^~~~~~ drivers/i2c/i2c-core-smbus.c:657:4: note: Taking false branch if (status < 0) ^ drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true while ((i + 2) <= length) { ^~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body while ((i + 2) <= length) { ^ drivers/i2c/i2c-core-smbus.c:657:8: note: 'status' is >= 0 if (status < 0) ^~~~~~ drivers/i2c/i2c-core-smbus.c:657:4: note: Taking false branch if (status < 0) ^ drivers/i2c/i2c-core-smbus.c:655:10: note: Assuming the condition is true while ((i + 2) <= length) { ^~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:655:3: note: Loop condition is true. Entering loop body while ((i + 2) <= length) { ^ drivers/i2c/i2c-core-smbus.c:656:13: note: Calling 'i2c_smbus_read_word_data' status = i2c_smbus_read_word_data(client, command + i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:181:11: note: Calling 'i2c_smbus_xfer' status = i2c_smbus_xfer(client->adapter, client->addr, client->flags, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:541:6: note: Assuming 'res' is not equal to 0 if (res) ^~~ drivers/i2c/i2c-core-smbus.c:541:2: note: Taking true branch if (res) ^ drivers/i2c/i2c-core-smbus.c:542:3: note: Returning without writing to 'data->word' return res; ^ drivers/i2c/i2c-core-smbus.c:181:11: note: Returning from 'i2c_smbus_xfer' status = i2c_smbus_xfer(client->adapter, client->addr, client->flags, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:184:10: note: Assuming 'status' is >= 0 return (status < 0) ? status : data.word; ^~~~~~~~~~ drivers/i2c/i2c-core-smbus.c:184:9: note: '?' condition is false return (status < 0) ? status : data.word; ^ drivers/i2c/i2c-core-smbus.c:184:2: note: Undefined or garbage value returned to caller return (status < 0) ? status : data.word; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppressed 13 warnings (6 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 14 warnings generated. Suppressed 14 warnings (7 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 19 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 https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
