From nobody Sun Dec 14 11:17:16 2025 Received: from mail-pl1-f227.google.com (mail-pl1-f227.google.com [209.85.214.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE7632D7DC7 for ; Fri, 12 Dec 2025 17:17:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.227 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765559834; cv=none; b=NBZncmGwgqzMJLnDvTfb2wtqflRua3S2rKOiemC5t9QGORZPSFrjKGkWtdrjt6Dc97qMmNjvjgqCfahdpS1sVMI7llDcO21YYC4p+wOrFd3fmxNh+YKal2BgfZAz7LxR6QgDJttqkYdHcgiKAU/EdpeGPurFSvBZEBVCaFF2d9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765559834; c=relaxed/simple; bh=hPIiNC1+/Ul2H1nCS4eIVMyitSwq0Uw4atB11NoOg3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mnWDby8m6sIibSCn3W5vErBXVpbssXEp8pAgKaBqEhiZhzqWPvB72DvuMSuTpmGUUTFJUnJjVC6Q+4gIJLt4zzCSpVHy+IYm/Esl2+NCyEiv5WTvaF7Nri21gXlF+guGGjw2H1wfaGe2NmRdxu3tfEbAXFWeUKy/VJ4K5ARHRgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com; spf=fail smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=eSSBfKlP; arc=none smtp.client-ip=209.85.214.227 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="eSSBfKlP" Received: by mail-pl1-f227.google.com with SMTP id d9443c01a7336-2a08c65fceeso123375ad.2 for ; Fri, 12 Dec 2025 09:17:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1765559830; x=1766164630; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9yUeSg484LPlwnG9Kq89xJ26zoxj8oGQzdWDtSD7PIU=; b=eSSBfKlPQFpdhpEjEf1+YL9zY7UPrry9TrSKiKgab8sjkcESxY5GfJS7CqlS25jI2r Jp6cWJ6uIsBo9O0/Db4OT1fYMW+SR7BYoHyZ2EpC+3+fvmsuOuejAXVv273FPyryWwBF SZ5tlew/zQI1uaZ+EsoPFZxY/EDSNMwZaoDMzLHQeEP2DAiew9qVDGTDl6l52gKYkUUB 3dCatX2+4GZQPVJg2epQtDKcie0lL+T+PYaxvPBq8T99XYV6+fv3d7KggPonDCKK6fh7 RoOIIb6oB3WG4o+my/LMkKwWAvvO6eie5QchP+Bk3EcxGze49W95/S6dKFw8y0DMrhyz ILcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765559830; x=1766164630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9yUeSg484LPlwnG9Kq89xJ26zoxj8oGQzdWDtSD7PIU=; b=iu7kTSw3zYkCU0/L+LRSVRV+Ret3vGcFJ3PzCj14zBMa8ElyUPt44r+E7DHVF84dfV kzUa8lnJvZeNyaz0SvkwbjsEXygPYbvHMdxZ7c5Eos9w08eg8pjmqNfIzLmR3QNwClF2 VuVkRNVGaBVK9pw4VIA3zrhBrNr024WBIGB0L6FZCD99ugtqHYwAvtKCKkrhI3OCvK/W 8wspoDfQ6jQVVlt9KaTUo5j2OPL766wXXkyhJD8hG1IM4+jWVl0Be6czaKRo6FihUzmR fu3ITM3vqHGSJnn9WqTaF/TQGQHH854Bv8Ib6s5AaSEcVfmsKA74xHfAIVaAxJcioS3o Ulbw== X-Forwarded-Encrypted: i=1; AJvYcCVRvnuB5z8dBVV27e8rkYf6r+h46muf+Bp7ezPm/W8ZTFAF5Yi2Q53sMff/R4Mka8whwHDpPbj1PiDADjs=@vger.kernel.org X-Gm-Message-State: AOJu0YwF2RkePkqmRJ1t3f10wbb4XnFHDD7GgkkpqmFo8WZeJ5MHIgXd vqSQv92O/D5Qrbfi8ZKclYhHyvbWktZWRODSJ6ZsdhPn2PWFsCcCj29yeUmcCOrl69Yyk19rvzm DOb63DgPoPzTHT1qPW3/MJBUZa+R1bPhKoKxiVhHMxQMJsOy39XEA X-Gm-Gg: AY/fxX6Il7bfK+ga5VoNjDh76vDWKXtV8b8QZZ9k68Cm7W/gQL8cpPV/zA/Jr6cuQMB mCw2+rEl/rxMtRU+2YYG+slDfrxz7DH5ZJzGqHfvwLLb8yK4ubQPiogkTs0tJ2uIdyR08apKoVQ SeyF5jAKDuqcuUsJYU4zbk64hpXt7Z2TLIlcyBZBTb2bzIZ3pNYP/ALH5KLaKWoK9gCOci/UsAf UuoCDkO44I4AISDI0LJjyIJuiKL6rjXrZ0oU3hYigBSdA/9EzlMNFyrJ39tj8Bm+Q/Sbq3+mDRk GWoVe/jQtk63LqxFZKLi0XvWhQeef8pIY8J08jfcLbCppHFyu16n+RYnIbZJ5wcEtL++zIvghxf F3LmFAStBEWYHvtPjf1x7MInvArw= X-Google-Smtp-Source: AGHT+IEbfoe32paZweyOPDkuXvizadBFpFIsjkgJtJbQ2tnZucwBUDmmD4hh6aIHwvuMRz00hNAN6TCkuBCH X-Received: by 2002:a17:903:11d0:b0:299:db45:c5a9 with SMTP id d9443c01a7336-29f244d0d77mr22404615ad.9.1765559830547; Fri, 12 Dec 2025 09:17:10 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([2620:125:9017:12:36:3:5:0]) by smtp-relay.gmail.com with ESMTPS id d9443c01a7336-29f2f7acae8sm2502465ad.19.2025.12.12.09.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 09:17:10 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (unknown [IPv6:2620:125:9007:640:ffff::1199]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id E2190341CB6; Fri, 12 Dec 2025 10:17:09 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id DFBE3E4232B; Fri, 12 Dec 2025 10:17:09 -0700 (MST) From: Caleb Sander Mateos To: Ming Lei , Shuah Khan Cc: linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Sander Mateos Subject: [PATCH v3 7/9] selftests: ublk: forbid multiple data copy modes Date: Fri, 12 Dec 2025 10:17:05 -0700 Message-ID: <20251212171707.1876250-8-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251212171707.1876250-1-csander@purestorage.com> References: <20251212171707.1876250-1-csander@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Ming Lei --- tools/testing/selftests/ublk/kublk.c | 11 ++++++++++- tools/testing/selftests/ublk/test_stress_05.sh | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/ublk/kublk.c b/tools/testing/selftests= /ublk/kublk.c index f8fa102a627f..4dd02cb083ba 100644 --- a/tools/testing/selftests/ublk/kublk.c +++ b/tools/testing/selftests/ublk/kublk.c @@ -1611,11 +1611,11 @@ int main(int argc, char *argv[]) break; case 'd': ctx.queue_depth =3D strtol(optarg, NULL, 10); break; case 'z': - ctx.flags |=3D UBLK_F_SUPPORT_ZERO_COPY | UBLK_F_USER_COPY; + ctx.flags |=3D UBLK_F_SUPPORT_ZERO_COPY; break; case 'r': value =3D strtol(optarg, NULL, 10); if (value) ctx.flags |=3D UBLK_F_USER_RECOVERY; @@ -1684,10 +1684,19 @@ int main(int argc, char *argv[]) "F_AUTO_BUF_REG nor F_SUPPORT_ZERO_COPY is enabled\n", __func__); return -EINVAL; } =20 + if (!!(ctx.flags & UBLK_F_NEED_GET_DATA) + + !!(ctx.flags & UBLK_F_USER_COPY) + + (ctx.flags & UBLK_F_SUPPORT_ZERO_COPY && !ctx.auto_zc_fallback) + + (ctx.flags & UBLK_F_AUTO_BUF_REG && !ctx.auto_zc_fallback) + + ctx.auto_zc_fallback > 1) { + fprintf(stderr, "too many data copy modes specified\n"); + return -EINVAL; + } + i =3D optind; while (i < argc && ctx.nr_files < MAX_BACK_FILES) { ctx.files[ctx.nr_files++] =3D argv[i++]; } =20 diff --git a/tools/testing/selftests/ublk/test_stress_05.sh b/tools/testing= /selftests/ublk/test_stress_05.sh index 274295061042..68a194144302 100755 --- a/tools/testing/selftests/ublk/test_stress_05.sh +++ b/tools/testing/selftests/ublk/test_stress_05.sh @@ -56,21 +56,21 @@ for reissue in $(seq 0 1); do wait done =20 if _have_feature "ZERO_COPY"; then for reissue in $(seq 0 1); do - ublk_io_and_remove 8G -t null -q 4 -g -z -r 1 -i "$reissue" & - ublk_io_and_remove 256M -t loop -q 4 -g -z -r 1 -i "$reissue" "${UBLK_BA= CKFILES[1]}" & + ublk_io_and_remove 8G -t null -q 4 -z -r 1 -i "$reissue" & + ublk_io_and_remove 256M -t loop -q 4 -z -r 1 -i "$reissue" "${UBLK_BACKF= ILES[1]}" & wait done fi =20 if _have_feature "AUTO_BUF_REG"; then for reissue in $(seq 0 1); do - ublk_io_and_remove 8G -t null -q 4 -g --auto_zc -r 1 -i "$reissue" & - ublk_io_and_remove 256M -t loop -q 4 -g --auto_zc -r 1 -i "$reissue" "${= UBLK_BACKFILES[1]}" & - ublk_io_and_remove 8G -t null -q 4 -g -z --auto_zc --auto_zc_fallback -r= 1 -i "$reissue" & + ublk_io_and_remove 8G -t null -q 4 --auto_zc -r 1 -i "$reissue" & + ublk_io_and_remove 256M -t loop -q 4 --auto_zc -r 1 -i "$reissue" "${UBL= K_BACKFILES[1]}" & + ublk_io_and_remove 8G -t null -q 4 -z --auto_zc --auto_zc_fallback -r 1 = -i "$reissue" & wait done fi =20 if _have_feature "PER_IO_DAEMON"; then --=20 2.45.2