enable erase-suspend-program for CFI cmdset_0002
PATCH 1/1 enable erase-suspend-program for CFI cmdset_0002
erase-suspend for writing is required to avoid blocking applications that wish to write some data (to a NOR block other than the one being erased). Particularly, it solves some huge delays that an application (which writes to a UBIFS) will experience if UBI attaches to empty NOR flash. In this case the UBI background thread will erase a lot of blocks and the application can be blocked for minutes because of the "MTD/CFI chip lock".
This feature has been disabled for years. Maybe this was because the old code turned it on for erase-suspend read-only chips also (cfip->EraseSuspend & 0x1). This is wrong and corrected now.
I tested this patch and it seems to work fine.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +3 -13
@@ -490,10 +490,6 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd) }#endif -/* FIXME: erase-suspend-program is broken. See -http://lists.infradead.org/pipermail/linux-mtd/2003-December/009001.html */ -printk (KERN_NOTICE "cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.\n" ); -__module_get (THIS_MODULE );return mtd;
@@ -589,15 +585,9 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adrreturn 0 ;case FL_ERASING : -if (mode ==FL_WRITING )/* FIXME: Erase-suspend-program appears broken. */ - goto sleep; - -if (!( mode ==FL_READY - || mode ==FL_POINT - || !cfip - || (mode ==FL_WRITING && (cfip->EraseSuspend &0x2 )) - || (mode ==FL_WRITING && (cfip->EraseSuspend &0x1 ) - ))) +if (!cfip || !(cfip->EraseSuspend & (0x1 |0x2 )) || + !(mode ==FL_READY || mode ==FL_POINT || + (mode ==FL_WRITING && (cfip->EraseSuspend &0x2 )))) goto sleep;/* We could check to see if we're trying to access the sector
Signature · 1 line
1.5.2.2
Quoted 12 lines · Norbert van Bolhuis
erase-suspend for writing is required to avoid blocking applications that wish to write some data (to a NOR block other than the one being erased). Particularly, it solves some huge delays that an application (which writes to a UBIFS) will experience if UBI attaches to empty NOR flash. In this case the UBI background thread will erase a lot of blocks and the application can be blocked for minutes because of the "MTD/CFI chip lock".
This feature has been disabled for years. Maybe this was because the old code turned it on for erase-suspend read-only chips also (cfip->EraseSuspend&0x1). This is wrong and corrected now.
I tested this patch and it seems to work fine.
Quoted 1 line
Signed-off-by Norbert van Bolhuis <[email protected]>
FYI: I have no experience with non-Intel parts and no good knowledge of the cmdset_0002 code. So I can't review this.
Quoted 41 lines
--- drivers/mtd/chips/cfi_cmdset_0002.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-)drivers/mtd/chips/cfi_cmdset_0002.c +3
-13@@ -490,10 +490,6 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd) }#endif -/* FIXME: erase-suspend-program is broken. See -http://lists.infradead.org/pipermail/linux-mtd/2003-December/009001.html */ -printk (KERN_NOTICE "cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.\n" ); -__module_get (THIS_MODULE );return mtd;@@ -589,15 +585,9 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adrreturn 0 ;case FL_ERASING : -if (mode ==FL_WRITING )/* FIXME: Erase-suspend-program appears broken. */ - goto sleep; - -if (!( mode ==FL_READY - || mode ==FL_POINT - || !cfip - || (mode ==FL_WRITING && (cfip->EraseSuspend &0x2 )) - || (mode ==FL_WRITING && (cfip->EraseSuspend &0x1 ) - ))) +if (!cfip || !(cfip->EraseSuspend & (0x1 |0x2 )) || + !(mode ==FL_READY || mode ==FL_POINT || + (mode ==FL_WRITING && (cfip->EraseSuspend &0x2 )))) goto sleep;/* We could check to see if we're trying to access the sector Signature · 1 line
1.5.2.2
Quoted 13 lines · Nicolas Pitre
Quoted 11 lines · Norbert van Bolhuis
erase-suspend for writing is required to avoid blocking applications that wish to write some data (to a NOR block other than the one being erased). Particularly, it solves some huge delays that an application (which writes to a UBIFS) will experience if UBI attaches to empty NOR flash. In this case the UBI background thread will erase a lot of blocks and the application can be blocked for minutes because of the "MTD/CFI chip lock".
This feature has been disabled for years. Maybe this was because the old code turned it on for erase-suspend read-only chips also (cfip->EraseSuspend&0x1). This is wrong and corrected now.
I tested this patch and it seems to work fine.
Quoted 4 lines
Quoted 1 line
Signed-off-by Norbert van Bolhuis <[email protected]>FYI: I have no experience with non-Intel parts and no good knowledge of the
cmdset_0002code. So I can't review this.
OK.
so, who's approving/reviewing patches for cmdset_0002. Nobody ?
Quoted 16 lines · Norbert van Bolhuis
Quoted 15 lines · Nicolas Pitre
Quoted 12 lines · Norbert van Bolhuis
erase-suspend for writing is required to avoid blocking applications that wish to write some data (to a NOR block other than the one being erased). Particularly, it solves some huge delays that an application (which writes to a UBIFS) will experience if UBI attaches to empty NOR flash. In this case the UBI background thread will erase a lot of blocks and the application can be blocked for minutes because of the "MTD/CFI chip lock".
This feature has been disabled for years. Maybe this was because the old code turned it on for erase-suspend read-only chips also (cfip->EraseSuspend&0x1). This is wrong and corrected now.
I tested this patch and it seems to work fine.Signed-off-by Norbert van Bolhuis <[email protected]>
Quoted 7 lines
Quoted 3 lines
FYI: I have no experience with non-Intel parts and no good knowledge of the
cmdset_0002code. So I can't review this.OK.
so, who's approving/reviewing patches for
cmdset_0002. Nobody ?
I think we can just take it, since you tested it and confirm it works and solves a real problem. I'll put it to my l2 tree later, do not have time right now.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 11 lines · Norbert van Bolhuis
erase-suspend for writing is required to avoid blocking applications that wish to write some data (to a NOR block other than the one being erased). Particularly, it solves some huge delays that an application (which writes to a UBIFS) will experience if UBI attaches to empty NOR flash. In this case the UBI background thread will erase a lot of blocks and the application can be blocked for minutes because of the "MTD/CFI chip lock".
This feature has been disabled for years. Maybe this was because the old code turned it on for erase-suspend read-only chips also (cfip->EraseSuspend&0x1). This is wrong and corrected now.
I tested this patch and it seems to work fine.
Quoted 1 line
Signed-off-by Norbert van Bolhuis <[email protected]>
I did not follow the patch conversation too closely - but should you be the patch author or Joakim? If you took it as it is - then it is Joakim. If you modified it, then at least Joakim's name should be in the commit log.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 5 lines · Artem Bityutskiy
I did not follow the patch conversation too closely - but should you be the patch author or Joakim? If you took it as it is - then it is Joakim. If you modified it, then at least Joakim's name should be in the commit log.
I also removed the "printk(ERR_NOTICE ...", so I guess I modified it.
you want me to re-submit the patch with CC or Acked-by Joakim ?
Quoted 11 lines · Norbert van Bolhuis
Quoted 5 lines · Artem Bityutskiy
I did not follow the patch conversation too closely - but should you be the patch author or Joakim? If you took it as it is - then it is Joakim. If you modified it, then at least Joakim's name should be in the commit log.
I also removed the "printk(ERR_NOTICE ...", so I guess I modified it.
you want me to re-submit the patch with CC or Acked-by Joakim ?
If you just modify slightly, I can just make Joakim the author, which sounds fair. And put a not that you tweaked it - this is the common practice. Is this ok with you?
No need to re-send, I can do these things myself.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 5 lines · Artem Bityutskiy
If you just modify slightly, I can just make Joakim the author, which sounds fair. And put a not that you tweaked it - this is the common practice. Is this ok with you?
yes.
Quoted 2 lines
No need to re-send, I can do these things myself.
ok, good.
Quoted 8 lines · Norbert van Bolhuis
Quoted 5 lines · Artem Bityutskiy
If you just modify slightly, I can just make Joakim the author, which sounds fair. And put a not that you tweaked it - this is the common practice. Is this ok with you?
Quoted 6 lines
yes.
Quoted 2 lines
No need to re-send, I can do these things myself.
ok, good.
Pushed the patch to my l2 tree:
Thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)