Hi Ming, kernel test robot noticed the following build warnings: [auto build test WARNING on axboe-block/for-next] [also build test WARNING on linus/master v6.6 next-20231109] [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#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Ming-Lei/block-don-t-call-into-iov_iter_revert-if-nothing-is-left/20231109-190100 base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next patch link: https://lore.kernel.org/r/20231109082827.2276696-3-ming.lei%40redhat.com patch subject: [PATCH V2 2/2] block: try to make aligned bio in case of big chunk IO config: arm-davinci_all_defconfig (https://download.01.org/0day-ci/archive/20231110/202311100354.HYfqOQ7o-lkp@xxxxxxxxx/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231110/202311100354.HYfqOQ7o-lkp@xxxxxxxxx/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202311100354.HYfqOQ7o-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): >> block/bio.c:1228:21: warning: variable 'size' is uninitialized when used here [-Wuninitialized] 1228 | return UINT_MAX - size; | ^~~~ block/bio.c:1221:19: note: initialize the variable 'size' to silence this warning 1221 | unsigned int size, predicted_space, max_bytes; | ^ | = 0 1 warning generated. Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for PINCTRL_SINGLE Depends on [n]: PINCTRL [=n] && OF [=y] && HAS_IOMEM [=y] Selected by [y]: - ARCH_DAVINCI [=y] && ARCH_MULTI_V5 [=y] && CPU_LITTLE_ENDIAN [=y] vim +/size +1228 block/bio.c 1212 1213 /* 1214 * Figure out max_size hint of iov_iter_extract_pages() for minimizing 1215 * bio & iov iter revert so that bio can be aligned with max io size. 1216 */ 1217 static unsigned int bio_get_buffer_size_hint(const struct bio *bio, 1218 unsigned int left) 1219 { 1220 unsigned int nr_bvecs = bio->bi_max_vecs - bio->bi_vcnt; 1221 unsigned int size, predicted_space, max_bytes; 1222 unsigned int space = nr_bvecs << PAGE_SHIFT; 1223 unsigned int align_deviation; 1224 1225 /* If we have enough space really, just try to get all pages */ 1226 if (!bio->bi_bdev || nr_bvecs >= (bio->bi_max_vecs / 4) || 1227 !bio->bi_vcnt || left <= space) > 1228 return UINT_MAX - size; 1229 1230 max_bytes = bdev_max_io_bytes(bio->bi_bdev); 1231 size = bio->bi_iter.bi_size; 1232 1233 /* 1234 * One bvec can hold physically continuous page frames with 1235 * multipage bvec and bytes in these pages can be pretty big, so 1236 * predict the available space by averaging bytes on all bvecs 1237 */ 1238 predicted_space = size * nr_bvecs / bio->bi_vcnt; 1239 /* 1240 * If predicted space is bigger than max io bytes and at least two 1241 * vectors left, ask for all pages 1242 */ 1243 if (predicted_space > max_bytes && nr_bvecs > 2) 1244 return UINT_MAX - size; 1245 1246 /* 1247 * This bio is close to be full, and stop to add pages if it is 1248 * basically aligned, otherwise just get & add pages if the bio 1249 * can be kept as aligned, so that we can minimize bio & iov iter 1250 * revert 1251 */ 1252 align_deviation = max_t(unsigned int, 16U * 1024, max_bytes / 16); 1253 if ((size & (max_bytes - 1)) > align_deviation) { 1254 unsigned aligned_bytes = max_bytes - (size & (max_bytes - 1)); 1255 1256 /* try to keep bio aligned if we have enough data and space */ 1257 if (aligned_bytes <= left && aligned_bytes <= predicted_space) 1258 return aligned_bytes; 1259 } 1260 1261 return 0; 1262 } 1263 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki