All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: chengzhihao1 <chengzhihao1@huawei.com>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 Alvin Zhou <alvinzhou@mxic.com.tw>,
	leoyu@mxic.com.tw,  Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [RFC] mtd: ubi: skip programming unused bits in ubi headers
Date: Tue, 12 Aug 2025 08:57:08 +0200 (CEST)	[thread overview]
Message-ID: <152133202.103367.1754981828821.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20250812051949.983040-1-linchengming884@gmail.com>

----- Ursprüngliche Mail -----
> Von: "Cheng Ming Lin" <linchengming884@gmail.com>
> An: "richard" <richard@nod.at>, "chengzhihao1" <chengzhihao1@huawei.com>, "Miquel Raynal" <miquel.raynal@bootlin.com>,
> "Vignesh Raghavendra" <vigneshr@ti.com>, "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel"
> <linux-kernel@vger.kernel.org>
> CC: "Alvin Zhou" <alvinzhou@mxic.com.tw>, leoyu@mxic.com.tw, "Cheng Ming Lin" <chengminglin@mxic.com.tw>
> Gesendet: Dienstag, 12. August 2025 07:19:49
> Betreff: [RFC] mtd: ubi: skip programming unused bits in ubi headers

> From: Cheng Ming Lin <chengminglin@mxic.com.tw>
> 
> This patch prevents unnecessary programming of bits in ec_hdr and
> vid_hdr that are not used or read during normal UBI operation. These
> unused bits are typically already set to 1 in erased flash and do not
> need to be explicitly programmed to 0 if they are not used.
> 
> Programming such unused areas offers no functional benefit and may
> result in unnecessary flash wear, reducing the overall lifetime of the
> device. By skipping these writes, we preserve the flash state as much
> as possible and minimize wear caused by redundant operations.

We talk about programming a single (sub)page, right?

> This change ensures that only necessary fields are written when
> preparing UBI headers, improving flash efficiency without affecting
> functionality.

I have been told that writing 0xFF bytes to NAND should be avoided.
This is also why UBI initializes them to 0x00.

Do you have data which proves the opposite?

Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: Cheng Ming Lin <linchengming884@gmail.com>
Cc: chengzhihao1 <chengzhihao1@huawei.com>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 Alvin Zhou <alvinzhou@mxic.com.tw>,
	leoyu@mxic.com.tw,  Cheng Ming Lin <chengminglin@mxic.com.tw>
Subject: Re: [RFC] mtd: ubi: skip programming unused bits in ubi headers
Date: Tue, 12 Aug 2025 08:57:08 +0200 (CEST)	[thread overview]
Message-ID: <152133202.103367.1754981828821.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20250812051949.983040-1-linchengming884@gmail.com>

----- Ursprüngliche Mail -----
> Von: "Cheng Ming Lin" <linchengming884@gmail.com>
> An: "richard" <richard@nod.at>, "chengzhihao1" <chengzhihao1@huawei.com>, "Miquel Raynal" <miquel.raynal@bootlin.com>,
> "Vignesh Raghavendra" <vigneshr@ti.com>, "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel"
> <linux-kernel@vger.kernel.org>
> CC: "Alvin Zhou" <alvinzhou@mxic.com.tw>, leoyu@mxic.com.tw, "Cheng Ming Lin" <chengminglin@mxic.com.tw>
> Gesendet: Dienstag, 12. August 2025 07:19:49
> Betreff: [RFC] mtd: ubi: skip programming unused bits in ubi headers

> From: Cheng Ming Lin <chengminglin@mxic.com.tw>
> 
> This patch prevents unnecessary programming of bits in ec_hdr and
> vid_hdr that are not used or read during normal UBI operation. These
> unused bits are typically already set to 1 in erased flash and do not
> need to be explicitly programmed to 0 if they are not used.
> 
> Programming such unused areas offers no functional benefit and may
> result in unnecessary flash wear, reducing the overall lifetime of the
> device. By skipping these writes, we preserve the flash state as much
> as possible and minimize wear caused by redundant operations.

We talk about programming a single (sub)page, right?

> This change ensures that only necessary fields are written when
> preparing UBI headers, improving flash efficiency without affecting
> functionality.

I have been told that writing 0xFF bytes to NAND should be avoided.
This is also why UBI initializes them to 0x00.

Do you have data which proves the opposite?

Thanks,
//richard

  reply	other threads:[~2025-08-12  6:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  5:19 [RFC] mtd: ubi: skip programming unused bits in ubi headers Cheng Ming Lin
2025-08-12  5:19 ` Cheng Ming Lin
2025-08-12  6:57 ` Richard Weinberger [this message]
2025-08-12  6:57   ` Richard Weinberger
2025-08-14 10:11   ` Cheng Ming Lin
2025-08-14 10:11     ` Cheng Ming Lin
2025-08-14 11:30     ` Richard Weinberger
2025-08-14 11:30       ` Richard Weinberger
2025-09-05  3:21       ` Cheng Ming Lin
2025-09-05  3:21         ` Cheng Ming Lin
2025-09-12  7:57         ` Richard Weinberger
2025-09-12  7:57           ` Richard Weinberger
2025-09-12  7:57           ` Cheng Ming Lin
2025-09-12  7:57             ` Cheng Ming Lin
2025-09-12  8:04             ` Richard Weinberger
2025-09-12  8:04               ` Richard Weinberger
2025-09-12  8:19               ` Cheng Ming Lin
2025-09-12  8:19                 ` Cheng Ming Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152133202.103367.1754981828821.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=alvinzhou@mxic.com.tw \
    --cc=chengminglin@mxic.com.tw \
    --cc=chengzhihao1@huawei.com \
    --cc=leoyu@mxic.com.tw \
    --cc=linchengming884@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.