All of lore.kernel.org
 help / color / mirror / Atom feed
* Is my erase block size correct?
@ 2012-07-24 16:05 Russell Zuck
  2012-07-24 16:44 ` Brian Norris
  2012-08-17 14:19 ` Artem Bityutskiy
  0 siblings, 2 replies; 5+ messages in thread
From: Russell Zuck @ 2012-07-24 16:05 UTC (permalink / raw)
  To: linux-mtd

I am attempting to troubleshoot an issue where my UBIFS becomes 
corrupted after repeated upgrade attempts.  Before I submit a bug report 
to the list, I'm attempting to rule out as many possibilities as I can.

While rechecking the datasheet for our NAND flash (Micron MT29F4G08BABWP 
4Gb), I noticed a discrepancy between the erase block size presented in 
the datasheet (128KiB + 4KiB) and that returned from mtdinfo (see 
below).  The extra 4KiB overhead is due to a 64Byte overhead for each of 
the 64 pages/block.

root@ctc-imx51 ~$ mtdinfo -a
Count of MTD devices:           4
Present MTD devices:            mtd0, mtd1, mtd2, mtd3
Sysfs interface supported:      yes

mtd0
Name:                           nor_flash
Type:                           dataflash
Eraseblock size:                512 bytes
Amount of eraseblocks:          8192 (4194304 bytes, 4.0 MiB)
Minimum input/output unit size: 512 bytes
Sub-page size:                  512 bytes
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

mtd1
Name:                           nand.bootloader
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          8 (1048576 bytes, 1024.0 KiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:2
Bad blocks are allowed:         true
Device is writable:             true

mtd2
Name:                           nand.kernel
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          24 (3145728 bytes, 3.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:4
Bad blocks are allowed:         true
Device is writable:             true

mtd3
Name:                           nand.rootfs
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          4064 (532676608 bytes, 508.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  512 bytes
OOB size:                       64 bytes
Character device major/minor:   90:6
Bad blocks are allowed:         true
Device is writable:             true

I've dug into the kernel source a bit and have come to the conclusion 
that the erase block size reported by mtdinfo comes from an 
interrogation of the MTD device by its driver.  I take this to mean that 
either I'm using the wrong driver, the driver is configured incorrectly, 
or the driver is correct and is not reporting the 4KiB overhead of each 
erase block.

Any help in confirming or refuting any of my 3 possible conclusions 
would be greatly appreciated.  Alternate theories are, of course, welcome.

Best regards,

Russell Zuck

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is my erase block size correct?
  2012-07-24 16:05 Is my erase block size correct? Russell Zuck
@ 2012-07-24 16:44 ` Brian Norris
  2012-07-24 19:29   ` Russell Zuck
  2012-08-17 14:19 ` Artem Bityutskiy
  1 sibling, 1 reply; 5+ messages in thread
From: Brian Norris @ 2012-07-24 16:44 UTC (permalink / raw)
  To: Russell Zuck; +Cc: linux-mtd

On Tue, Jul 24, 2012 at 9:05 AM, Russell Zuck
<rzuck@cincinnatitechnologies.com> wrote:
> While rechecking the datasheet for our NAND flash (Micron MT29F4G08BABWP
> 4Gb), I noticed a discrepancy between the erase block size presented in the
> datasheet (128KiB + 4KiB) and that returned from mtdinfo (see below).  The
> extra 4KiB overhead is due to a 64Byte overhead for each of the 64
> pages/block.

128KiB + 4KiB just means there is 128KiB in-band (regular) data area,
plus 4KiB OOB (out-of-band) area. Normally, the eraseblock size is
judged by just the data area (i.e., 128KiB). But you can "find" the
4KiB by some math from the mtdinfo output:

> root@ctc-imx51 ~$ mtdinfo -a
...
> mtd1
> Name:                           nand.bootloader
> Type:                           nand
> Eraseblock size:                131072 bytes, 128.0 KiB
> Amount of eraseblocks:          8 (1048576 bytes, 1024.0 KiB)
> Minimum input/output unit size: 2048 bytes

I/O size == page size

> Sub-page size:                  512 bytes
> OOB size:                       64 bytes

OOB size == out-of-band area per page

> Character device major/minor:   90:2
> Bad blocks are allowed:         true
> Device is writable:             true

So, OOB-per-eraseblock =
eraseblock size / page size * OOB-per-page =
128KiB / 2KiB * 64B =
64 * 64B = 4KiB

> Any help in confirming or refuting any of my 3 possible conclusions would be
> greatly appreciated.  Alternate theories are, of course, welcome.

"the driver is correct and is not reporting the 4KiB overhead of each
erase block."

This is pretty much true. mtdinfo (and the MTD subsystem) just records
these numbers slightly differently than you are reading from the data
sheet.

If you post more debug information and info about your system/driver
used, others may help with your UBIFS issues.

Brian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is my erase block size correct?
  2012-07-24 16:44 ` Brian Norris
@ 2012-07-24 19:29   ` Russell Zuck
  0 siblings, 0 replies; 5+ messages in thread
From: Russell Zuck @ 2012-07-24 19:29 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

On 7/24/2012 12:44 PM, Brian Norris wrote:
> If you post more debug information and info about your system/driver
> used, others may help with your UBIFS issues.

Thank you very much for the explanation.  I'll post the details of my 
UBIFS issue with supporting info in a separate thread.

Best regards,

Russ

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is my erase block size correct?
  2012-07-24 16:05 Is my erase block size correct? Russell Zuck
  2012-07-24 16:44 ` Brian Norris
@ 2012-08-17 14:19 ` Artem Bityutskiy
  2012-08-21 12:25   ` Russell Zuck
  1 sibling, 1 reply; 5+ messages in thread
From: Artem Bityutskiy @ 2012-08-17 14:19 UTC (permalink / raw)
  To: Russell Zuck; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On Tue, 2012-07-24 at 12:05 -0400, Russell Zuck wrote:
> mtd0
> Name:                           nor_flash
> Type:                           dataflash
> Eraseblock size:                512 bytes

What does /proc/mtd contain?

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Is my erase block size correct?
  2012-08-17 14:19 ` Artem Bityutskiy
@ 2012-08-21 12:25   ` Russell Zuck
  0 siblings, 0 replies; 5+ messages in thread
From: Russell Zuck @ 2012-08-21 12:25 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

On 8/17/2012 10:19 AM, Artem Bityutskiy wrote:
>> mtd0
>> >Name:                           nor_flash
>> >Type:                           dataflash
>> >Eraseblock size:                512 bytes
> What does /proc/mtd contain?
My apologies for the delayed reply.  I've been on vacation and unplugged 
by design.

Currently, we are booting out of the nor_flash partition and also 
loading the kernel from there.  Due to other technical challenges, we 
are not using either the mtd1 or mtd2 partitions at the moment.

dev:    size   erasesize  name
mtd0: 00400000 00000200 "nor_flash"
mtd1: 00100000 00020000 "nand.bootloader"
mtd2: 00300000 00020000 "nand.kernel"
mtd3: 1fc00000 00020000 "nand.rootfs"

Please see my thread "UBIFS corruption after software upgrade" 
originally posted on 7/24/2012 for more details about the problem that 
prompted this question about erase block size.  Any assistance you can 
provide with this issue would be greatly appreciated.

Best regards,

Russell Zuck

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-21 12:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-24 16:05 Is my erase block size correct? Russell Zuck
2012-07-24 16:44 ` Brian Norris
2012-07-24 19:29   ` Russell Zuck
2012-08-17 14:19 ` Artem Bityutskiy
2012-08-21 12:25   ` Russell Zuck

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.