From nobody Fri Dec 19 07:23:38 2025 Received: from mail-ot1-f99.google.com (mail-ot1-f99.google.com [209.85.210.99]) (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 1D82E299AAB for ; Wed, 17 Dec 2025 05:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.99 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765949723; cv=none; b=KkeTyzteoJQ07YPDYK8PSY/Zsx+js/mzCihslwYAmtr+M3+R5WTZpvknaCLs8aB6IrActPP7O7/Un0tMGoN20unZD+GwTo1xPTKcJbYaCAi8dxLq1tLi1IAju/jK8RBZAe9G9IkKyLJ75cyvsWzsOYdhiv0wx3xJOajv4A74ats= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765949723; c=relaxed/simple; bh=t9cYHGY+lbIuHzE8g0pXWWnK6GJfVuAiJzVnLuKG2yM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jZPBtnoH/kwO665W3NlsAQg7sUac8xPUOXxjcBtQANaG9oXWQkmsmMoR29mF+ec4DpI8GjF6JGJo+572SY2j4xHSxjfKn3F9+3ypk7oES7Ru+GgEn2tU936zeNRQN9BkgxyYhu/kHqsI8ZBFtbmNVbQG7cEimYqIslqXGVJB+3o= 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=LX1e/g3f; arc=none smtp.client-ip=209.85.210.99 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="LX1e/g3f" Received: by mail-ot1-f99.google.com with SMTP id 46e09a7af769-7c72d7e6c0fso861938a34.3 for ; Tue, 16 Dec 2025 21:35:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1765949715; x=1766554515; 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=bjfInq/j6ZbezL3hpJSlIUNNH1Zh7wSL0H2qNcnLw04=; b=LX1e/g3fDzzEFaG3LUsSGMfYcs7aBOROErCshxIvPEH2jMPXjljTA2N70/QKzpZ9DF 8/KvUK4ni7/sLX2YwF33J4CnIrs647YVqduOU8uvSqIYVINwWUD/Vg6zzuMrZMsWMJBO amrFGpiRSsuuktf8Zm50epMAZ6XEHljvreQSmpVoqRmXjc1s6wGykxlhiMpRC1OQbw7O NYhCqepEvDfkYqZJEJWJ9onkC0tDAtKdaRAHELOGbUSIx922a67ccPbKffVQkxyN33mD G7dpZmqW+sV4jFgV15Kq9sDksSqpSfEna11zfJXqJHvoAYxTaBp/qgvojUGdSSthjUzT d+ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765949715; x=1766554515; 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=bjfInq/j6ZbezL3hpJSlIUNNH1Zh7wSL0H2qNcnLw04=; b=Viigv/IdvIOXmplq9vFoIJ3OQl23vjwWq2pD8N5QO0hm0yLrAi/zhKnTlV6dfoYg7N J9luaOSCFXAi8FX9Oj0aMGCTWWfPyc9fofwk/0fFXEPkSYyYTpR3uetqoFofOz+7hcf0 Gkl06EsA9KP/b0NzYU5MdZmy6ou+mI4wM6+Jnxyvxz0N+lgjGCE0BPmJGM7UDMC5vUL2 drRFRP29RBw+oy67eljxlKgAGuMdAs2VFYaM/dhLAm2YV1AU+nvkAk2DnuddHE+oES5A uqMv2cLJOZkqR7JUUs5DEUPOIcNet10HvA/ky1riSCR7enhecX/SRwMwfTXsqFJz4uTA +aGA== X-Forwarded-Encrypted: i=1; AJvYcCVcNkC0VZLCD3f13lMNXNiugGoRgnQtfrbMQH6ygRb2tvkOWsG0m0OvXPO31K3wajpPBSj4B3mkabWjooQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7HS1ZhVxtKmX9uvSgFnxztF/rCQYba5QaMPJbFkbNNhOIKn/4 gXQqAdMjbmbqLdrqIjoTMhXv1Ex2Hu9idCdoMD+hj6UdB7h1Gg0w0Xlbt8fnqpMCl24v4mEgxSR 0a1m/hMTSr51K8FF0GrjCqhioWZk4DneLxRroUJG2UMaGtLawUywg X-Gm-Gg: AY/fxX7Iros79Onofh8xk8OcHE8iRQRVUnPnQoYzNa9c/BvxONE5r+lfXLOk1VsB+4U EEhCNu/fd+bapfGQdUVTaBPnStM74RhCo1UYdYkUdbI5AjPxd+DoM2TkgJVcA/wp6zfZMcJfx0b /c+NO+vQjImOzwTurJUBVPINTvhxiZpA2A/Wrtn3wt2nABdkQBx7lOrA/McKSUOe0q+ayX/iHd8 8yk+pHDmk6CRkkn7NVlcIcGNh4mDqF0bkSx8VYe9eH+elcwsM8p0hu14UZZFEs0Jjq01dsEBKX2 eCn9LjThq3khdpYTLc1siNVdJlza0eYMjzRaMnVe2YS9UhZxkI968DYxN+4wJ/gAqhbadKxbL0A R/ITx1T4npEAbqIrspIORpHbcSH8= X-Google-Smtp-Source: AGHT+IHGuUlVvqYdwC5MHO+Zg10nd280P7si1rrad6oOsSGHdNNclHEYNg0v2QaljbxWC85Y2sUJA+x8m7OF X-Received: by 2002:a05:6830:2708:b0:7c5:4005:ffe0 with SMTP id 46e09a7af769-7cae837c564mr8249162a34.6.1765949715602; Tue, 16 Dec 2025 21:35:15 -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 46e09a7af769-7cadb2d9814sm2754118a34.3.2025.12.16.21.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 21:35:15 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.7.70.37]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id A6A793404B4; Tue, 16 Dec 2025 22:35:14 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id A1573E41A08; Tue, 16 Dec 2025 22:35:13 -0700 (MST) From: Caleb Sander Mateos To: Ming Lei , Jens Axboe , Shuah Khan Cc: linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Stanley Zhang , Uday Shankar , Caleb Sander Mateos Subject: [PATCH 19/20] selftests: ublk: add integrity params test Date: Tue, 16 Dec 2025 22:34:53 -0700 Message-ID: <20251217053455.281509-20-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20251217053455.281509-1-csander@purestorage.com> References: <20251217053455.281509-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" Add test case null_04 to exercise all the different integrity params. It creates 4 different ublk devices with different combinations of integrity arguments and verifies their integrity limits via sysfs and the metadata_size utility. Signed-off-by: Caleb Sander Mateos --- tools/testing/selftests/ublk/Makefile | 1 + tools/testing/selftests/ublk/test_common.sh | 10 ++ tools/testing/selftests/ublk/test_null_04.sh | 166 +++++++++++++++++++ 3 files changed, 177 insertions(+) create mode 100755 tools/testing/selftests/ublk/test_null_04.sh diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftest= s/ublk/Makefile index 0f6abb95c87a..d567f90d30b3 100644 --- a/tools/testing/selftests/ublk/Makefile +++ b/tools/testing/selftests/ublk/Makefile @@ -24,10 +24,11 @@ TEST_PROGS +=3D test_generic_13.sh TEST_PROGS +=3D test_generic_14.sh =20 TEST_PROGS +=3D test_null_01.sh TEST_PROGS +=3D test_null_02.sh TEST_PROGS +=3D test_null_03.sh +TEST_PROGS +=3D test_null_04.sh TEST_PROGS +=3D test_loop_01.sh TEST_PROGS +=3D test_loop_02.sh TEST_PROGS +=3D test_loop_03.sh TEST_PROGS +=3D test_loop_04.sh TEST_PROGS +=3D test_loop_05.sh diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/se= lftests/ublk/test_common.sh index 6f1c042de40e..9756b0ee876c 100755 --- a/tools/testing/selftests/ublk/test_common.sh +++ b/tools/testing/selftests/ublk/test_common.sh @@ -374,10 +374,20 @@ run_io_and_recover() _ublk_test_top_dir() { cd "$(dirname "$0")" && pwd } =20 +METADATA_SIZE_PROG=3D"$(_ublk_test_top_dir)/metadata_size" + +_get_metadata_size() +{ + local dev_id=3D$1 + local field=3D$2 + + "$METADATA_SIZE_PROG" "/dev/ublkb$dev_id" | grep "$field" | grep -o "[0-9= ]*" +} + UBLK_PROG=3D$(_ublk_test_top_dir)/kublk UBLK_TEST_QUIET=3D1 UBLK_TEST_SHOW_RESULT=3D1 UBLK_BACKFILES=3D() export UBLK_PROG diff --git a/tools/testing/selftests/ublk/test_null_04.sh b/tools/testing/s= elftests/ublk/test_null_04.sh new file mode 100755 index 000000000000..0b0719ea33a3 --- /dev/null +++ b/tools/testing/selftests/ublk/test_null_04.sh @@ -0,0 +1,166 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +. "$(cd "$(dirname "$0")" && pwd)"/test_common.sh + +TID=3Dnull_04 + +_prep_test "null" "integrity params" + +dev_id=3D$(_add_ublk_dev -t null -u --metadata_size 8) +_check_add_dev $TID $? +metadata_size=3D$(_get_metadata_size "$dev_id" metadata_size) +if [ "$metadata_size" !=3D 8 ]; then + echo "metadata_size $metadata_size !=3D 8" + _show_result $TID 255 +fi +pi_offset=3D$(_get_metadata_size "$dev_id" pi_offset) +if [ "$pi_offset" !=3D 0 ]; then + echo "pi_offset $pi_offset !=3D 0" + _show_result $TID 255 +fi +pi_tuple_size=3D$(_get_metadata_size "$dev_id" pi_tuple_size) +if [ "$pi_tuple_size" !=3D 0 ]; then + echo "pi_tuple_size $pi_tuple_size !=3D 0" + _show_result $TID 255 +fi +capable=3D$(cat "/sys/block/ublkb$dev_id/integrity/device_is_integrity_cap= able") +if [ "$capable" !=3D 0 ]; then + echo "device_is_integrity_capable $capable !=3D 0" + _show_result $TID 255 +fi +format=3D$(cat "/sys/block/ublkb$dev_id/integrity/format") +if [ "$format" !=3D nop ]; then + echo "format $format !=3D nop" + _show_result $TID 255 +fi +protection_interval_bytes=3D$(cat "/sys/block/ublkb$dev_id/integrity/prote= ction_interval_bytes") +if [ "$protection_interval_bytes" !=3D 512 ]; then + echo "protection_interval_bytes $protection_interval_bytes !=3D 512" + _show_result $TID 255 +fi +tag_size=3D$(cat "/sys/block/ublkb$dev_id/integrity/tag_size") +if [ "$tag_size" !=3D 0 ]; then + echo "tag_size $tag_size !=3D 0" + _show_result $TID 255 +fi +_cleanup_test + +dev_id=3D$(_add_ublk_dev -t null -u --integrity_capable --metadata_size 64= --pi_offset 56 --csum_type ip) +_check_add_dev $TID $? +metadata_size=3D$(_get_metadata_size "$dev_id" metadata_size) +if [ "$metadata_size" !=3D 64 ]; then + echo "metadata_size $metadata_size !=3D 64" + _show_result $TID 255 +fi +pi_offset=3D$(_get_metadata_size "$dev_id" pi_offset) +if [ "$pi_offset" !=3D 56 ]; then + echo "pi_offset $pi_offset !=3D 56" + _show_result $TID 255 +fi +pi_tuple_size=3D$(_get_metadata_size "$dev_id" pi_tuple_size) +if [ "$pi_tuple_size" !=3D 8 ]; then + echo "pi_tuple_size $pi_tuple_size !=3D 8" + _show_result $TID 255 +fi +capable=3D$(cat "/sys/block/ublkb$dev_id/integrity/device_is_integrity_cap= able") +if [ "$capable" !=3D 1 ]; then + echo "device_is_integrity_capable $capable !=3D 1" + _show_result $TID 255 +fi +format=3D$(cat "/sys/block/ublkb$dev_id/integrity/format") +if [ "$format" !=3D T10-DIF-TYPE3-IP ]; then + echo "format $format !=3D T10-DIF-TYPE3-IP" + _show_result $TID 255 +fi +protection_interval_bytes=3D$(cat "/sys/block/ublkb$dev_id/integrity/prote= ction_interval_bytes") +if [ "$protection_interval_bytes" !=3D 512 ]; then + echo "protection_interval_bytes $protection_interval_bytes !=3D 512" + _show_result $TID 255 +fi +tag_size=3D$(cat "/sys/block/ublkb$dev_id/integrity/tag_size") +if [ "$tag_size" !=3D 0 ]; then + echo "tag_size $tag_size !=3D 0" + _show_result $TID 255 +fi +_cleanup_test + +dev_id=3D$(_add_ublk_dev -t null -u --integrity_reftag --metadata_size 8 -= -csum_type t10dif) +_check_add_dev $TID $? +metadata_size=3D$(_get_metadata_size "$dev_id" metadata_size) +if [ "$metadata_size" !=3D 8 ]; then + echo "metadata_size $metadata_size !=3D 8" + _show_result $TID 255 +fi +pi_offset=3D$(_get_metadata_size "$dev_id" pi_offset) +if [ "$pi_offset" !=3D 0 ]; then + echo "pi_offset $pi_offset !=3D 0" + _show_result $TID 255 +fi +pi_tuple_size=3D$(_get_metadata_size "$dev_id" pi_tuple_size) +if [ "$pi_tuple_size" !=3D 8 ]; then + echo "pi_tuple_size $pi_tuple_size !=3D 8" + _show_result $TID 255 +fi +capable=3D$(cat "/sys/block/ublkb$dev_id/integrity/device_is_integrity_cap= able") +if [ "$capable" !=3D 0 ]; then + echo "device_is_integrity_capable $capable !=3D 0" + _show_result $TID 255 +fi +format=3D$(cat "/sys/block/ublkb$dev_id/integrity/format") +if [ "$format" !=3D T10-DIF-TYPE1-CRC ]; then + echo "format $format !=3D T10-DIF-TYPE1-CRC" + _show_result $TID 255 +fi +protection_interval_bytes=3D$(cat "/sys/block/ublkb$dev_id/integrity/prote= ction_interval_bytes") +if [ "$protection_interval_bytes" !=3D 512 ]; then + echo "protection_interval_bytes $protection_interval_bytes !=3D 512" + _show_result $TID 255 +fi +tag_size=3D$(cat "/sys/block/ublkb$dev_id/integrity/tag_size") +if [ "$tag_size" !=3D 0 ]; then + echo "tag_size $tag_size !=3D 0" + _show_result $TID 255 +fi +_cleanup_test + +dev_id=3D$(_add_ublk_dev -t null -u --metadata_size 16 --csum_type nvme --= tag_size 8) +_check_add_dev $TID $? +metadata_size=3D$(_get_metadata_size "$dev_id" metadata_size) +if [ "$metadata_size" !=3D 16 ]; then + echo "metadata_size $metadata_size !=3D 16" + _show_result $TID 255 +fi +pi_offset=3D$(_get_metadata_size "$dev_id" pi_offset) +if [ "$pi_offset" !=3D 0 ]; then + echo "pi_offset $pi_offset !=3D 0" + _show_result $TID 255 +fi +pi_tuple_size=3D$(_get_metadata_size "$dev_id" pi_tuple_size) +if [ "$pi_tuple_size" !=3D 16 ]; then + echo "pi_tuple_size $pi_tuple_size !=3D 16" + _show_result $TID 255 +fi +capable=3D$(cat "/sys/block/ublkb$dev_id/integrity/device_is_integrity_cap= able") +if [ "$capable" !=3D 0 ]; then + echo "device_is_integrity_capable $capable !=3D 0" + _show_result $TID 255 +fi +format=3D$(cat "/sys/block/ublkb$dev_id/integrity/format") +if [ "$format" !=3D EXT-DIF-TYPE3-CRC64 ]; then + echo "format $format !=3D EXT-DIF-TYPE3-CRC64" + _show_result $TID 255 +fi +protection_interval_bytes=3D$(cat "/sys/block/ublkb$dev_id/integrity/prote= ction_interval_bytes") +if [ "$protection_interval_bytes" !=3D 512 ]; then + echo "protection_interval_bytes $protection_interval_bytes !=3D 512" + _show_result $TID 255 +fi +tag_size=3D$(cat "/sys/block/ublkb$dev_id/integrity/tag_size") +if [ "$tag_size" !=3D 8 ]; then + echo "tag_size $tag_size !=3D 8" + _show_result $TID 255 +fi +_cleanup_test + +_show_result $TID 0 --=20 2.45.2