Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5889283rdb; Thu, 14 Dec 2023 02:34:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFJCUco4ptB7PZSKAJVKYhtivWWwbZzHzI0kwqfLg8tyFZO5jp4bgiVMEdercoLf+/YNqI X-Received: by 2002:a05:6a00:1385:b0:6ce:63ff:50f0 with SMTP id t5-20020a056a00138500b006ce63ff50f0mr12176993pfg.37.1702550063877; Thu, 14 Dec 2023 02:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702550063; cv=none; d=google.com; s=arc-20160816; b=czh+r59mr137+tzV4yyW26biQckaHusw/d+LjKLnC+yxSmk69iAp+BGJIEeyi2s0SU pFnRYQ2tzU7rm8NpRkKyrCC6J4ASwJACXA7PFoAFF03KmQh0epID7gj/r3P35b1czrze JLYptW18JRpevJeZGxAKewpBmkktFlMHStoZ/GjywQi/Sm0oCC07g1puTrFt0WqKc8Z9 bRPERmpTUsOj/jZuiHtv7kD6kaGjh60bajwjET9W74uquenDF1k2O4u7s0FErG6cIuFk BwBYQ6Fik+3W9vDX665Cxw4nAh168QAhg8FWOMvkOf7tkrHwh2Kj+kPAlOPW5ARI9pUG axbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=jugSzKA5RANlnPt+1c8lwCcp54ROkWZ7TeiH8CT7p/A=; fh=cMGxg6wC8O/Qbf7VOjMSuaXyPcO4Zbw2Lly3vml5+6U=; b=tFudJGFeVM3ee5LBAupe4YuVD/VA15hV/aVpynx/y2oDhnc9ac734V6q+lSuPRenfE fFn7Sg4gdd0f9o97OJXLpM6h9JfButoP3g6cCGqtx6PMRp9+gHeStECQGjvYV4B4xu5z 1OOzPDj8P4Jt+jaIxk9RLagxABT27DVQaktzPHThY3v5v6SnPzF3+1gtjFj/W2ezrbcJ qfkf6/cAJpCTWqAh2NX/u1OVJGVB7KrEks1DE92xPRUlxwmkwDm3q82jOYAMOv6H0GwJ tskhSbb2Z0DHkShXdz4yfAsX4rj4FxJaoemlXe59HI5NDaPsPZQzwO0F+fdeFb+UAS4O SHOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=brU8mEhL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z12-20020a65610c000000b005c6b955fb87si11025110pgu.128.2023.12.14.02.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 02:34:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=brU8mEhL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CE7778028D77; Thu, 14 Dec 2023 02:34:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443669AbjLNKeK (ORCPT + 99 others); Thu, 14 Dec 2023 05:34:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443655AbjLNKeJ (ORCPT ); Thu, 14 Dec 2023 05:34:09 -0500 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FCB114; Thu, 14 Dec 2023 02:34:14 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B26C3240008; Thu, 14 Dec 2023 10:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1702550052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jugSzKA5RANlnPt+1c8lwCcp54ROkWZ7TeiH8CT7p/A=; b=brU8mEhL7FkhQ9ky50byWcLBDM0D5qpw0kEMSokgUJptsEhuGASnYkJylJIguGZ6nO/q5J FVbxguP1/E1tO9XDiuTLGfldOsfc1FU4ii0sRUurXO/55O7AXbGT89jWBc+J7WVxs2w79q 2QtfsWgH7gzMiZPFWmwUC1JzHH/bLPKnS+4d0kNRG1yZgoJqPzgqgQwkO4FXsqlo4xa/yl jTYFvc/Sf9BuQTy8+ZkRNEvv0ynT3nNW18Y796+iQIBUbNCr+ZVPDtWI8HLD3zWC22fhb7 Z6myHK497Hh5VFtbSEr1R1E7GtDYKK4nPwYj7nf4pyOjEAD3W0B+Pa8LBbu5WA== Date: Thu, 14 Dec 2023 11:34:07 +0100 From: Miquel Raynal To: Davidlohr Bueso Cc: Romain Gantois , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jens Axboe , Ard Biesheuvel , Thomas Petazzoni , Herve Codina , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [RFC PATCH 0/6] Add GPT parser to MTD layer Message-ID: <20231214113407.484e24a5@xps-13> In-Reply-To: References: <20231211151244.289349-1-romain.gantois@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 02:34:23 -0800 (PST) Hi Davidlohr, dave@stgolabs.net wrote on Mon, 11 Dec 2023 16:43:58 -0800: > On Mon, 11 Dec 2023, Romain Gantois wrote: >=20 > >Hello everyone, > > > >MTD devices were historically partitioned using fixed partitions schemes > >defined in the kernel device tree or on the cmdline. More recently, a bu= nch > >of dynamic parsers have been introduced, allowing partitioning informati= on > >to be stored in-band. However, unlike disks, parsers for MTD devices do = not > >support runtime discovery of the partition format. This format is instead > >named in the device-tree using a compatible string. > > > >The GUID Partition Table is one of the most common ways of partitioning a > >block device. As of now, there is no support in the MTD layer for parsing > >GPT tables. Indeed, use cases for layouts like GPT on raw Flash devices = are > >rare, and for good reason since these partitioning schemes are sensitive= to > >bad blocks in strategic locations such as LBA 2. Moreover, they do not > >allow proper wear-leveling to be performed on the full span of the devic= e. > > > >However, allowing GPT to be used on MTD devices can be practical in some > >cases. In the context of an A/B OTA upgrade that can act on either NOR of > >eMMC devices, having the same partition table format for both kinds of > >devices can simplify the task of the update software. > > > >This series adds a fully working MTD GPT parser to the kernel. Use of the > >parser is restricted to NOR flash devices, since NAND flashes are too > >susceptible to bad blocks. To ensure coherence and code-reuse between > >subsystems, I've factored device-agnostic code from the block layer GPT > >parser and moved it to a new generic library in lib/gpt.c. No functional > >change is intended in the block layer parser. > > > >I understand that this can seem like a strange feature for MTD devices, = but > >with the restriction to NOR devices, the partition table can be fairly > >reliable. Moreover, this addition fits nicely into the MTD parser model. > >Please tell me what you think. =20 >=20 > I am not a fan of this. The usecase seems very hacky and ad-hoc to justify > decoupling from the block layer, The use case indeed is a bit ad-hoc, as it is an OTA tool which makes it painful to handle two separate types of partitioning between blocks and mtd devices, so being able to parse a GPT on an mtd device would help a lot. > not to mention move complexity out of > userspace and into the kernel (new parser) for something that is already > being done/worked around. This is the part I don't fully agree with. There is no added complexity, the parser exists and is kept untouched (apart from the cosmetic changes). For a long time mtd partitioning information was kept out of the storage (through fixed-partitions) but it's been quite some time since the need for more flexible approaches arised, so we do have "dynamic" partition parsers already and the one proposed by Romain looks very straightforward and is thus not a problem to me. It basically just extends the list of partition tables mtd devices know about with a very common and popular format. To be honest I do not have a strong opinion on whether this should be merged or not but my reluctance is more about the mix of styles between 'block' and 'mtd'. People shall not treat them similarly for a number of reasons, and this parser is an obvious step towards a more common handling, knowing that it's been exclusively used on blocks for decades. > Also, what other user would consume this new gpt > lib abstraction in the future? I don't think it is worth it. Well, again I don't feel like this is a problem, sharing code between two parties is already a win and the choice for a lib sounds rational to me. The question being, shall we do it/do we want to do it. Thanks, Miqu=C3=A8l