xiaoxiang781216 edited a comment on pull request #4878:
URL: https://github.com/apache/incubator-nuttx/pull/4878#issuecomment-979227329
> @xiaoxiang781216 Would you please explain (with an example) what problem
this is solving?
>
@hartmannathan already made a clear explanation here
https://github.com/apache/incubator-nuttx/pull/4872:
I haven't grokked exactly what the problem is in this particular instance,
but one possible issue may occur if buffers are not aligned and padded to exact
D-Cache line boundaries. From my hazy memory on H7 that's 32 bytes; don't know
on F7. I have been bitten by this one in the past:
Why an issue may occur: The "invalidate D-cache" operation basically means
"delete the contents of those cache lines." If any other data besides the DMA
buffers falls within those cache lines, e.g., variables, newer values of those
variables which are in the cache and not yet written to RAM will be lost,
leaving older stale values in RAM.
> It is fundamentally incorrect (and was prior to the change).
Yes, that is why this patch change invalidate to clean and than invalidate.
> Backing the start pointer up should never happen, because it will
invalidate the cache BEFOR the callers data structure.
So, do you want to advance to the next cache line in this case? But, this
approach is also wrong since the partial previous cache line the caller want to
invalidate get skippted.
In a system configure as writeback (This should be all M7 with the errata*)
it will corrupt a dirty cache line.
>
> ```
> *Errata 1259864
> Data corruption in a sequence of Write-Through stores and loads
> Status
> Affects: Cortex-M7, Cortex-M7 with FPU Fault Type: Programmer Category A
> Fault Status: Present in r0p1, r0p2, r1p0 and r1p1. Fixed in r1p2.
> ```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]