Re: [PATCH v3 5/5] lib: kunit_iov_iter: Add tests for extract_iter_to_sg
From: Christian A. Ehrhardt
Date: Tue Apr 21 2026 - 02:33:16 EST
Hi David,
On Tue, Apr 21, 2026 at 01:45:33PM +0800, David Gow wrote:
> Le 27/03/2026 à 05:49, Christian A. Ehrhardt a écrit :
> > Add test cases that test extract_iter_to_sg.
> >
> > For each iterator type an iterator is loaded with a suitable
> > buffer. The iterator is then extracted to a scatterlist with
> > multiple calls to extract_iter_to_sg. The final scatterlist
> > is copied into a scratch buffer.
> >
> > The test passes if the scratch buffer contains the same data
> > as the original buffer.
> >
> > The new tests demonstrate bugs in extract_iter_to_sg
> > for kvec and user iterators that are fixed by the previous
> > commits.
> >
> > Cc: David Howells <dhowells@xxxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Christian A. Ehrhardt <lk@xxxxxxx>
> > ---
>
> Hmm... this is failing on powerpc, where PAGE_SIZE is 64k:
>
> [13:20:40] # iov_kunit_iter_to_sg_kvec: ASSERTION FAILED at
Sorry about that! I wasn't aware of the large page size on powerpc.
This should fix it. I will prepare a proper patch but it would
be cool if you could verify that it actually helps.
Best regards,
Christian
diff --git a/lib/tests/kunit_iov_iter.c b/lib/tests/kunit_iov_iter.c
index 37bd6eb25896..f02f7b7aa796 100644
--- a/lib/tests/kunit_iov_iter.c
+++ b/lib/tests/kunit_iov_iter.c
@@ -1128,7 +1128,7 @@ static void __init iov_kunit_iter_to_sg_kvec(struct kunit *test)
struct kvec kvec;
size_t bufsize;
- bufsize = 0x100000;
+ bufsize = 0x200000;
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
kvec.iov_base = data.buffer;
@@ -1146,7 +1146,7 @@ static void __init iov_kunit_iter_to_sg_bvec(struct kunit *test)
struct bio_vec *bvec;
struct iov_iter iter;
- bufsize = 0x100000;
+ bufsize = 0x200000;
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
bvec = kunit_kmalloc_array(test, data.npages, sizeof(*bvec),
@@ -1173,7 +1173,7 @@ static void __init iov_kunit_iter_to_sg_folioq(struct kunit *test)
struct iov_iter iter;
size_t bufsize;
- bufsize = 0x100000;
+ bufsize = 0x200000;
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
folioq = iov_kunit_create_folioq(test);
@@ -1190,7 +1190,7 @@ static void __init iov_kunit_iter_to_sg_xarray(struct kunit *test)
struct iov_iter iter;
size_t bufsize;
- bufsize = 0x100000;
+ bufsize = 0x200000;
iov_kunit_iter_to_sg_init(test, bufsize, false, &data);
xarray = iov_kunit_create_xarray(test);
@@ -1206,7 +1206,7 @@ static void __init iov_kunit_iter_to_sg_ubuf(struct kunit *test)
struct iov_iter iter;
size_t bufsize;
- bufsize = 0x100000;
+ bufsize = 0x200000;
iov_kunit_iter_to_sg_init(test, bufsize, true, &data);
iov_iter_ubuf(&iter, READ, data.ubuf, bufsize);