Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1274358
| From | Michal Suchanek <hramrach@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v4 6/7] mtd: spi-nor: simplify write loop |
| Date | 2015-11-20 20:10 +0100 |
| Message-ID | <qwZei-2Vw-7@gated-at.bofh.it> (permalink) |
| References | <pXk5X-7mp-13@gated-at.bofh.it> <qwGEF-7yE-9@gated-at.bofh.it> <qwGEF-7yE-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 20 November 2015 at 00:18, Brian Norris <computersforpeace@gmail.com> wrote: > Hi Michal, > > Sorry this has sat so long... > > On Fri, Aug 14, 2015 at 09:23:08AM -0000, Michal Suchanek wrote: >> The spi-nor write loop assumes that what is passed to the hardware >> driver write() is what gets written. >> >> When write() writes less than page size at once data is dropped on the >> floor. Check the amount of data writen. > > Have you seen write() return less than the page size? I know you've > struggled with a SPI driver that can't do "very" (for some definition of > very) long transfers, due to unknown bugs, but I thought that "very" was > much larger than the page size. Not in the case of a driver that can transfer 63 bytes at a time. It because the DMA engine needed for normal operation was not merged yet, though. > >> This also means that write can start mid-page any time so there is >> no special case for first page. > > I think we'd have some problems if we start seeing hardware that can't > write ~256 bytes at a time. If nothing else, this can be a problem > because some SPI NOR flash are known to have inferior reliability if you > regularly write in small chunks. I believe this is because they actually > use some kind of internal ECC. > > So, if you're just guarding against a theoretical behavior, perhaps it's > best if this is done with some kind of assertion, as I'd rather not > encourage non-aligned writes if possible. I notice you used BUG_ON() in > another patch, but I'd suggest maybe something less harsh, like WARN() > or WARN_ONCE(). I agree that a warning is in order in the case when whole page cannot be written in one go. Thanks Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH v4 6/7] mtd: spi-nor: simplify write loop Brian Norris <computersforpeace@gmail.com> - 2015-11-20 00:20 +0100 Re: [PATCH v4 6/7] mtd: spi-nor: simplify write loop Michal Suchanek <hramrach@gmail.com> - 2015-11-20 20:10 +0100
csiph-web