Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: ublk: forbid multiple data copy modes

The kublk mock ublk server allows multiple data copy mode arguments to
be passed on the command line (--zero_copy, --get_data, and --auto_zc).
The ublk device will be created with all the requested feature flags,
however kublk will only use one of the modes to interact with request
data (arbitrarily preferring auto_zc over zero_copy over get_data). To
clarify the intent of the test, don't allow multiple data copy modes to
be specified. --zero_copy and --auto_zc are allowed together for
--auto_zc_fallback, which uses both copy modes.
Don't set UBLK_F_USER_COPY for zero_copy, as it's a separate feature.
Fix the test cases in test_stress_05 passing --get_data along with
--zero_copy or --auto_zc.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
52bc4837 d8295408

+15 -6
+10 -1
tools/testing/selftests/ublk/kublk.c
··· 1613 1613 ctx.queue_depth = strtol(optarg, NULL, 10); 1614 1614 break; 1615 1615 case 'z': 1616 - ctx.flags |= UBLK_F_SUPPORT_ZERO_COPY | UBLK_F_USER_COPY; 1616 + ctx.flags |= UBLK_F_SUPPORT_ZERO_COPY; 1617 1617 break; 1618 1618 case 'r': 1619 1619 value = strtol(optarg, NULL, 10); ··· 1683 1683 ublk_err("%s: auto_zc_fallback is set but neither " 1684 1684 "F_AUTO_BUF_REG nor F_SUPPORT_ZERO_COPY is enabled\n", 1685 1685 __func__); 1686 + return -EINVAL; 1687 + } 1688 + 1689 + if (!!(ctx.flags & UBLK_F_NEED_GET_DATA) + 1690 + !!(ctx.flags & UBLK_F_USER_COPY) + 1691 + (ctx.flags & UBLK_F_SUPPORT_ZERO_COPY && !ctx.auto_zc_fallback) + 1692 + (ctx.flags & UBLK_F_AUTO_BUF_REG && !ctx.auto_zc_fallback) + 1693 + ctx.auto_zc_fallback > 1) { 1694 + fprintf(stderr, "too many data copy modes specified\n"); 1686 1695 return -EINVAL; 1687 1696 } 1688 1697
+5 -5
tools/testing/selftests/ublk/test_stress_05.sh
··· 58 58 59 59 if _have_feature "ZERO_COPY"; then 60 60 for reissue in $(seq 0 1); do 61 - ublk_io_and_remove 8G -t null -q 4 -g -z -r 1 -i "$reissue" & 62 - ublk_io_and_remove 256M -t loop -q 4 -g -z -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" & 61 + ublk_io_and_remove 8G -t null -q 4 -z -r 1 -i "$reissue" & 62 + ublk_io_and_remove 256M -t loop -q 4 -z -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" & 63 63 wait 64 64 done 65 65 fi 66 66 67 67 if _have_feature "AUTO_BUF_REG"; then 68 68 for reissue in $(seq 0 1); do 69 - ublk_io_and_remove 8G -t null -q 4 -g --auto_zc -r 1 -i "$reissue" & 70 - ublk_io_and_remove 256M -t loop -q 4 -g --auto_zc -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" & 71 - ublk_io_and_remove 8G -t null -q 4 -g -z --auto_zc --auto_zc_fallback -r 1 -i "$reissue" & 69 + ublk_io_and_remove 8G -t null -q 4 --auto_zc -r 1 -i "$reissue" & 70 + ublk_io_and_remove 256M -t loop -q 4 --auto_zc -r 1 -i "$reissue" "${UBLK_BACKFILES[1]}" & 71 + ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback -r 1 -i "$reissue" & 72 72 wait 73 73 done 74 74 fi