[lkml]   [2015]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[PATCH 0/5] mtd: nand/UBI: add power-cut emulation

This series aims at adding a power-cut emulation layer at the nandsim
The final goal is to support MLC NAND emulation in nandsim in order to
validate the work done in the NAND, UBI and UBIFS layers to reliably
support those chips.

Even though the UBI layer already provides a power-cut emulation
infrastructure, I decided to add one at the nandsim layer for the
following reasons:
- IMO it is cleaner to isolate MLC NAND emulation in the NAND layer
- emulating unstable bits in UBI is not so easy: the unstable bits
issue happens when a program or erase operation is interrupted (by a
power-cut) while it is almost finished. In this case the next read
operation will succeed (return the expected data), but not the following
Emulating this problem requires knowing which block/page was being
accessed when the power-cut occurred, and if we want to validate that
UBI (not UBIFS) is robust to such errors, we have to reattach the mtd
partition to the UBI layer, and by doing that we loose the information
of which page/block was being programmed/erased when the power-cut
By implementing the power-cut emulation at the nandsim level, we can
easily detach/attach the emulated device, and check still keep those
- emulating paired pages in UBI is a bit easier but still requires some
knowledge about the pairing scheme (which differs from one chip to
another), and I'm not sure yet how this will be exposed by the MTD/NAND

This being said, I might be wrong in my assumptions, so feel free to
comment on that decision.

Regarding the code itself, this series adds a simple power-cut emulation
layer, and modifies the intermediate layers (NAND and UBI) to forward
emulated power-cut errors and let the UBIFS layer switch into read-only

Paired pages and unstable bits emulation is not part of the series, but
can be added on top of those changes by tweaking the actions taken in
nandsim when a power-cut is emulated.

Also, I'm not sure about the method used to inform NAND core when a
power-cut was emulated: I'm currently adding a virtual NAND status flag,
but adding a new field in the nand_chip struct might be a better approach.
This would also allow us to compile out code sections that are only useful
when doing NAND emulation.

Best Regards,


Boris Brezillon (5):
mtd: nand: add basic stuff to support power-cut emulation
mtd: nand: return -EROFS in case of power-cut emulation
UBI: switch the UBI device in read-only mode when mtd returns -EROFS
mtd: nand: nandsim: implement ->get_status()
mtd: nand: nandsim: add support for power-cut emulation

drivers/mtd/nand/nand_base.c | 34 ++++++--
drivers/mtd/nand/nandsim.c | 182 ++++++++++++++++++++++++++++++++++++++++---
drivers/mtd/ubi/io.c | 4 +-
include/linux/mtd/nand.h | 4 +
4 files changed, 207 insertions(+), 17 deletions(-)


 \ /
  Last update: 2015-09-25 17:21    [W:0.089 / U:0.484 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site