block/blk-mq.c:1063:9: sparse: sparse: cast from restricted req_flags_t

From: kernel test robot
Date: Tue Nov 02 2021 - 05:43:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bfc484fe6abba4b89ec9330e0e68778e2a9856b2
commit: 128459062bc994355027e190477c432ec5b5638a block: cache rq_flags inside blk_mq_rq_ctx_init()
date: 2 weeks ago
config: mips-randconfig-s031-20211101 (attached as .config)
compiler: mips64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=128459062bc994355027e190477c432ec5b5638a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 128459062bc994355027e190477c432ec5b5638a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
block/blk-mq.c:324:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int rq_flags @@ got restricted req_flags_t [usertype] @@
block/blk-mq.c:324:26: sparse: expected unsigned int rq_flags
block/blk-mq.c:324:26: sparse: got restricted req_flags_t [usertype]
block/blk-mq.c:333:26: sparse: sparse: invalid assignment: |=
block/blk-mq.c:333:26: sparse: left side has type unsigned int
block/blk-mq.c:333:26: sparse: right side has type restricted req_flags_t
block/blk-mq.c:335:26: sparse: sparse: invalid assignment: |=
block/blk-mq.c:335:26: sparse: left side has type unsigned int
block/blk-mq.c:335:26: sparse: right side has type restricted req_flags_t
block/blk-mq.c:336:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted req_flags_t [usertype] rq_flags @@ got unsigned int rq_flags @@
block/blk-mq.c:336:22: sparse: expected restricted req_flags_t [usertype] rq_flags
block/blk-mq.c:336:22: sparse: got unsigned int rq_flags
>> block/blk-mq.c:1063:9: sparse: sparse: cast from restricted req_flags_t

vim +1063 block/blk-mq.c

6fca6a611c27f1 Christoph Hellwig 2014-05-28 1052
2b053aca76b48e Bart Van Assche 2016-10-28 1053 void blk_mq_add_to_requeue_list(struct request *rq, bool at_head,
2b053aca76b48e Bart Van Assche 2016-10-28 1054 bool kick_requeue_list)
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1055 {
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1056 struct request_queue *q = rq->q;
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1057 unsigned long flags;
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1058
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1059 /*
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1060 * We abuse this flag that is otherwise used by the I/O scheduler to
ff821d271415f1 Jens Axboe 2017-11-10 1061 * request head insertion from the workqueue.
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1062 */
e806402130c9c4 Christoph Hellwig 2016-10-20 @1063 BUG_ON(rq->rq_flags & RQF_SOFTBARRIER);
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1064
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1065 spin_lock_irqsave(&q->requeue_lock, flags);
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1066 if (at_head) {
e806402130c9c4 Christoph Hellwig 2016-10-20 1067 rq->rq_flags |= RQF_SOFTBARRIER;
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1068 list_add(&rq->queuelist, &q->requeue_list);
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1069 } else {
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1070 list_add_tail(&rq->queuelist, &q->requeue_list);
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1071 }
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1072 spin_unlock_irqrestore(&q->requeue_lock, flags);
2b053aca76b48e Bart Van Assche 2016-10-28 1073
2b053aca76b48e Bart Van Assche 2016-10-28 1074 if (kick_requeue_list)
2b053aca76b48e Bart Van Assche 2016-10-28 1075 blk_mq_kick_requeue_list(q);
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1076 }
6fca6a611c27f1 Christoph Hellwig 2014-05-28 1077

:::::: The code at line 1063 was first introduced by commit
:::::: e806402130c9c494e22c73ae9ead4e79d2a5811c block: split out request-only flags into a new namespace

:::::: TO: Christoph Hellwig <hch@xxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip