From nobody Sat Feb 7 09:59:13 2026 Received: from mail-pf1-f228.google.com (mail-pf1-f228.google.com [209.85.210.228]) (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 2049921771B for ; Tue, 6 Jan 2026 00:58:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.228 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767661098; cv=none; b=VGk2KFu03+0thk9Th/VGzFG9sIRpateWnZODdW9SkwufpPFLWgsVVUI3AKuHQE6W4shRCisM7FWnCQe9ZOFPFpvmPGjwd3g/GY2+fnFbdiYvJfwN8V9mCllWx7rs+YCKb/CZNitwG0oiSVGK+GVh8eC/WoLJQrEb2XvDaEps/K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767661098; c=relaxed/simple; bh=T6I6wJ3K0zbZovsFhPHvXVOw2B2xHcL5y1GMqwzvtJo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=madegPfV6thca3UEZxA2y4aRBbAFGuHUOV6AC/NTgMjrhjUA+ZZQfYmHCA8A5dxSdokyNEWChrZ39M1yvhca8SntBxXlB8Xh5KqiGUi5KL0YCEZfM3FXmN+V2qeYes2+5+wMf10xTJiA1fWxP+WFbWYvMcI7smm2iJ59cxll/3U= 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=Erk8dslH; arc=none smtp.client-ip=209.85.210.228 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="Erk8dslH" Received: by mail-pf1-f228.google.com with SMTP id d2e1a72fcca58-805bb2d0cf9so44031b3a.3 for ; Mon, 05 Jan 2026 16:58:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1767661092; x=1768265892; 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=iMHoFk6qxgkVzaDa4BWjqhlQdF6TcBBx1Xc90nS+iKc=; b=Erk8dslHtEk+VVmVQZ1JOOh9a60x9QvHCP/seV3ipf76gMCL7+YWMQPq7mPOKIBrl1 LGl1XZgNOdGhj81VxCqDB6IaoquF+xCNveqs35ZPo2gUCa07dG95TfyddZFiDYybbaT0 k5Y5ZNZBSJ4hDJC3SN9A/ZS8KlC33G2Q+4ZyM3f6VZaHXXD2m5GPwhII7fvzwlmSWlMB tKnoIJjEE+cxR45q5jSS74qPOiEGtbl7ciP9L9DuyJHAAl+569tKmu+3vh21fvaP7/mc 2HBuInQmX1WUxOBmMA/qSnIbKXY4bgeVP30bIHqHbe4keSXDO5J7848r+0sqJYry5sJg z95Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767661092; x=1768265892; 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=iMHoFk6qxgkVzaDa4BWjqhlQdF6TcBBx1Xc90nS+iKc=; b=hZTVo/0pcsHdmj+ZePLtP920qZB2P0Pq7kMHxmlIbgPZ2jTrZaY902U8zikhm04KWZ ul3XcyxHowHRz95urs26w0u2d8BON3Z8E7joWdwFt4lk01hYunS5AWYoe7Ug9IddwPPM iPvcTj/8JHoCObHN6YkGMt17OOi3eKpN6lasg+rggjNBMSAJ3MioEx4ii7A7lJj02qfO iK0It3sgiIW4q0MtQy+oN/gk+Y/zCSAdJaA/I0PmlCSyG2jfmqICl1FNa1N6OQBJcSrI VSlVnSnkqfqXHYfJaJuN3iRo/losTlyGDLYrt4DVeO5XLV7IaRaG2E7w1fzTnywkN2/F Nm7w== X-Forwarded-Encrypted: i=1; AJvYcCVaHJiN0TTEJ762amf04QdHZhqF7Pd1Lfbz5f0BlPEnOAs9CDxnrpEy+kjK7Lukep+P7B8iSYSwEE7jWIM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5pxj1fuSqrnLySvt3RaokohmkQZ6RWETUZPu8ovedY+6LOP2S vt95p1Z1FgaltfYyEtYDbm0FTxaHby9MQavsZ9U3l15+FqgXyJqRQgsLxohLOH8QNe1WZ8ViZBH rA1ELvRoVJ3uBTppSTPwKVhWepK5icpisZnbM X-Gm-Gg: AY/fxX6e6o04rKNJy6J5B4upJnX2Qy9xX3SIvCKeR9Jmcg8YnyzH6TDFVMwhm/Sm4Uk +JvfWqED5Uk+d2JQ9EI+cF7lrzNPezPzCAGmuWJQI11Bgbc/jUEepMYKsP2Eps1YC8vkH6xZxGH yOLyjOoX2Sig3dhxfEdO1QaRIAX590sz6rWKpk5OdKfJYTu58k0p9PmPRwVSk1A/RmoG8/o7C8f QLz70oF/eQTm/lN+VjV3seNAodvvPJIesXeK6LgZ3tTmaoZgQ0c8F9jAB/3pqFJKzcaP+/yFDIG 4Q3C50jRxQvH1QXsWNnetY2dw8NY0BZffDGmlpzYgjgdH1ws+QTHxdpn/5hnolq8gTJjrVmHSU7 g3rY9pccoLyLIR8lbTEc7/kVNLwr9mCDdYTK+AhOduQ== X-Google-Smtp-Source: AGHT+IGbX14HlpT+oEMhN3SMTerXZI/+I63Gxe2TLTXkzaU4YX0ZcucMBqs6stDwHIRKLTgGgb15nM6tG3At X-Received: by 2002:a05:7022:e0b:b0:119:e55a:95a0 with SMTP id a92af1059eb24-121f188a665mr592876c88.2.1767661091850; Mon, 05 Jan 2026 16:58:11 -0800 (PST) Received: from c7-smtp-2023.dev.purestorage.com ([208.88.159.128]) by smtp-relay.gmail.com with ESMTPS id a92af1059eb24-121f243aca8sm115872c88.2.2026.01.05.16.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jan 2026 16:58:11 -0800 (PST) X-Relaying-Domain: purestorage.com Received: from dev-csander.dev.purestorage.com (dev-csander.dev.purestorage.com [10.49.34.222]) by c7-smtp-2023.dev.purestorage.com (Postfix) with ESMTP id 73B3F340DAB; Mon, 5 Jan 2026 17:58:11 -0700 (MST) Received: by dev-csander.dev.purestorage.com (Postfix, from userid 1557716354) id 659E6E44554; Mon, 5 Jan 2026 17:58:11 -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 , "Martin K . Petersen" , Caleb Sander Mateos Subject: [PATCH v3 18/19] selftests: ublk: add integrity params test Date: Mon, 5 Jan 2026 17:57:50 -0700 Message-ID: <20260106005752.3784925-19-csander@purestorage.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260106005752.3784925-1-csander@purestorage.com> References: <20260106005752.3784925-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 41f776bb86a6..bfd68ae64142 100644 --- a/tools/testing/selftests/ublk/Makefile +++ b/tools/testing/selftests/ublk/Makefile @@ -25,10 +25,11 @@ TEST_PROGS +=3D test_generic_14.sh TEST_PROGS +=3D test_generic_15.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 ea9a5f3eb70a..7ff6ce79d62c 100755 --- a/tools/testing/selftests/ublk/test_common.sh +++ b/tools/testing/selftests/ublk/test_common.sh @@ -382,10 +382,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