Re: [PATCH v9 5/9] block: Make bio_iov_iter_get_pages() respect bio_required_sector_alignment()

From: kernel test robot
Date: Fri Jun 04 2021 - 22:55:41 EST


Hi Satya,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on ext4/dev f2fs/dev-test linus/master v5.13-rc4 next-20210604]
[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/Satya-Tangirala/add-support-for-direct-I-O-with-fscrypt-using-blk-crypto/20210605-051023
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: powerpc64-randconfig-r025-20210604 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5c0d1b2f902aa6a9cf47cc7e42c5b83bb2217cf9)
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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://github.com/0day-ci/linux/commit/eea1225f680da16dce01bfb2914b9e8b78de298d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Satya-Tangirala/add-support-for-direct-I-O-with-fscrypt-using-blk-crypto/20210605-051023
git checkout eea1225f680da16dce01bfb2914b9e8b78de298d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64

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

All errors (new ones prefixed by >>):

In file included from block/bio.c:5:
In file included from include/linux/mm.h:9:
In file included from include/linux/mmdebug.h:5:
In file included from include/linux/bug.h:5:
In file included from arch/powerpc/include/asm/bug.h:109:
In file included from include/asm-generic/bug.h:20:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:309:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^
>> block/bio.c:1131:10: error: implicit declaration of function 'bio_required_sector_alignment' [-Werror,-Wimplicit-function-declaration]
bio_required_sector_alignment(bio));
^
1 warning and 1 error generated.


vim +/bio_required_sector_alignment +1131 block/bio.c

1083
1084 /**
1085 * bio_iov_iter_get_pages - add user or kernel pages to a bio
1086 * @bio: bio to add pages to
1087 * @iter: iov iterator describing the region to be added
1088 *
1089 * This takes either an iterator pointing to user memory, or one pointing to
1090 * kernel pages (BVEC iterator). If we're adding user pages, we pin them and
1091 * map them into the kernel. On IO completion, the caller should put those
1092 * pages. For bvec based iterators bio_iov_iter_get_pages() uses the provided
1093 * bvecs rather than copying them. Hence anyone issuing kiocb based IO needs
1094 * to ensure the bvecs and pages stay referenced until the submitted I/O is
1095 * completed by a call to ->ki_complete() or returns with an error other than
1096 * -EIOCBQUEUED. The caller needs to check if the bio is flagged BIO_NO_PAGE_REF
1097 * on IO completion. If it isn't, then pages should be released.
1098 *
1099 * The function tries, but does not guarantee, to pin as many pages as
1100 * fit into the bio, or are requested in @iter, whatever is smaller. If
1101 * MM encounters an error pinning the requested pages, it stops. Error
1102 * is returned only if 0 pages could be pinned. It also ensures that the number
1103 * of sectors added to the bio is aligned to bio_required_sector_alignment().
1104 *
1105 * It's intended for direct IO, so doesn't do PSI tracking, the caller is
1106 * responsible for setting BIO_WORKINGSET if necessary.
1107 */
1108 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
1109 {
1110 int ret = 0;
1111 unsigned int aligned_sectors;
1112
1113 if (iov_iter_is_bvec(iter)) {
1114 if (bio_op(bio) == REQ_OP_ZONE_APPEND)
1115 return bio_iov_bvec_set_append(bio, iter);
1116 return bio_iov_bvec_set(bio, iter);
1117 }
1118
1119 do {
1120 if (bio_op(bio) == REQ_OP_ZONE_APPEND)
1121 ret = __bio_iov_append_get_pages(bio, iter);
1122 else
1123 ret = __bio_iov_iter_get_pages(bio, iter);
1124 } while (!ret && iov_iter_count(iter) && !bio_full(bio, 0));
1125
1126 /*
1127 * Ensure that number of sectors in bio is aligned to
1128 * bio_required_sector_align()
1129 */
1130 aligned_sectors = round_down(bio_sectors(bio),
> 1131 bio_required_sector_alignment(bio));
1132 iov_iter_revert(iter, (bio_sectors(bio) - aligned_sectors) << SECTOR_SHIFT);
1133 bio_truncate(bio, aligned_sectors << SECTOR_SHIFT);
1134
1135 /* don't account direct I/O as memory stall */
1136 bio_clear_flag(bio, BIO_WORKINGSET);
1137 return bio->bi_vcnt ? 0 : ret;
1138 }
1139 EXPORT_SYMBOL_GPL(bio_iov_iter_get_pages);
1140

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

Attachment: .config.gz
Description: application/gzip