From: kernel test robot <lkp@intel.com> To: kbuild@lists.01.org Subject: Re: [PATCH v2] virtio_blk: Add support for lifetime feature Date: Wed, 21 Apr 2021 23:59:21 +0800 [thread overview] Message-ID: <202104212344.T6aJYqNQ-lkp@intel.com> (raw) [-- Attachment #1: Type: text/plain, Size: 8595 bytes --] CC: kbuild-all(a)lists.01.org In-Reply-To: <20210416194709.155497-1-egranata@google.com> References: <20210416194709.155497-1-egranata@google.com> TO: Enrico Granata <egranata@google.com> 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-rc8] [cannot apply to vhost/linux-next next-20210421] [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 :::::: branch date: 5 days ago :::::: commit date: 5 days ago config: i386-randconfig-m021-20210421 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> New smatch warnings: drivers/block/virtio_blk.c:256 virtio_queue_rq() error: uninitialized symbol 'type'. Old smatch warnings: drivers/block/virtio_blk.c:258 virtio_queue_rq() error: uninitialized symbol 'type'. vim +/type +256 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 [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 33215 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: kbuild-all@lists.01.org Subject: Re: [PATCH v2] virtio_blk: Add support for lifetime feature Date: Thu, 29 Apr 2021 13:04:45 +0300 [thread overview] Message-ID: <202104212344.T6aJYqNQ-lkp@intel.com> (raw) In-Reply-To: <20210416194709.155497-1-egranata@google.com> [-- Attachment #1: Type: text/plain, Size: 8065 bytes --] Hi Enrico, 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: i386-randconfig-m021-20210421 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> New smatch warnings: drivers/block/virtio_blk.c:256 virtio_queue_rq() error: uninitialized symbol 'type'. Old smatch warnings: drivers/block/virtio_blk.c:258 virtio_queue_rq() error: uninitialized symbol 'type'. vim +/type +256 drivers/block/virtio_blk.c 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); This is a false positive, and it fc90f60f9bc3b5 Enrico Granata 2021-04-16 257 aebf526b53aea1 Christoph Hellwig 2017-01-31 258 vbr->out_hdr.sector = type ? ^^^^ ends up hiding this real bug because Smatch only prints one warning for these. :( 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) { Used again here. 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 } --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
next reply other threads:[~2021-04-21 15:59 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-21 15:59 kernel test robot [this message] 2021-04-29 10:04 ` [PATCH v2] virtio_blk: Add support for lifetime feature Dan Carpenter -- strict thread matches above, loose matches on Subject: below -- 2021-04-16 19:47 Enrico Granata 2021-04-17 2:42 ` kernel test robot 2021-04-20 7:01 ` Christoph Hellwig 2021-04-20 7:01 ` Christoph Hellwig 2021-04-20 10:08 ` Michael S. Tsirkin 2021-04-20 10:08 ` Michael S. Tsirkin 2021-04-20 16:28 ` Enrico Granata 2021-04-20 16:41 ` Cornelia Huck 2021-04-20 16:41 ` Cornelia Huck
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=202104212344.T6aJYqNQ-lkp@intel.com \ --to=lkp@intel.com \ --cc=kbuild@lists.01.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.