From patchwork Fri Oct 11 09:21:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Andersson X-Patchwork-Id: 1995963 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=MYOkdLxL; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256 header.s=selector1 header.b=GVjSjAeV; 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 4XQ1Pg28flz1xt1 for ; Fri, 11 Oct 2024 20:23:03 +1100 (AEDT) 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=6DUagpB2HxC3bPg9RJMPDjSE0JIrPEX7ZgTkHz/LTVc=; b=MYOkdLxLMj0Yjl PGluM/jeAwybjobgbauU7gy2cIRFOtKJFmA9K/X2xOs5JnC9cJckltx+Jlta9TmTpxi4760rTJsGO 0Ythlmss0HsdixAiCxKX++42a6FGU8DlJQX0aYbXE/0PIwD7B3cEOUYKvL8elfrw5ilmvWUTzMANJ HRhPA4Pyvw6h1Fop7EB8qNoz5IZRvA2U3XcsZp4vu/kPLs4NjmeVbyLLjTCcVpS1JcSzs+zFP+b9b mq3dRBjz8KqhFgcquOa+h4blz1/LW5UNegKqy7jM3zqR7DUt0xF5AdNVxJ0VGiVs1o9BRfECWg/mL 3FaXM2WDJ7vUi5gLAvPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szBrM-0000000Fp29-1lAP; Fri, 11 Oct 2024 09:22:56 +0000 Received: from mail-westeuropeazon11010026.outbound.protection.outlook.com ([52.101.69.26] helo=AM0PR83CU005.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szBrJ-0000000FozY-0Rpt for linux-mtd@lists.infradead.org; Fri, 11 Oct 2024 09:22:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kTZpM/7QsXsv3r+jN0ldNnjvVZloLV5CNUm/mW49vWM3irsOxJLPalRWp7V48NnDyQdWpxovquTPFUT+WBc6Q5NaCeR7ZVDexjXAb7bks5R3FSTo+leOqZzNcsBw1TmH8jTHtQyyo2FWQkM/uZs75tAXDFJgSfVIPMIY0fNjUHsd0NlHX7c0yZzcxfmsU21FxhX3VI4n4hWxmfsFjgEEnL2akura9m6KUqbCgBv2uyogcz3WfadVZRwCCGwNczlD5OBdnPahuY/lwiIUZvTx09RVAMATAd7nAS0lR6riyymdSw2fDnbMpWd5Auz+KsvioVmJP7cpN5nmXmVyisbfTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zSy4Ph8mRdsuxP5rE0rW0F4tcQLsL0a/XZhnf3krgvM=; b=VNto1VURnIjdVISFdMmEQ/dhRS86CDPE4qsHS9ZG1nXqqmFp3JRIVcdi/mMxxvR/b7PFoa1nZJM0AzKoF75BC4QNPDoWvDQZ+BwZNG+J6GXD2SOACycT/w7yoPnA7ge8ju09iseSBIGGkF4JWLMXSdrhSF3ziIWkj6tcDIlGE32P/IRH66tR9JjbNEqty0x4U+7+5ZRGJmXHel1V6/7j7CrMmB78qHAvSVG8HSdeFjR69hkVrSt759QHydGlijKDniMoHiiNQ50rxJpR4NchdLaeWcryUD2h39ysiah1RA0pD0uGqaiQFVkVgVymi+In2Br+gHSSFxxC4ZuCe1oleg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=nod.at smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zSy4Ph8mRdsuxP5rE0rW0F4tcQLsL0a/XZhnf3krgvM=; b=GVjSjAeVgqvzkcf4OtCF83voaq7FuvgTR28KKm/V3YnbAeoNQJiGFtdknTFbO+ZbZwoOJgL0O7BC7bsQEQjpimZwXe3xQ2RwO6xERDm175CqPbBkRrljqkJrnn2ksjvj7BNh2Vdl0kfTD/Vs1jtbs/l5LxsjpqMajAoWXZHzGw4= Received: from DU7P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:10:54d::32) by VI0PR02MB10659.eurprd02.prod.outlook.com (2603:10a6:800:202::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.18; Fri, 11 Oct 2024 09:22:10 +0000 Received: from DB1PEPF00039234.eurprd03.prod.outlook.com (2603:10a6:10:54d:cafe::8e) by DU7P195CA0019.outlook.office365.com (2603:10a6:10:54d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.20 via Frontend Transport; Fri, 11 Oct 2024 09:22:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by DB1PEPF00039234.mail.protection.outlook.com (10.167.8.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8048.13 via Frontend Transport; Fri, 11 Oct 2024 09:22:09 +0000 Received: from pc50632-2232.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 11 Oct 2024 11:22:08 +0200 From: Rickard Andersson To: , , , CC: , Subject: [PATCH v2 02/10] ubi: Expose mean erase counter for fastmap in sysfs Date: Fri, 11 Oct 2024 11:21:26 +0200 Message-ID: <20241011092134.2909496-2-rickard.andersson@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241011092134.2909496-1-rickard.andersson@axis.com> References: <20241011092134.2909496-1-rickard.andersson@axis.com> MIME-Version: 1.0 X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: se-mail02w.axis.com (10.20.40.8) To se-mail01w.axis.com (10.20.40.7) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF00039234:EE_|VI0PR02MB10659:EE_ X-MS-Office365-Filtering-Correlation-Id: ebc19ebc-e284-4b86-acf2-08dce9d62ed9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: Gab/nC0Y82bWZFd7gtamg/BBzfbR7ZuRfxH8IuLC1YOIIunwzmozJDy+nj9hM49z/n4UPN+r/sWsm6198KljPm8vvkQSSXv38a6vm3p/pz7b7KoNSgdyD8cjFquz68AqefbJhn/2quEPstwubFXYTdKBvB6PUW7CaXOT6Q01dpERWk9RS/5KqmDL8tx/4wtqorZB2av+Pu7FuuefTNle0U5vsbZwmrdL7g2+Kpf9goO3PG+LZFY/kzDBK5SQMIaOjBNTRpw6Q/HweP8fqeTiBYfEQkuuq3avRfNDxnbgrvkwbNDxitlwynIbNQWAXEC1uuu/Gy995NqCys0dlbmHdEtdahIwnYOJoh0fXcYNf0Gk9vTxB++CwwmJxeo1vLNAvr3jaxEfPYr/I5tpmzDh66NH9TpmJdzzxyUFWF1/oDeaCWhkPs9PTvTRsePgf0CCcOpyr11aNL/jx7Nvir5k28OaUvz79Ylitga7yiNPYfNU1ogrBUc5Ij0wIFA26ee+fS21dQOcr+5Mfnxof0yTxYXspw0NK4U2kxS1PaM9t/7ecyJ5g1Bg21k9QgqGNvmZfPl84WWz32AxpEBjSaDDImew3Gxq3eHMJyn7zUaQC/F97K2zXw/AoIgomPZ0d9a/7RrZ3tb2kQUB7L1oJLdggLsKeWwoRKd8Heyj6jrrwID2GOr9PE+X13hiLX9/8elRx5Mmsf/A5Pt7RbP+ACyjdCQg2IbsL8t/meddiUbOJmOJgpQn4lfPPC+NTDwRJULgXlYnM34BdEy2lO/EVzJCxlXxUIN4PD4Xg7hQXs+QDtRqJuQzxJwC2smFlWN3OTWRrZ9DcO0rXi0Ym/pbGdjP6tYUOdxRfvYWeFyykCHfZ8NVAzEioVejDhWENPbtBV5OBEkOIKvXC0knQVMzbgsGOqOZC4369bvv/C2N8XM5oohfxbjbmGtMvo7CGbn+8K/oCZCvP9YwbOlR78bEzNksUPxJ7zLOSNFenZwJBRpQP32IwMWE4qD5rz+RZHO7RXuOHm9aodbf2/bzJCa0QzmCh6lqMNyCgmwlOkbkUS62zPZIkUstqKYMqI70rf4Tihd31XPqBL03DlYMirLc/HFpBq9AEG3YdMhSekXPM0j4TDjr3uolgzqFjwc2yoqmdztVcrIuSDUntuQSHrPW8FzonJrgEGFcoTNqfG41AfxjK/Wa1Cjvn5t2fIysix42OprG+o6czMBpOfQABeX8UILT7ZhIDvNFw7II8M2pm461eC0Rd03OevBkVch512U5H/gHuBK2LKnlVymB+YbA7Sz/ONMCw8wZpbzO57XtpfNv+uCmc6rgM2gUbHYDXaXdKTs/Bc2N8k9awrDNy6b0ooJZnk4YLxbVJrYkN4Lk0VXLCwiyynZjUn09HWxZRJhooVOj X-Forefront-Antispam-Report: CIP:195.60.68.100;CTRY:SE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.axis.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2024 09:22:09.7433 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebc19ebc-e284-4b86-acf2-08dce9d62ed9 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af;Ip=[195.60.68.100];Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00039234.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR02MB10659 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_022253_448085_34C0357F X-CRM114-Status: GOOD ( 10.28 ) X-Spam-Score: -2.1 (--) 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: Since the fastmap area has its own wear levelling it is valuable to provide a mean value for that area. This value can be used in order to estimate life expectancy of the flash. Signed-off-by: Rickard Andersson --- drivers/mtd/ubi/build.c | 11 +++++++++++ 1 file changed, 11 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [52.101.69.26 listed in list.dnswl.org] 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. [52.101.69.26 listed in sa-accredit.habeas.com] -0.0 SPF_PASS SPF: sender matches SPF record 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. [52.101.69.26 listed in sa-trusted.bondedsender.org] -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.0 ARC_VALID Message has a valid ARC signature 0.0 ARC_SIGNED Message has a ARC signature -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [52.101.69.26 listed in wl.mailspike.net] 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. [52.101.69.26 listed in bl.score.senderscore.com] 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 Since the fastmap area has its own wear levelling it is valuable to provide a mean value for that area. This value can be used in order to estimate life expectancy of the flash. Signed-off-by: Rickard Andersson Reviewed-by: Zhihao Cheng --- drivers/mtd/ubi/build.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index fa38c434e447..3633c743e7d1 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -133,6 +133,10 @@ static struct device_attribute dev_max_ec = __ATTR(max_ec, S_IRUGO, dev_attribute_show, NULL); static struct device_attribute dev_mean_ec = __ATTR(mean_ec, S_IRUGO, dev_attribute_show, NULL); +#ifdef CONFIG_MTD_UBI_FASTMAP +static struct device_attribute dev_mean_ec_fastmap = + __ATTR(mean_ec_fastmap, S_IRUGO, dev_attribute_show, NULL); +#endif static struct device_attribute dev_reserved_for_bad = __ATTR(reserved_for_bad, S_IRUGO, dev_attribute_show, NULL); static struct device_attribute dev_bad_peb_count = @@ -413,6 +417,10 @@ static ssize_t dev_attribute_show(struct device *dev, ret = sprintf(buf, "%d\n", ubi->max_ec); else if (attr == &dev_mean_ec) ret = sprintf(buf, "%d\n", ubi_calc_mean_ec(ubi, 0, ubi->peb_count)); +#ifdef CONFIG_MTD_UBI_FASTMAP + else if (attr == &dev_mean_ec_fastmap) + ret = sprintf(buf, "%d\n", ubi_calc_mean_ec(ubi, 0, UBI_FM_MAX_START)); +#endif else if (attr == &dev_reserved_for_bad) ret = sprintf(buf, "%d\n", ubi->beb_rsvd_pebs); else if (attr == &dev_bad_peb_count) @@ -440,6 +448,9 @@ static struct attribute *ubi_dev_attrs[] = { &dev_volumes_count.attr, &dev_max_ec.attr, &dev_mean_ec.attr, +#ifdef CONFIG_MTD_UBI_FASTMAP + &dev_mean_ec_fastmap.attr, +#endif &dev_reserved_for_bad.attr, &dev_bad_peb_count.attr, &dev_max_vol_count.attr,