On Thu, 31 Jul 2014 11:06:55 -0500 (CDT) Nate Case ncase@xes-inc.com wrote:
I decided to implement your proposal since I think it's cleaner; I just submitted that as v2 a few minutes ago. Feel free to bikeshed to your heart's content.
Thanks, that looks ok to me in general. I'd use just 'opts' for the field name, but let's hear what Carl-Daniel thinks about it first.
Sounds good.
The most immediate need was to add an option to bypass the check_erased_range() call in erase_and_write_block_helper() to speed up erases. Supposedly it reduced erase times from ~13 minutes to ~3 minutes. I don't know if this is a great idea or not since I had little to do with it; I just saw it in an internal svn branch where they implemented it by adding an ugly "erase_check" argument in addition to read_it, write_it, etc.
The erase check is one part of the safety net, and allows to bail out early if there are problems. The speedup you mentioned seems unreasonable from such a change alone IMHO. It does only read the erased block, so essentially the whole chip is read (in chunks) one additional time with the check enabled. Anyway, I think you can base your changes on this patch. And I personally would not mind if the infrastructure for the skipping would end up in flashrom as well (but disabled in cli_classic.c).
I can't claim that the 13 > 3 minute speedup came from this change alone with any certainty since I didn't do the testing myself. I see they also implemented a block_erase order reversal patch similar to Pablo's recent submission. So it's possible the benchmarking included that patch as well even though their comments suggested it was the erase check skipping alone.
Thanks,
Nate