New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
staging: vc04_services: Fix bulk cache maintenance #1987
Merged
Merged
Conversation
This file contains 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
vchiq_arm supports transfers less than one page and at arbitrary alignment, using the dma-mapping API to perform its cache maintenance (even though the VPU drives the DMA hardware). Read (DMA_FROM_DEVICE) operations use cache invalidation for speed, falling back to clean+invalidate on partial cache lines, with writes (DMA_TO_DEVICE) using flushes. If a read transfer has ends which aren't page-aligned, performing cache maintenance as if they were whole pages can lead to memory corruption since the partial cache lines at the ends (and any cache lines before or after the transfer area) will be invalidated. This bug was masked until the disabling of the cache flush in flush_dcache_page(). Honouring the requested transfer start- and end-points prevents the corruption. See: raspberrypi#1977 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Tested downstream builds on B+, Pi2 and Pi3. |
Looks good. vchiq_test is happy for me and kodi still runs. |
My bulk test is not happy. "vchiq_test -b 16 1"
|
I can't reproduce that. Can you replace the WARN_ON with a WARN that logs k, dma_buffers and len? For bonus marks, dump out the whole scatterlist. |
Never mind - I've got one. |
pelwell
pushed a commit
to pelwell/linux
that referenced
this pull request
May 4, 2017
create_pagelist uses a number of WARNs to sanity-check check the input user pages, verifying that only the first and last entries in the array are not integral pages. These WARNs use the output array index when it should be input array index. Although the difference is only significant in one instance, change all the indices for consistency. See: raspberrypi#1987 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Found it - see #1990. |
popcornmix
pushed a commit
that referenced
this pull request
May 4, 2017
create_pagelist uses a number of WARNs to sanity-check check the input user pages, verifying that only the first and last entries in the array are not integral pages. These WARNs use the output array index when it should be input array index. Although the difference is only significant in one instance, change all the indices for consistency. See: #1987 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
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.
vchiq_arm supports transfers less than one page and at arbitrary
alignment, using the dma-mapping API to perform its cache maintenance
(even though the VPU drives the DMA hardware). Read (DMA_FROM_DEVICE)
operations use cache invalidation for speed, falling back to
clean+invalidate on partial cache lines, with writes (DMA_TO_DEVICE)
using flushes.
If a read transfer has ends which aren't page-aligned, performing cache
maintenance as if they were whole pages can lead to memory corruption
since the partial cache lines at the ends (and any cache lines before or
after the transfer area) will be invalidated. This bug was masked until
the disabling of the cache flush in flush_dcache_page().
Honouring the requested transfer start- and end-points prevents the
corruption.
See: #1977
Signed-off-by: Phil Elwell phil@raspberrypi.org