From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Keith Busch <kbusch@meta.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"shinichiro.kawasaki@wdc.com" <shinichiro.kawasaki@wdc.com>
Cc: Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv2 1/2] blktests: test direct io offsets
Date: Wed, 19 Nov 2025 23:48:47 +0000 [thread overview]
Message-ID: <ddda3d01-b95e-4798-b21d-a0c526b5b5a8@nvidia.com> (raw)
In-Reply-To: <20251119195449.2922332-2-kbusch@meta.com>
On 11/19/25 11:54, Keith Busch wrote:
> +static void test_invalid_dma_vector_length()
> +{
> + const int vecs = 4;
> +
> + bool should_fail = dma_alignment > 1;
> + struct iovec iov[vecs];
> + int ret;
> +
> + iov[0].iov_base = out_buf;
> + iov[0].iov_len = max_bytes * 2 - max_bytes / 2;
> +
> + iov[1].iov_base = out_buf + max_bytes * 4;
> + iov[1].iov_len = logical_block_size * 2 - (dma_alignment + 1);
> +
> + iov[2].iov_base = out_buf + max_bytes * 8;
> + iov[2].iov_len = logical_block_size * 2 + (dma_alignment + 1);
> +
> + iov[3].iov_base = out_buf + max_bytes * 12;
> + iov[3].iov_len = max_bytes - max_bytes / 2;
> +
> + ret = pwritev(test_fd, iov, vecs, 0);
> + if (ret < 0) {
> + if (should_fail)
> + return;
> + err(errno, "%s: failed to write buf", __func__);
> + }
> +
> + if (should_fail)
> + err(ENOTSUP, "%s: write buf unexpectedly succeeded with invalid DMA offset addressret:%d",
> + __func__, ret);
> +
> + iov[0].iov_base = in_buf;
> + iov[0].iov_len = max_bytes * 2 - max_bytes / 2;
> +
> + iov[1].iov_base = in_buf + max_bytes * 4;
> + iov[1].iov_len = logical_block_size * 2 - (dma_alignment + 1);
> +
> + iov[2].iov_base = in_buf + max_bytes * 8;
> + iov[2].iov_len = logical_block_size * 2 + (dma_alignment + 1);
> +
> + iov[3].iov_base = in_buf + max_bytes * 12;
> + iov[3].iov_len = max_bytes - max_bytes / 2;
> +
> + ret = pwritev(test_fd, iov, vecs, 0);
> + if (ret < 0)
> + err(errno, "%s: failed to read buf", __func__);
> +
is pwritev correct above or it should be preadv () ?
> + compare(out_buf, in_buf, iov[0].iov_len);
> + compare(out_buf + max_bytes * 4, in_buf + max_bytes * 4, iov[1].iov_len);
> + compare(out_buf + max_bytes * 8, in_buf + max_bytes * 8, iov[2].iov_len);
> + compare(out_buf + max_bytes * 12, in_buf + max_bytes * 12, iov[3].iov_len);
> +}
> +
-ck
next prev parent reply other threads:[~2025-11-19 23:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 19:54 [PATCHv2 0/2] blktests: add tests with offsets Keith Busch
2025-11-19 19:54 ` [PATCHv2 1/2] blktests: test direct io offsets Keith Busch
2025-11-19 23:39 ` Chaitanya Kulkarni
2025-11-19 23:48 ` Chaitanya Kulkarni [this message]
2025-11-19 23:59 ` Keith Busch
2025-11-20 0:56 ` Chaitanya Kulkarni
2025-11-20 14:32 ` Keith Busch
2025-11-25 11:26 ` Shinichiro Kawasaki
2025-11-25 16:42 ` Keith Busch
2025-12-02 10:22 ` Shinichiro Kawasaki
2025-11-19 19:54 ` [PATCHv2 2/2] blktests: test io_uring user metadata offsets Keith Busch
2025-11-19 23:39 ` Chaitanya Kulkarni
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=ddda3d01-b95e-4798-b21d-a0c526b5b5a8@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-block@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox