From: Ming Lei <tom.leiming@gmail.com>
To: Yoav Cohen <yoav@nvidia.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, csander@purestorage.com,
jholzman@nvidia.com, omril@nvidia.com, ofer@nvidia.com
Subject: Re: [PATCH v3 2/2] selftests: ublk: add rq_affinity test
Date: Mon, 26 Oct 2026 09:45:16 -0500 [thread overview]
Message-ID: <at9nfH-P1RDoZUvr@fedora-laptop> (raw)
In-Reply-To: <20261026120619.47629-3-yoav@nvidia.com>
On Mon, Oct 26, 2026 at 02:06:19PM +0200, Yoav Cohen wrote:
> Add UBLK_F_SUPPORT_RQ_AFFINITY to kublk's feature table and a
> --rq_affinity flag to request it at ADD_DEV time, and add
> test_generic_18.sh: writes and verifies data on a loop device with
> I/O pinned to one CPU while cycling rq_affinity through 0, 1 and 2.
> Skipped on kernels without UBLK_F_SUPPORT_RQ_AFFINITY.
>
> Signed-off-by: Yoav Cohen <yoav@nvidia.com>
> ---
> tools/testing/selftests/ublk/Makefile | 1 +
> tools/testing/selftests/ublk/kublk.c | 6 ++-
> .../testing/selftests/ublk/test_generic_18.sh | 42 +++++++++++++++++++
> 3 files changed, 48 insertions(+), 1 deletion(-)
> create mode 100755 tools/testing/selftests/ublk/test_generic_18.sh
...
> diff --git a/tools/testing/selftests/ublk/test_generic_18.sh b/tools/testing/selftests/ublk/test_generic_18.sh
> new file mode 100755
> index 000000000000..c899a5bf0364
> --- /dev/null
> +++ b/tools/testing/selftests/ublk/test_generic_18.sh
Please rebase on latest linus tree and rename to test_generic_19.sh, 18 has
been taken already.
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
> +
> +ERR_CODE=0
> +
> +if ! _have_program fio; then
> + exit "$UBLK_SKIP_CODE"
> +fi
> +
> +if ! _have_feature "SUPPORT_RQ_AFFINITY"; then
> + exit "$UBLK_SKIP_CODE"
> +fi
> +
> +_prep_test "loop" "write and verify I/O across rq_affinity settings"
> +
> +_create_backfile 0 256M
> +
> +dev_id=$(_add_ublk_dev -t loop --rq_affinity "${UBLK_BACKFILES[0]}")
> +_check_add_dev $TID $?
> +
> +rq_affinity_path=/sys/block/ublkb"${dev_id}"/queue/rq_affinity
> +
> +for affinity in 0 1 2; do
> + echo "${affinity}" > "${rq_affinity_path}"
> +
> + # Pin submission to a single CPU so rq_affinity has somewhere to
> + # redirect completion to.
> + taskset -c 0 fio --name=verify --rw=randwrite --direct=1 \
> + --ioengine=libaio --bs=8k --iodepth=32 --verify=crc32c \
> + --do_verify=1 --verify_state_save=0 \
> + --filename=/dev/ublkb"${dev_id}" --size=256M > /dev/null
This doesn't cover the remote completion path: kublk pins the queue 0
thread to the first CPU of its hctx mask, which is CPU 0 here, so the
request is completed inline for all three rq_affinity values.
Please use single queue and submit from the last CPU in
/sys/block/ublkb${dev_id}/mq/0/cpu_list, then rq_affinity=2 always takes
the IPI path. I verified that way across copy, zero copy, auto_zc, user
copy and batch modes, all pass.
Thanks,
Ming
prev parent reply other threads:[~2026-10-26 14:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 12:06 [PATCH v3 0/2] ublk: honor rq_affinity on request completion Yoav Cohen
2026-10-26 12:06 ` [PATCH v3 1/2] " Yoav Cohen
2026-10-26 12:06 ` [PATCH v3 2/2] selftests: ublk: add rq_affinity test Yoav Cohen
2026-10-26 14:45 ` Ming Lei [this message]
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=at9nfH-P1RDoZUvr@fedora-laptop \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=jholzman@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=ofer@nvidia.com \
--cc=omril@nvidia.com \
--cc=yoav@nvidia.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