fs_fat32: Do not dirty the the buffer on non changes#175
Closed
davids5 wants to merge 1 commit intopx4_firmware_nuttx-10.1.0+from
Closed
fs_fat32: Do not dirty the the buffer on non changes#175davids5 wants to merge 1 commit intopx4_firmware_nuttx-10.1.0+from
davids5 wants to merge 1 commit intopx4_firmware_nuttx-10.1.0+from
Conversation
davids5
added a commit
that referenced
this pull request
Dec 22, 2021
For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen #175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
davids5
added a commit
to nuttx-to-asf/incubator-nuttx
that referenced
this pull request
Dec 22, 2021
For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen PX4/NuttX#175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
xiaoxiang781216
pushed a commit
to apache/nuttx
that referenced
this pull request
Dec 23, 2021
For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen PX4/NuttX#175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
dagar
pushed a commit
that referenced
this pull request
Dec 23, 2021
…write For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen #175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
dagar
pushed a commit
that referenced
this pull request
Dec 23, 2021
…write For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen #175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
Member
Author
|
This is solved at the point of control for all things using FS. |
Gary-Hobson
pushed a commit
to Gary-Hobson/nuttx
that referenced
this pull request
Jan 18, 2022
For FAT the same buffer is used for read and writes, there is a possibility a cache line is dirty. But the fs is not dirty and will not write the sector to disk. This can be seen PX4/NuttX#175 When the system is busy that cache line can be evicted after the RX DMA has completed and overwrite the data in memory. The solution is to invalidate before the DMA to prevent an evection causing an overwite, and after the DMA it to insure coherency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This the root cause of the seek error. The d-cache is dirty-ed by the in-place Directory information update into
fs_buffer. However if the the directory information is the same it will not be written out. This leaves the dirty cache lines in the buffer. On the next read of the FAT Sector, if eviction happens the dirty lines will overwrite the data in the DMA buffer.Impact
seek fails on the FAT FS. because the in memory copy of the FAT is corrupted.
Testing
16 threads of
tests datamanon PX4