* New kernel warning triggered by blktests @ 2021-04-23 20:38 Bart Van Assche 2021-04-23 21:43 ` Jens Axboe 0 siblings, 1 reply; 3+ messages in thread From: Bart Van Assche @ 2021-04-23 20:38 UTC (permalink / raw) To: Changheun Lee; +Cc: linux-block Hi Changheun, If I run blktest srp/001 then a kernel warning appears that I haven't seen before. I think this is a side-effect of the patch that limits the bio size. Please take a look. Thanks, Bart. WARNING: CPU: 1 PID: 15449 at block/bio.c:1034 __bio_iov_iter_get_pages+0x324/0x350 Call Trace: bio_iov_iter_get_pages+0x6c/0x360 __blkdev_direct_IO_simple+0x291/0x580 blkdev_direct_IO+0xb5/0xc0 generic_file_direct_write+0x10d/0x290 __generic_file_write_iter+0x120/0x290 blkdev_write_iter+0x16e/0x280 new_sync_write+0x268/0x380 vfs_write+0x3e0/0x4f0 ksys_write+0xd9/0x180 __x64_sys_write+0x43/0x50 do_syscall_64+0x32/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: New kernel warning triggered by blktests 2021-04-23 20:38 New kernel warning triggered by blktests Bart Van Assche @ 2021-04-23 21:43 ` Jens Axboe 2021-04-24 2:39 ` Bart Van Assche 0 siblings, 1 reply; 3+ messages in thread From: Jens Axboe @ 2021-04-23 21:43 UTC (permalink / raw) To: Bart Van Assche, Changheun Lee; +Cc: linux-block On 4/23/21 2:38 PM, Bart Van Assche wrote: > Hi Changheun, > > If I run blktest srp/001 then a kernel warning appears that I haven't > seen before. I think this is a side-effect of the patch that limits the > bio size. Please take a look. > > Thanks, > > Bart. > > WARNING: CPU: 1 PID: 15449 at block/bio.c:1034 > __bio_iov_iter_get_pages+0x324/0x350 > Call Trace: > bio_iov_iter_get_pages+0x6c/0x360 > __blkdev_direct_IO_simple+0x291/0x580 > blkdev_direct_IO+0xb5/0xc0 > generic_file_direct_write+0x10d/0x290 > __generic_file_write_iter+0x120/0x290 > blkdev_write_iter+0x16e/0x280 > new_sync_write+0x268/0x380 > vfs_write+0x3e0/0x4f0 > ksys_write+0xd9/0x180 > __x64_sys_write+0x43/0x50 > do_syscall_64+0x32/0x80 > entry_SYSCALL_64_after_hwframe+0x44/0xae I wonder if this is a case of violating "must always be able to add a page"? Bart, does the below change anything? diff --git a/include/linux/bio.h b/include/linux/bio.h index f1a99f0a240c..c6428c9f9bf7 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -121,7 +121,8 @@ static inline bool bio_full(struct bio *bio, unsigned len) if (bio->bi_vcnt >= bio->bi_max_vecs) return true; - if (bio->bi_iter.bi_size > bio_max_size(bio) - len) + if (bio->bi_iter.bi_size && + bio->bi_iter.bi_size > bio_max_size(bio) - len) return true; return false; -- Jens Axboe ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: New kernel warning triggered by blktests 2021-04-23 21:43 ` Jens Axboe @ 2021-04-24 2:39 ` Bart Van Assche 0 siblings, 0 replies; 3+ messages in thread From: Bart Van Assche @ 2021-04-24 2:39 UTC (permalink / raw) To: Jens Axboe, Changheun Lee; +Cc: linux-block On 4/23/21 2:43 PM, Jens Axboe wrote: > I wonder if this is a case of violating "must always be able to add a page"? > Bart, does the below change anything? > > diff --git a/include/linux/bio.h b/include/linux/bio.h > index f1a99f0a240c..c6428c9f9bf7 100644 > --- a/include/linux/bio.h > +++ b/include/linux/bio.h > @@ -121,7 +121,8 @@ static inline bool bio_full(struct bio *bio, unsigned len) > if (bio->bi_vcnt >= bio->bi_max_vecs) > return true; > > - if (bio->bi_iter.bi_size > bio_max_size(bio) - len) > + if (bio->bi_iter.bi_size && > + bio->bi_iter.bi_size > bio_max_size(bio) - len) > return true; > > return false; Hi Jens, Thank you for having taken a look. If I apply the following debug patch: --- a/block/bio.c +++ b/block/bio.c @@ -1031,8 +1031,13 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) if (same_page) put_page(page); } else { - if (WARN_ON_ONCE(bio_full(bio, len))) + if (WARN_ON_ONCE(bio_full(bio, len))) { + pr_info("bi_vcnt %u/%u; bi_size %u/%u; len %u\n", + bio->bi_vcnt, bio->bi_max_vecs, + bio->bi_iter.bi_size, bio_max_size(bio), + len); return -EINVAL; + } __bio_add_page(bio, page, len, offset); } offset = 0; then the following output appears: bi_vcnt 12/256; bi_size 126976/130560; len 4096 so I don't think that the above patch would help. What is remarkable is that test srp/001 does not submit any I/O towards the block device associated with the SRP initiator (other than a partition table read). I think this that the following command from tests/srp/rc triggers the kernel warning: dd if=/dev/zero of="${r}" bs=1M count=$((ramdisk_size>>20)) "${oflag[@]}" >/dev/null 2>&1 || return $? That dd command writes to a null_blk instance. After having added another debug print statement, the following appeared in the kernel log: Apr 23 19:08:04 ubuntu-vm kernel: null_blk: module loaded Apr 23 19:08:04 ubuntu-vm kernel: blk_queue_max_hw_sectors: max_hw_sectors = 255; max_sectors = 255; bio_max_bytes = 130560 Apr 23 19:08:04 ubuntu-vm kernel: blk_queue_max_hw_sectors: max_hw_sectors = 255; max_sectors = 255; bio_max_bytes = 130560 That's the same 130560 byte limit as in the previous print statement. Bart. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-24 2:40 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-23 20:38 New kernel warning triggered by blktests Bart Van Assche 2021-04-23 21:43 ` Jens Axboe 2021-04-24 2:39 ` Bart Van Assche
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.