From patchwork Fri Jul 29 09:16:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thibaut_VAR=C3=88NE?= X-Patchwork-Id: 1661939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=NDEcSN8n; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=slashdirt.org header.i=@slashdirt.org header.a=rsa-sha256 header.s=mail header.b=vNU30evB; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LvMQs5Sh4z9sGv for ; Fri, 29 Jul 2022 19:19:17 +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: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:In-Reply-To:References: List-Owner; bh=CQNe5OjXvATpd9XgpFMJezzMMR1UUBh/M+0gU8WHvbk=; b=NDEcSN8n09D0Wz rGJCj5PcbkJY77mbkV3r8VOvRhWzSNjOPCHEuDXruVQHWfqAbQ7Z9h+FPN7/ainxyW6+7fPK9p16s HTTD6FFgsFh2nqlpjdjF7vOYuB+wNJtygyC0z+KtIJv/TPo5Dp0ajQdh3meNs8X6dPDsI5yNOmz8B a4vmOxIPC6b/fgqi+9iSo3KmVJAkJqDsjAYEahZRLd2SGjJxXqLLH168CIMkdlG10W407Pt5UFBWw u80oe9U1W+fTCK1pv7OH8vgqrABGYXXaLg2TDslO8xyRomBFHeEQhMoslGtWryMrZP6nfTklzjk7d k2CRHKlFUuqeOB2dU8Jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHM8t-003jXc-2T; Fri, 29 Jul 2022 09:18:47 +0000 Received: from vps.slashdirt.org ([144.91.108.218]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHM7v-003ixJ-BY for linux-mtd@lists.infradead.org; Fri, 29 Jul 2022 09:17:50 +0000 Received: from supercopter.milliways.lan (unknown [IPv6:2a01:e0a:4ca:1080:42a8:f0ff:fe28:2844]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vps.slashdirt.org (Postfix) with ESMTPSA id 26CC560020; Fri, 29 Jul 2022 11:17:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 vps.slashdirt.org 26CC560020 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=slashdirt.org; s=mail; t=1659086257; bh=6LkMXTP7jkDykP1YakGzntZ8zk864lDuA628WTJ3UDI=; h=From:To:Cc:Subject:Date:From; b=vNU30evBYnUwt3UHSNVaS0X4e0kCrT3wXId4dXr0L39FlwvkpmbhbVxjRSwBy+M2O XkVtkOlN6KyxYyxLauUviHozHLyZLPxdELAPcAaCFLlobq/SfGtaeBwsm/rsAzibz2 0S9rq2nL+L25hJqrRrAEoBWf+lEj4AMOuYY/HJDM= From: =?utf-8?q?Thibaut_VAR=C3=88NE?= To: linux-mtd@lists.infradead.org Cc: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, tudor.ambarus@microchip.com, p.yadav@ti.com, michael@walle.cc, git@johnthomson.fastmail.com.au, =?utf-8?q?Thibaut_VAR=C3=88NE?= Subject: [PATCH v3 0/3] mtd: write support for minor-aligned partitions Date: Fri, 29 Jul 2022 11:16:33 +0200 Message-Id: <20220729091636.59287-1-hacks+kernel@slashdirt.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_021747_945654_13D70976 X-CRM114-Status: UNSURE ( 9.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.2 (/) 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: This patch series enable write support for minor-aligned mtd partitions on devices that support multiple erasesizes. On supporting hardware, they enable RW operations on mtd partitions that break "major" (largest) erasesize boundary (e.g. too small or not correctly aligned) without sacrificing performance (i.e. forc [...] Content analysis details: (0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.4 NO_DNS_FOR_FROM RBL: Envelope sender has no MX or A DNS records [listed in slashdirt.org. IN A] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 This patch series enable write support for minor-aligned mtd partitions on devices that support multiple erasesizes. On supporting hardware, they enable RW operations on mtd partitions that break "major" (largest) erasesize boundary (e.g. too small or not correctly aligned) without sacrificing performance (i.e. forcing everything to use 4K sectors). Finally, they address an historical FIXME in mtdpart.c. The following performance numbers were measured with v5.10 kernel on OpenWrt: (CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y forces the use of the new code path) OpenWrt 5.10 ramips MT7621 w25q128jv 0xfc0000 firmware partition length time mtd erase firmware Without this patch: MTD_SPI_NOR_USE_4K_SECTORS=n |y real 0m 50.86s |2m 11.66s user 0m 0.00s |0m 0.00s sys 0m 50.80s |1m 56.20s can write minor-aligned parts? N|Y With this patch: MTD_SPI_NOR_USE_VARIABLE_ERASE=n|y |4K_SECTORS=y real 0m 51.68s |0m 50.85s |2m 12.89s user 0m 0.00s |0m 0.00s |0m 0.01s sys 0m 46.94s |0m 50.38s |2m 12.46s can write minor-aligned parts? N|Y |Y NB: This patchset was previously submitted as a monolithic patch (RFC[0], v1[1]). While not submitted upstream v2 was however reviewed, tested and accepted in OpenWrt, and backported into the upcoming 22.03 stable branch: https://github.com/openwrt/openwrt/pull/3271 [0] 20210104122853.18428-1-git@johnthomson.fastmail.com.au [1] 20210608040719.14431-1-git@johnthomson.fastmail.com.au Changes v2 -> v3: - Split patch into incremental, functionally-separate changes. - Adjusted erasesize_minor assignment check in spi-nor/core.c - Addressed checkpatch warning on "printk(KERN_WARNING..." - Documented new sysfs attribute Changes v1 -> v2: - Added mtdcore sysfs attribute for erasesize_minor - Removed finding minor erasesize for variable erase regions device, (untested and no response to RFC). - Moved IF_ENABLED() to guard setting erasesize_minor in spi-nor/core.c - Removed setting major erasesize to minor where partition boundaries require minor erase to be writable - Simplified minor boundary check by relying on minor being a factor of major Changes RFC -> v1: - Fixed uninitialized variable smatch warning Thibaut VARĂˆNE (3): mtd: mtdpart: write support for minor-aligned partitions mtd: spi-nor: set erasesize_minor in spi_nor_select_erase() mtd: spi-nor: allow overriding uniform erase Documentation/ABI/testing/sysfs-class-mtd | 8 ++++++ drivers/mtd/mtdcore.c | 10 +++++++ drivers/mtd/mtdpart.c | 35 ++++++++++++++++------- drivers/mtd/spi-nor/Kconfig | 10 +++++++ drivers/mtd/spi-nor/core.c | 13 +++++++-- include/linux/mtd/mtd.h | 2 ++ 6 files changed, 65 insertions(+), 13 deletions(-) base-commit: e0dccc3b76fb35bb257b4118367a883073d7390e