From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55946C5321D for ; Mon, 26 Aug 2024 05:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T54Wsk777Xf2haqY7FfYY/vjVxpBNUfJDXngv7zp/k4=; b=g2tIKewlJjjrfquCXgqI3z2wSQ KeiGszobs/DFw2B/0DSApvqlyJSj3DVan4BFC3rqJTTCcMsj9h/rMrq7oMxfDBN9HmNOVyGyTnkEa 6M6Hpj+eZrDtobBMG4aqdt11CzFtH12sYYILUWLR8EcW8ipcREcWetIqR5FE90XP5QE7cvOlKHa4h W7yp2lX0K5C4yAoGQLiQDeEHZmJyOS82nHAW6pDDdzO48ma3bbNZF0asoMObCmlfXNgF24rKSOpU5 68q1SQEgC6G2z1blKxjJJW8pYbUdhNtklhuINF5sTgJmlG+j87aXZZcvanA4HSiHyB1qn6rUJsS6Y xnYEFiug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siSQZ-00000005tiQ-0dPN; Mon, 26 Aug 2024 05:38:07 +0000 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siSQT-00000005tgi-0RdT for linux-nvme@lists.infradead.org; Mon, 26 Aug 2024 05:38:04 +0000 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47Q1dwTl016372; Mon, 26 Aug 2024 05:37:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=pp1; bh=T 54Wsk777Xf2haqY7FfYY/vjVxpBNUfJDXngv7zp/k4=; b=Z/17Y1zAT6eChEQa1 AratEC72ywUce37acz12OylG05ixpa5oUDKKGg6voiOQ8EJlJIYRQcB82C7rtnK1 KbQwtrxwPfr/RrLH7PTG5PexfBfMaJindrTQZmMved+KWrAlLlYn1Wlu1fyi5HXD yn8H1Ct400DTLVDoIB531HWeEXEHSPsRT2caqMq3VyZa3mLtpRNyLSJ9HaAx1YvL +J4pk0YM0gohPALH0XXZJYXHOjVOxVSiCFLS2azyKCd0+KSZJzZtxw5S4IP7OQgm 5wrw+okTikwpNRqLKu1OScrxkjmw9SEQTxIg63j6JkJp+Lxmw8EwYR3ShCYnkDi2 PZ2TA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 417ged538u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2024 05:37:59 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 47Q4psAr028010; Mon, 26 Aug 2024 05:37:58 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 417ubmvgxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Aug 2024 05:37:58 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 47Q5buAa28246560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Aug 2024 05:37:58 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E11CC58062; Mon, 26 Aug 2024 05:37:55 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 596BF58057; Mon, 26 Aug 2024 05:37:53 +0000 (GMT) Received: from [9.109.198.144] (unknown [9.109.198.144]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 26 Aug 2024 05:37:53 +0000 (GMT) Message-ID: <2a550653-89b4-4c3c-840a-a905152adb5f@linux.ibm.com> Date: Mon, 26 Aug 2024 11:07:51 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/3] nvme: add test for controller rescan under I/O load To: Martin Wilck , "Shin'ichiro Kawasaki" , Daniel Wagner Cc: Chaitanya Kulkarni , Hannes Reinecke , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Martin Wilck References: <20240823200822.129867-1-mwilck@suse.com> <20240823200822.129867-3-mwilck@suse.com> Content-Language: en-US From: Nilay Shroff In-Reply-To: <20240823200822.129867-3-mwilck@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4D0Tawf7huLmRhvFxrl2TSznisSaeXYe X-Proofpoint-GUID: 4D0Tawf7huLmRhvFxrl2TSznisSaeXYe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-26_02,2024-08-23_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 mlxscore=0 clxscore=1015 impostorscore=0 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408260043 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240825_223801_540132_54016798 X-CRM114-Status: GOOD ( 23.92 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org 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 > --- > 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" < +@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)