Hi Enrico, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on block/for-next] [also build test WARNING on linus/master v5.12-rc7] [cannot apply to vhost/linux-next next-20210416] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Enrico-Granata/virtio_blk-Add-support-for-lifetime-feature/20210417-034754 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next config: x86_64-randconfig-a004-20210416 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6a18cc23efad410db48a3ccfc233d215de7d4cb9) 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 x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/fc90f60f9bc3b5165dc34acaabc80559e1fbcb5e git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Enrico-Granata/virtio_blk-Add-support-for-lifetime-feature/20210417-034754 git checkout fc90f60f9bc3b5165dc34acaabc80559e1fbcb5e # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> drivers/block/virtio_blk.c:248:7: warning: variable 'type' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] case REQ_OP_DRV_IN: ^~~~~~~~~~~~~ drivers/block/virtio_blk.c:258:24: note: uninitialized use occurs here vbr->out_hdr.sector = type ? ^~~~ drivers/block/virtio_blk.c:229:10: note: initialize the variable 'type' to silence this warning u32 type; ^ = 0 1 warning generated. vim +/type +248 drivers/block/virtio_blk.c 944e7c87967c82 Jens Axboe 2018-11-26 216 fc17b6534eb839 Christoph Hellwig 2017-06-03 217 static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, 74c450521dd8d2 Jens Axboe 2014-10-29 218 const struct blk_mq_queue_data *bd) e467cde238184d Rusty Russell 2007-10-22 219 { 1cf7e9c68fe842 Jens Axboe 2013-11-01 220 struct virtio_blk *vblk = hctx->queue->queuedata; 74c450521dd8d2 Jens Axboe 2014-10-29 221 struct request *req = bd->rq; 9d74e25737d73e Christoph Hellwig 2014-04-14 222 struct virtblk_req *vbr = blk_mq_rq_to_pdu(req); 1cf7e9c68fe842 Jens Axboe 2013-11-01 223 unsigned long flags; 20af3cfd20145f Paolo Bonzini 2013-03-20 224 unsigned int num; 6a27b656fc0210 Ming Lei 2014-06-26 225 int qid = hctx->queue_num; 5261b85e586afe Rusty Russell 2014-03-13 226 int err; e8edca6f7f9223 Ming Lei 2014-05-30 227 bool notify = false; 1f23816b8eb8fd Changpeng Liu 2018-11-01 228 bool unmap = false; aebf526b53aea1 Christoph Hellwig 2017-01-31 229 u32 type; e467cde238184d Rusty Russell 2007-10-22 230 1cf7e9c68fe842 Jens Axboe 2013-11-01 231 BUG_ON(req->nr_phys_segments + 2 > vblk->sg_elems); e467cde238184d Rusty Russell 2007-10-22 232 aebf526b53aea1 Christoph Hellwig 2017-01-31 233 switch (req_op(req)) { aebf526b53aea1 Christoph Hellwig 2017-01-31 234 case REQ_OP_READ: aebf526b53aea1 Christoph Hellwig 2017-01-31 235 case REQ_OP_WRITE: aebf526b53aea1 Christoph Hellwig 2017-01-31 236 type = 0; f1b0ef06260271 Christoph Hellwig 2009-09-17 237 break; aebf526b53aea1 Christoph Hellwig 2017-01-31 238 case REQ_OP_FLUSH: aebf526b53aea1 Christoph Hellwig 2017-01-31 239 type = VIRTIO_BLK_T_FLUSH; f1b0ef06260271 Christoph Hellwig 2009-09-17 240 break; 1f23816b8eb8fd Changpeng Liu 2018-11-01 241 case REQ_OP_DISCARD: 1f23816b8eb8fd Changpeng Liu 2018-11-01 242 type = VIRTIO_BLK_T_DISCARD; 1f23816b8eb8fd Changpeng Liu 2018-11-01 243 break; 1f23816b8eb8fd Changpeng Liu 2018-11-01 244 case REQ_OP_WRITE_ZEROES: 1f23816b8eb8fd Changpeng Liu 2018-11-01 245 type = VIRTIO_BLK_T_WRITE_ZEROES; 1f23816b8eb8fd Changpeng Liu 2018-11-01 246 unmap = !(req->cmd_flags & REQ_NOUNMAP); 1f23816b8eb8fd Changpeng Liu 2018-11-01 247 break; aebf526b53aea1 Christoph Hellwig 2017-01-31 @248 case REQ_OP_DRV_IN: fc90f60f9bc3b5 Enrico Granata 2021-04-16 249 break; /* type already set for custom requests */ f1b0ef06260271 Christoph Hellwig 2009-09-17 250 default: aebf526b53aea1 Christoph Hellwig 2017-01-31 251 WARN_ON_ONCE(1); fc17b6534eb839 Christoph Hellwig 2017-06-03 252 return BLK_STS_IOERR; dd40e456a40ebb FUJITA Tomonori 2010-07-03 253 } e467cde238184d Rusty Russell 2007-10-22 254 fc90f60f9bc3b5 Enrico Granata 2021-04-16 255 if (req_op(req) != REQ_OP_DRV_IN) aebf526b53aea1 Christoph Hellwig 2017-01-31 256 vbr->out_hdr.type = cpu_to_virtio32(vblk->vdev, type); fc90f60f9bc3b5 Enrico Granata 2021-04-16 257 aebf526b53aea1 Christoph Hellwig 2017-01-31 258 vbr->out_hdr.sector = type ? aebf526b53aea1 Christoph Hellwig 2017-01-31 259 0 : cpu_to_virtio64(vblk->vdev, blk_rq_pos(req)); aebf526b53aea1 Christoph Hellwig 2017-01-31 260 vbr->out_hdr.ioprio = cpu_to_virtio32(vblk->vdev, req_get_ioprio(req)); aebf526b53aea1 Christoph Hellwig 2017-01-31 261 e2490073cd7c3d Christoph Hellwig 2014-09-13 262 blk_mq_start_request(req); e2490073cd7c3d Christoph Hellwig 2014-09-13 263 1f23816b8eb8fd Changpeng Liu 2018-11-01 264 if (type == VIRTIO_BLK_T_DISCARD || type == VIRTIO_BLK_T_WRITE_ZEROES) { 1f23816b8eb8fd Changpeng Liu 2018-11-01 265 err = virtblk_setup_discard_write_zeroes(req, unmap); 1f23816b8eb8fd Changpeng Liu 2018-11-01 266 if (err) 1f23816b8eb8fd Changpeng Liu 2018-11-01 267 return BLK_STS_RESOURCE; 1f23816b8eb8fd Changpeng Liu 2018-11-01 268 } 1f23816b8eb8fd Changpeng Liu 2018-11-01 269 85dada09eeb31c Christoph Hellwig 2017-01-28 270 num = blk_rq_map_sg(hctx->queue, req, vbr->sg); 1cde26f928863d Hannes Reinecke 2009-05-18 271 if (num) { 85dada09eeb31c Christoph Hellwig 2017-01-28 272 if (rq_data_dir(req) == WRITE) 19c1c5a64c3b8e Michael S. Tsirkin 2014-10-07 273 vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_OUT); 20af3cfd20145f Paolo Bonzini 2013-03-20 274 else 19c1c5a64c3b8e Michael S. Tsirkin 2014-10-07 275 vbr->out_hdr.type |= cpu_to_virtio32(vblk->vdev, VIRTIO_BLK_T_IN); e467cde238184d Rusty Russell 2007-10-22 276 } e467cde238184d Rusty Russell 2007-10-22 277 6a27b656fc0210 Ming Lei 2014-06-26 278 spin_lock_irqsave(&vblk->vqs[qid].lock, flags); 97b50a654d5de5 Christoph Hellwig 2017-01-28 279 err = virtblk_add_req(vblk->vqs[qid].vq, vbr, vbr->sg, num); 5261b85e586afe Rusty Russell 2014-03-13 280 if (err) { 6a27b656fc0210 Ming Lei 2014-06-26 281 virtqueue_kick(vblk->vqs[qid].vq); f5f6b95c72f7f8 Halil Pasic 2020-02-13 282 /* Don't stop the queue if -ENOMEM: we may have failed to f5f6b95c72f7f8 Halil Pasic 2020-02-13 283 * bounce the buffer due to global resource outage. f5f6b95c72f7f8 Halil Pasic 2020-02-13 284 */ f5f6b95c72f7f8 Halil Pasic 2020-02-13 285 if (err == -ENOSPC) 1cf7e9c68fe842 Jens Axboe 2013-11-01 286 blk_mq_stop_hw_queue(hctx); 6a27b656fc0210 Ming Lei 2014-06-26 287 spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); 3d973b2e9a6259 Halil Pasic 2020-02-13 288 switch (err) { 3d973b2e9a6259 Halil Pasic 2020-02-13 289 case -ENOSPC: 86ff7c2a80cd35 Ming Lei 2018-01-30 290 return BLK_STS_DEV_RESOURCE; 3d973b2e9a6259 Halil Pasic 2020-02-13 291 case -ENOMEM: 3d973b2e9a6259 Halil Pasic 2020-02-13 292 return BLK_STS_RESOURCE; 3d973b2e9a6259 Halil Pasic 2020-02-13 293 default: fc17b6534eb839 Christoph Hellwig 2017-06-03 294 return BLK_STS_IOERR; e467cde238184d Rusty Russell 2007-10-22 295 } 3d973b2e9a6259 Halil Pasic 2020-02-13 296 } e467cde238184d Rusty Russell 2007-10-22 297 74c450521dd8d2 Jens Axboe 2014-10-29 298 if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq)) e8edca6f7f9223 Ming Lei 2014-05-30 299 notify = true; 6a27b656fc0210 Ming Lei 2014-06-26 300 spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); e8edca6f7f9223 Ming Lei 2014-05-30 301 e8edca6f7f9223 Ming Lei 2014-05-30 302 if (notify) 6a27b656fc0210 Ming Lei 2014-06-26 303 virtqueue_notify(vblk->vqs[qid].vq); fc17b6534eb839 Christoph Hellwig 2017-06-03 304 return BLK_STS_OK; a98755c559e0e9 Asias He 2012-08-08 305 } a98755c559e0e9 Asias He 2012-08-08 306 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org