From patchwork Mon Aug 26 09:46:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 1976745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lcsfAgJS; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=MW78lL2T; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WsmC10fYZz1yZd for ; Mon, 26 Aug 2024 19:50:53 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=a+k51H2nQQEsJLsKCnThn01cWvK8n0JC/7OBzHg6+Mw=; b=lcsfAgJSJks62X tK0+8q12ZwmuYPgIYZ0rimHNjFaH/KqT0UbuGCJb64EpXR+c0n/w8QOwYN6KWLk5r3XFxrNxtKbPq yAXMRhsnCBd7q1g1n1ALPOGw/vM4ZsbIwy0V9bQxXVAPBe+AoCfE3mnS+xvap5IPVqBJ3cJaXxmiM VZRTvepnan4z/1wE20unYkzt/mb+OdbzueAD+FKctTlR02HOZ3Akt8M7FGmwEGbMfBNQLn4FHF6Gk ns2D5Mlv9ZEGAVYtZCF/fM33Yhyr5nmz3zUq0KjQTK4gXnFwhcjtJj7FChI9mkuoW62OSLof8P5n3 PWly4EjornafBodSz3SQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWMy-00000006lqJ-3iK6; Mon, 26 Aug 2024 09:50:40 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siWJ2-00000006kUC-39w4 for linux-mtd@lists.infradead.org; Mon, 26 Aug 2024 09:46:40 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id C25CCC0003; Mon, 26 Aug 2024 09:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724665595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3icL4Coc8j893m5dgM4GCJWuzuAM/PMefbuGA42BRD8=; b=MW78lL2TxJ2SwgfhqhMooC5Nxay57YXEas4YcuWlM/uwKj2vkJEnoGaBV1vcRUT/MfVLAg 8L6LDFpS9P/Hvj/e100fP4mN00L+1Zu7sIDREILiMODIPKmuTO1VsPlfs2ZVHGSThKUm6h CLrQgCdDbnXTEh49vjlY1c3BbE+45iM4c53pGoygaWMG3ZiZYmpZbs0PevTgVlEUeytJsy eDcWUoKUtEeBI2j3URoxzefpe1Ao4rez+mVg9586BQGQfCgKVvOzQpmtGx/lAm4tH97q0g JJ7ick5PIfLvtc4vARM2wnT4GR7lVkhPnzt8Ed346T4fNzz7zJb6GGQ2ozravA== From: Miquel Raynal To: David Oberhollenzer Cc: Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Pratyush Yadav , Michael Walle , , Julien Su , Alvin Zhou , Thomas Petazzoni , Miquel Raynal Subject: [PATCH mtd-utils 05/10] mtd-tests: nandbiterrs: Add support for testing continuous reads Date: Mon, 26 Aug 2024 11:46:24 +0200 Message-ID: <20240826094629.19065-6-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240826094629.19065-1-miquel.raynal@bootlin.com> References: <20240826094629.19065-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: miquel.raynal@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_024637_258041_9F1AFEDF X-CRM114-Status: GOOD ( 15.13 ) X-Spam-Score: -2.8 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In order to trigger a continuous read, the user needs to request at least two pages at the same time. So far the tool would only read single pages, so let's extend its capabilities to test continuous [...] Content analysis details: (-2.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [217.70.183.198 listed in sa-accredit.habeas.com] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [217.70.183.198 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [217.70.183.198 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [217.70.183.198 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In order to trigger a continuous read, the user needs to request at least two pages at the same time. So far the tool would only read single pages, so let's extend its capabilities to test continuous read output when the -c option is passed. Signed-off-by: Miquel Raynal --- tests/mtd-tests/nandbiterrs.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c index 30954f5..424a95f 100644 --- a/tests/mtd-tests/nandbiterrs.c +++ b/tests/mtd-tests/nandbiterrs.c @@ -63,6 +63,7 @@ #define MODE_INCREMENTAL 0x02 #define MODE_OVERWRITE 0x04 #define PAGE_ERASED 0x08 +#define CONTINUOUS_READ 0x10 static int peb = -1, page = -1, max_overwrite = -1, seed = -1; static const char *mtddev; @@ -81,6 +82,7 @@ static const struct option options[] = { { "erased", no_argument, NULL, 'e' }, { "writes", required_argument, NULL, 'w' }, { "incremental", no_argument, NULL, 'i' }, + { "continuous", no_argument, NULL, 'c' }, { "overwrite", no_argument, NULL, 'o' }, { NULL, 0, NULL, 0 }, }; @@ -95,7 +97,8 @@ static NORETURN void usage(int status) " -b, --peb Use this physical erase block\n" " -p, --page Use this page within the erase block\n" " -s, --seed Specify seed for PRNG\n" - " -e, --erased Test erased pages instead of written pages\n\n" + " -e, --erased Test erased pages instead of written pages\n" + " -c, --continuous Use two consecutive pages (incremental test only)\n\n" "Options controling test mode:\n" " -i, --incremental Manually insert bit errors until ECC fails\n" " -o, --overwrite Rewrite page until bits flip and ECC fails\n\n" @@ -124,7 +127,7 @@ static void process_options(int argc, char **argv) int c; while (1) { - c = getopt_long(argc, argv, "hkb:p:s:eiow:", options, NULL); + c = getopt_long(argc, argv, "hkb:p:s:eiow:c", options, NULL); if (c == -1) break; @@ -175,6 +178,9 @@ static void process_options(int argc, char **argv) case 'e': flags |= PAGE_ERASED; break; + case 'c': + flags |= CONTINUOUS_READ; + break; case 'h': usage(EXIT_SUCCESS); default: @@ -193,6 +199,9 @@ static void process_options(int argc, char **argv) if (!(flags & (MODE_OVERWRITE|MODE_INCREMENTAL))) errmsg_die("No test mode specified!"); + if (flags & CONTINUOUS_READ && !(flags & MODE_INCREMENTAL)) + errmsg_die("Use --continuous with --incremental only!"); + if ((max_overwrite > 0) && !(flags & MODE_OVERWRITE)) errmsg_die("Write count specified but mode is not --overwrite!"); @@ -461,7 +470,10 @@ int main(int argc, char **argv) pagesize = mtd.subpage_size; pagecount = mtd.eb_size / pagesize; - bs = pagesize; + if (!(flags & CONTINUOUS_READ)) + bs = pagesize; + else + bs = 2 * pagesize; if (peb >= mtd.eb_cnt) return errmsg("Physical erase block %d is out of range!", peb);