From patchwork Thu Dec 3 08:22:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 11948195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DE94C83012 for ; Thu, 3 Dec 2020 08:24:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38CF821741 for ; Thu, 3 Dec 2020 08:24:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388420AbgLCIXx (ORCPT ); Thu, 3 Dec 2020 03:23:53 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:38583 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388358AbgLCIXx (ORCPT ); Thu, 3 Dec 2020 03:23:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1606983832; x=1638519832; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KujNNC6YB4Tcg29tD5cPcw/DXfPL8yUk439wzvL3bms=; b=CNhkHdwQeN+9kIBlhXGCieOybA+YvJmZ42byZkd2uorgSP0PTM32mEnP sMzlGbTt7tnvTXLjOYShO17UlnVmKk2D9x9n+ZcOK4QwejHZzwTmLQnMk V6k0wZh/47JIT1MRBZ9r8thoyJ8nxNPMBHABU08mASXPeiL8kl9fYTBQn TFXt1F59FeBRwj1P6Sr4jja2YrwGJCIKiJd/cSReEroN3VQYITid3Uyep uMYH/1KYNCsNUzHSMTgTawAJEZGoeuVg0XtHxi0qz3iM0kUX+haypV6ad PKeYabkVL7/gkDS8LhYHIIHRl5X7BglpQY9meZ+CmWG920Rr8XrTJ7cCx w==; IronPort-SDR: 1vo4XpFI8AzZuYWQGNMH+KMOuHdf2ZhJ2KG9C72b7z4ohHgqY6bq+nf4Tjlnhj/c2+6y7UqNaf wkKN7v/zS2SZJqssAoZvoQW1oy03NEH5Yojzp6j3PPeHzpo5yGstYT1q/sVTXXPM5Jol66QiKJ vGLkVKVXdSS8IyG5btok9K7mCVpwvp6NurzKiuIb39y0o0U936GwUsLthCasb3qtkF3scyrBFg NEDa8KbbHFWZrp47ccEvsAVjf8yGBAUnarYHJlc+T8QTzW+siTnlu/Qc+OjN4n3jB+THSDSxH/ mnc= X-IronPort-AV: E=Sophos;i="5.78,389,1599494400"; d="scan'208";a="154306299" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Dec 2020 16:22:47 +0800 IronPort-SDR: +NWQqBagvV2WNxb8Z48jkNj6P7sS2XHalewdU8cJ7XFyiCzlbH3QFkXplc3Z0dagw63JCFBXIB OG14MDAQLRSQiNTtUhEnjQKixGSpgt1qA= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2020 00:06:57 -0800 IronPort-SDR: OsSMmBWI2JBxocuJHb5FoNmpBXKZdXp3IG6qJ0tMAUmmwC9u0wJ/CqOScmqhqvtw0LJgdi0VYQ tsWSW9y2ApHQ== WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com ([10.149.52.189]) by uls-op-cesaip01.wdc.com with ESMTP; 03 Dec 2020 00:22:47 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval Cc: Omar Sandoval , Damien Le Moal , Johannes Thumshirn , Chaitanya Kulkarni , Shinichiro Kawasaki Subject: [PATCH blktests 1/2] common/rc: Check both max_active_zones and max_open_zones Date: Thu, 3 Dec 2020 17:22:43 +0900 Message-Id: <20201203082244.268632-2-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201203082244.268632-1-shinichiro.kawasaki@wdc.com> References: <20201203082244.268632-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Linux kernel 5.9 introduced new sysfs attributes max_active_zones and max_open_zones for zoned block devices. Max_open_zones is the limit of number of zones in open status. Max_active_zones is the limit of number of zones in open or closed status. Currently, the helper function _test_dev_max_active_zones() checks only max_active_zones, but it is not enough. When the device has max_open_zones, check for max_active_zones can not avoid the errors for write operations. To avoid the error, improve the function _test_dev_max_active_zones() to check the limits both. Rename it to _test_dev_max_open_active_zones(). When one of the limits is available for the test target device, return it. If both limits are available, return smaller limit. Also modify block/004 and zbd/003 to call the renamed helper function and update comment description. Fixes: e6981bb2d9ce ("common/rc: Add _test_dev_max_active_zones() helper function") Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Johannes Thumshirn --- common/rc | 21 +++++++++++++++++---- tests/block/004 | 2 +- tests/zbd/003 | 6 +++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/common/rc b/common/rc index d396fb5..a14f093 100644 --- a/common/rc +++ b/common/rc @@ -280,12 +280,25 @@ _test_dev_is_partition() { [[ -n ${TEST_DEV_PART_SYSFS} ]] } -_test_dev_max_active_zones() { +# Return max open zones or max active zones of the test target device. +# If the device has both, return smaller value. +_test_dev_max_open_active_zones() { + local -i ret=0 + local -i maz=0 + + if [[ -r "${TEST_DEV_SYSFS}/queue/max_open_zones" ]]; then + ret=$(_test_dev_queue_get max_open_zones) + fi + if [[ -r "${TEST_DEV_SYSFS}/queue/max_active_zones" ]]; then - _test_dev_queue_get max_active_zones - else - echo 0 + maz=$(_test_dev_queue_get max_active_zones) fi + + if ((!ret)) || ((maz && maz < ret)); then + ret="${maz}" + fi + + echo "${ret}" } _require_test_dev_is_partition() { diff --git a/tests/block/004 b/tests/block/004 index 6eff6ce..a7cec95 100755 --- a/tests/block/004 +++ b/tests/block/004 @@ -26,7 +26,7 @@ test_device() { if _test_dev_is_zoned; then _test_dev_queue_set scheduler deadline opts+=("--direct=1" "--zonemode=zbd") - opts+=("--max_open_zones=$(_test_dev_max_active_zones)") + opts+=("--max_open_zones=$(_test_dev_max_open_active_zones)") fi FIO_PERF_FIELDS=("write iops") diff --git a/tests/zbd/003 b/tests/zbd/003 index 1e92e81..7f4fa2c 100755 --- a/tests/zbd/003 +++ b/tests/zbd/003 @@ -30,10 +30,10 @@ test_device() { echo "Running ${TEST_NAME}" - # When the test device has max_active_zone limit, reset all zones. This - # ensures the write operations in this test case do not open zones + # When the test device has max_open/active_zones limit, reset all zones. + # This ensures the write operations in this test case do not open zones # beyond the limit. - (($(_test_dev_max_active_zones))) && blkzone reset "${TEST_DEV}" + (($(_test_dev_max_open_active_zones))) && blkzone reset "${TEST_DEV}" # Get physical block size as dd block size to meet zoned block device # requirement From patchwork Thu Dec 3 08:22:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shinichiro Kawasaki X-Patchwork-Id: 11948197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B4EFC83014 for ; Thu, 3 Dec 2020 08:24:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 668EB217A0 for ; Thu, 3 Dec 2020 08:24:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388365AbgLCIXz (ORCPT ); Thu, 3 Dec 2020 03:23:55 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:38586 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388358AbgLCIXz (ORCPT ); Thu, 3 Dec 2020 03:23:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1606983834; x=1638519834; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cPRSpPjfvRjSN9KdlKbem0b6Wu4WeYyVxvWLW/m4TNg=; b=quG3XBHpdAOoOctZ5O4xhg5fmckRLpotiLOSbusx06AYm4dqEh30a267 zKqW14h364mKwYCRtWr1Ymv2pr8gXMghouX9iCsCO4Nj644YvMeO+1yH/ hYsA/vhxXR2hKFur0lN0PmL5nFwc6UttXsZpZiqb6duiPH8h3mYuITnVE gBKrnlCgTOuOcSPoigMWG4Ke3U1sqbQ9YWhABLrvEA3/39erO5bh+NjAa T5v8xsPoqyJHsy1Q/r8X5L5P3JQ5rLmuu4zAKIX2y5W5X/hjqHjwlH1Tl uIkT3rOQogvAfpxgfanAYaRWeTImcSW3bqMz3VEi3C81LWAa1nR+HgMOP Q==; IronPort-SDR: +smjE2e2+aDBxhTPoC4mU+PV78bum/GCFRwpA36hWbS6A+iolxO/BreHwTYNcIG0uF6f4fDAJK o0L115hDJXVch4x9+3A3tOUBxWAKXeqwolcnXOE9U341wdbypVantlpti2qSWl5poqBkJjznjh 6OSF1SXIO9JefqAYw5LQRITGjVE9jHqTuDYpxNqcrcbqrmwjbJinGO8N1V7SWrdf46m7bAcc2P M5kll7Ds0JUvIZDNr+yFLUL12sP/wZD/r+riS5KCO8HivAS/bJ112I1uYfM0iC4F3oT6HY2fQz b1w= X-IronPort-AV: E=Sophos;i="5.78,389,1599494400"; d="scan'208";a="154306301" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Dec 2020 16:22:49 +0800 IronPort-SDR: qx4jNV05ptWOO5XA75wASAY3qw53EzX/7N4Q3dLoQ4x9efhIzIgio/ynffyhubXLnQ4knFBslw JviSecAMU0/K6cQo/x52pkgXC7Z8wIXuA= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2020 00:06:59 -0800 IronPort-SDR: jURoI+9ObdYckp1Ti8rIuTyn6pbKglO94BsQYBSxLy1mnhbGfiQek5fE7/3QL9WZu3H+8Z0HaJ 2+g+BlzsFZKg== WDCIronportException: Internal Received: from shindev.dhcp.fujisawa.hgst.com ([10.149.52.189]) by uls-op-cesaip01.wdc.com with ESMTP; 03 Dec 2020 00:22:48 -0800 From: Shin'ichiro Kawasaki To: linux-block@vger.kernel.org, Omar Sandoval Cc: Omar Sandoval , Damien Le Moal , Johannes Thumshirn , Chaitanya Kulkarni , Shinichiro Kawasaki Subject: [PATCH blktests 2/2] zbd/005: Provide max_active/open_zones limit to fio command Date: Thu, 3 Dec 2020 17:22:44 +0900 Message-Id: <20201203082244.268632-3-shinichiro.kawasaki@wdc.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201203082244.268632-1-shinichiro.kawasaki@wdc.com> References: <20201203082244.268632-1-shinichiro.kawasaki@wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org When test target zoned block devices have max_open_zones or max_active_zones limit, high queue depth sequential write in the test case zbd/005 may result in parallel writes to number of zones beyond the limit. This causes I/O errors. To avoid the errors, specify the limit to fio command in the test case. Signed-off-by: Shin'ichiro Kawasaki Reviewed-by: Johannes Thumshirn --- tests/zbd/005 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/zbd/005 b/tests/zbd/005 index 1e8962c..a7fb175 100755 --- a/tests/zbd/005 +++ b/tests/zbd/005 @@ -28,7 +28,8 @@ cleanup_fallback_device() { test_device() { local -i zone_idx local -i offset - local zbdmode="" + local -i moaz + local -a zbdmode=() echo "Running ${TEST_NAME}" @@ -36,11 +37,13 @@ test_device() { zone_idx=$(_find_first_sequential_zone) || return $? offset=$((ZONE_STARTS[zone_idx] * 512)) + moaz=$(_test_dev_max_open_active_zones) # If the test target zone has smaller zone capacity than zone size, - # enable zonemode=zbd to have fio handle the zone capacity limit. - if ((ZONE_CAPS[zone_idx] != ZONE_LENGTHS[zone_idx])); then - zbdmode="--zonemode=zbd" + # or if the test target device has max open/active zones limit, enable + # zonemode=zbd and specify the limit to handle the zone restrictions. + if ((ZONE_CAPS[zone_idx] != ZONE_LENGTHS[zone_idx])) || ((moaz)); then + zbdmode=("--zonemode=zbd" "--max_open_zones=${moaz}") fi blkzone reset -o "${ZONE_STARTS[zone_idx]}" "${TEST_DEV}" @@ -51,7 +54,7 @@ test_device() { FIO_PERF_FIELDS=("write io" "write iops") _fio_perf --filename="${TEST_DEV}" --name zbdwo --rw=write --direct=1 \ --ioengine=libaio --iodepth=128 --bs=256k \ - --offset="${offset}" ${zbdmode} + --offset="${offset}" "${zbdmode[@]}" _put_blkzone_report