use hrtimer in nand_wait
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 11 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mtd: nand: panic_nand_wait expects timeout in ms.drivers/ | +6 | 0 replies | |
| 2/2 | mtd: nand: use hrtimer to measure timeout in nand_wait{_ready, }drivers/ | +30 | 9 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] use hrtimer in nand_wait
Hello all,
I've been researching a bug where blocks have gone bad when combining NAND writes with long periods of disabled interrupts. Such as lots of serial port writes (think printk) in interrupt context.
I've narrowed it down to the nand_wait routine and its dependency on a reliable jiffies counter. Sadly, jiffies is not reliable when handling of timer interrupts are delayed or even completely discarded. If interrupts are disabled for, say, 3 timer periods, jiffies will stop counting during this time and have a very fast increment by 3 when interrupts are later enabled. This combined with unfortunate timing can cause the timeout loop think a 20ms timeout is happening when just <0.1ms has passed in wall clock time.
To illustrate the jiffies/interrupt-relationship:
Interrupts: | | | | | | | Jiffies: | | | ||| | | |
This obviously only happen on multi-core CPUs, where the write and interrupts are executed by different cores simultaneously. Switching to hrtimer-based timeout solves this problem for me. I found a second (less serious) issue which included in the first patch.
Johan
Johan Gunnarsson (2):
mtd: nand: panic_nand_wait expects timeout in ms.
mtd: nand: use hrtimer to measure timeout in nand_wait{_ready,}
drivers/mtd/nand/nand_base.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-)
Signature · 1 line
1.7.2.5