From: Nilay Shroff <nilay@linux.ibm.com>
To: Martin Wilck <martin.wilck@suse.com>,
"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
Daniel Wagner <dwagner@suse.de>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
Hannes Reinecke <hare@suse.de>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
Martin Wilck <mwilck@suse.com>
Subject: Re: [PATCH v2 3/3] nvme: add test for controller rescan under I/O load
Date: Mon, 26 Aug 2024 11:07:51 +0530 [thread overview]
Message-ID: <2a550653-89b4-4c3c-840a-a905152adb5f@linux.ibm.com> (raw)
In-Reply-To: <20240823200822.129867-3-mwilck@suse.com>
On 8/24/24 01:38, Martin Wilck wrote:
> Add a test that repeatedly rescans nvme controllers while doing IO
> on an nvme namespace connected to these controllers. The purpose
> of the test is to make sure that no I/O errors or data corruption
> occurs because of the rescan operations. The test uses sub-second
> sleeps, which can't be easily accomplished in bash because of
> missing floating-point arithmetic (and because usleep(1) isn't
> portable). Therefore an awk program is used to trigger the
> device rescans.
>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> v2: - don't use usleep (Nilay Shroff). Use an awk program to do floating
> point arithmetic and achieve more accurate sub-second sleep times.
> - add 053.out (Nilay Shroff).
> ---
> tests/nvme/053 | 70 ++++++++++++++++++++++++++++++++++++++++++++++
> tests/nvme/053.out | 2 ++
> tests/nvme/rc | 18 ++++++++++++
> 3 files changed, 90 insertions(+)
> create mode 100755 tests/nvme/053
> create mode 100644 tests/nvme/053.out
>
> diff --git a/tests/nvme/053 b/tests/nvme/053
> new file mode 100755
> index 0000000..d32484c
> --- /dev/null
> +++ b/tests/nvme/053
> @@ -0,0 +1,70 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-3.0+
> +# Copyright (C) 2024 Martin Wilck, SUSE LLC
> +
> +. tests/nvme/rc
> +
> +DESCRIPTION="test controller rescan under I/O load"
> +TIMED=1
> +: "${TIMEOUT:=60}"
> +
> +rescan_controller() {
> + local path
> + path="$1/rescan_controller"
> +
> + [[ -f "$path" ]] || {
> + echo "cannot rescan $1"
> + return 1
> + }
> +
> + awk -f "$TMPDIR/rescan.awk" \
> + -v path="$path" -v timeout="$TIMEOUT" -v seed="$2" &
> +}
> +
> +create_rescan_script() {
> + cat >"$TMPDIR/rescan.awk" <<EOF
> +@load "time"
> +
> +BEGIN {
> + srand(seed);
> + finish = gettimeofday() + strtonum(timeout);
> + while (gettimeofday() < finish) {
> + sleep(0.1 + 5 * rand());
> + printf("1\n") > path;
> + close(path);
> + }
> +}
> +EOF
> +}
The "rand()" function in 'awk' returns a floating point value between
0 and 1 (i.e. [0, 1]). So it's possible to have sleep for some cases go
upto ~5.1 seconds. So if the intention is to sleep between 0.1 and 5
seconds precisely then we may want to use,
sleep(0.1 + 4.9 * rand());
However this is not a major problem and we may ignore.
Otherwise, code looks good to me.
Reviewed-by: Nilay Shroff (nilay@linux.ibm.com)
next prev parent reply other threads:[~2024-08-26 5:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 20:08 [PATCH v2 1/3] blktests: nvme: skip passthru tests on multipath devices Martin Wilck
2024-08-23 20:08 ` [PATCH v2 2/3] blktests: nvme/032: skip on non-PCI devices Martin Wilck
2024-08-23 20:08 ` [PATCH v2 3/3] nvme: add test for controller rescan under I/O load Martin Wilck
2024-08-26 5:37 ` Nilay Shroff [this message]
2024-08-26 7:58 ` Martin Wilck
2024-08-29 7:36 ` Shinichiro Kawasaki
2024-09-02 13:53 ` Martin Wilck
2024-09-03 0:16 ` Shinichiro Kawasaki
2024-09-03 15:07 ` Martin Wilck
2024-08-29 7:40 ` [PATCH v2 1/3] blktests: nvme: skip passthru tests on multipath devices Shinichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a550653-89b4-4c3c-840a-a905152adb5f@linux.ibm.com \
--to=nilay@linux.ibm.com \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.wilck@suse.com \
--cc=mwilck@suse.com \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox