Bill XIE has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/84614?usp=email )
Change subject: erasure_layout: Erase larger block only when all sub-block need erase ......................................................................
erasure_layout: Erase larger block only when all sub-block need erase
A larger (not the smallest) erase block used to get erased when half of sub-blocks it contains need erase, which has at least 2 issues:
1. The rest half of sub-blocks that do not need erase are also erased, introducing some erase overheads.
2. More severely, since this logic only selects a block and delects its sub-blocks when half of sub-blocks need erase, but this logic does not deselect "double sub-blocks (sub-blocks of sub-block)" not reach the limit under this block, the logic may cause duplicated erase. For example, if a erase block (often the largest one corresponding to the whole chip) has half of its sub-blocks and some incontiguous double sub-blocks needing erase, these double sub-blocks will end up being erased twice, introducing even more erase overheads than whole-chip erase.
The older behavior of flashrom before adding erasure_layout.c, when no communicational error occurs, will neither erase blocks that do not need erase, nor cause duplicated erase. Higher efficiency should be achieved without introducing extra erase overheads, by allowing combining contiguous small erase blocks only when they can coincidently form a larger erase block.
Change-Id: I9e10749186e395da67ec80e296119f33c3f83122 Signed-off-by: persmule persmule@hardenedlinux.org --- M erasure_layout.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/14/84614/1
diff --git a/erasure_layout.c b/erasure_layout.c index c3a415b..56841ab 100644 --- a/erasure_layout.c +++ b/erasure_layout.c @@ -228,7 +228,7 @@ }
const int total_blocks = sub_block_end - sub_block_start + 1; - if (count && count > total_blocks/2) { + if (count == total_blocks) { if (ll->start_addr >= rstart && ll->end_addr <= rend) { for (int j = sub_block_start; j <= sub_block_end; j++) layout[findex - 1].layout_list[j].selected = false;