One bad PEB causes WL to run of PEBs

Winchenbach, Samuel Samuel-Winchenbach at idexx.com
Thu Jan 8 08:33:19 PST 2015


Hi All,

I am working on an instrument with uboot v2013.01.  This instrument experienced a nand corruption on one of the blocks (incrementing the bad PEB count to 1) when someone pulled the power plug.  When the instrument booted ubi_wl_init_scan had an error because avail_pebs was 0 and 1 was needed.   We added a bunch of debug prints and this is what it looks like (good and bad):

===== GOOD (BEFORE GETTING A BAD PEB) =====
idexx> ubi part nand-rootfs
UBI: mtd1 is detached from ubi0
Creating 1 MTD partitions on "nand0":
0x000001500000-0x000020000000 : "mtd=5"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI error: process_eb: DEBUG! found volume table at peb: 3926

UBI error: process_eb: DEBUG! found volume table at peb: 3927

UBI error: attach_by_scanning: DEBUG! peb_count: 3928 bad_peb_count: 0

UBI error: ubi_read_volume_table: DEBUG!
        reserved_pebs: 755957760
        alignment: 16777216
        data_pad: 0
        vol_type: 1
        upd_marker: 0
        name_len: 2816
        name: nand-rootfs
        flags: 0

UBI error: ubi_read_volume_table: DEBUG!: setting avail_pebs = 3928
UBI error: init_volumes: DEBUG! subtracting 3887 from avail_pebs.  Now 41
UBI error: ubi_eba_init_scan: DEBUG! subtracting 1 from avail_pebs.  Now 40
UBI error: ubi_eba_init_scan: DEBUG! subtracting 39 from avail_pebs.  Now 1
UBI error: ubi_wl_init_scan: DEBUG! subtracting 1 from avail_pebs.  Now 0
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "mtd=5"
UBI: MTD device size:            491 MiB
UBI: number of good PEBs:        3928
UBI: number of bad PEBs:         0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 3928
UBI: number of PEBs reserved for bad PEB handling: 39
UBI: max/mean erase counter: 21/10



===== BAD (AFTER GETTING A BAD PEB) =====
idexx> ubi part nand-rootfs
Creating 1 MTD partitions on "nand0":
0x000001500000-0x000020000000 : "mtd=5"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI error: process_eb: DEBUG! found volume table at peb: 3926

UBI error: process_eb: DEBUG! found volume table at peb: 3927

UBI error: attach_by_scanning: DEBUG! peb_count: 3928 bad_peb_count: 1

UBI error: ubi_read_volume_table: DEBUG!
        reserved_pebs: 755957760
        alignment: 16777216
        data_pad: 0
        vol_type: 1
        upd_marker: 0
        name_len: 2816
        name: nand-rootfs
        flags: 0

UBI error: ubi_read_volume_table: DEBUG!: setting avail_pebs = 3927
UBI error: init_volumes: DEBUG! subtracting 3887 from avail_pebs.  Now 40
UBI error: ubi_eba_init_scan: DEBUG! subtracting 1 from avail_pebs.  Now 39
UBI error: ubi_eba_init_scan: DEBUG! subtracting 39 from avail_pebs.  Now 0
UBI error: ubi_wl_init_scan: no enough physical eraseblocks (0, need 1)
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -12
UBI init error 12
idexx> nand bad

Device 0 bad blocks:
  05f40000
  2c120000
  3ff80000
  3ffa0000
  3ffc0000
  3ffe0000
idexx> 



Why (seeing there is a bad PEB does eba_init_scan still allocate 39 PEBs for bad blocks?   Shouldn't one of those be consumed by the bad PEB?    Do you see anything else that might point to this being a bug vs. incorrect usage?

Thanks for your help,
Sam


More information about the linux-mtd mailing list