-
Notifications
You must be signed in to change notification settings - Fork 8.3k
drivers: dma: intel-adsp-hda: optimize L1 exit handling in ISR #81152
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
drivers: dma: intel-adsp-hda: optimize L1 exit handling in ISR #81152
Conversation
Use the existing 'atomic' bitmask to speed up ISR processing for CONFIG_DMA_INTEL_ADSP_HDA_TIMING_L1_EXIT. This bitmask is used to track enabled DMA channels. In the common case, only a few DMA channels are active and low channels are allocated first. Take advantage of this and not iterate over all DMA channels of all all host devices. Rather break out as soon as L1 exit handling is done for all enabled channels. Signed-off-by: Kai Vehmanen <[email protected]>
Align to coding style and use braces for all if blocks. Signed-off-by: Kai Vehmanen <[email protected]>
158a984 to
a2f1f78
Compare
|
V2:
|
|
|
||
| for (j = 0; j < dma_ctx->dma_channels; j++) { | ||
| if (!atomic_test_bit(dma_ctx->atomic, j)) | ||
| enabled_chs = atomic_get(dma_ctx->atomic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this suggests that the .atomic field cannot change while we're in the ISR? Also not by a different core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh It can change, but it's harmless for this loop as either we do one unnecessary check (for a channel that is already disabled by another core), or we have an additional ISR if it's enabled concurrently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i ok, sounds good, thanks for explaining! If we ever end up changing this file again, maybe would be good to add this as a comment there
| if (!(enabled_chs & BIT(j))) { | ||
| continue; | ||
| } | ||
| enabled_chs &= ~(BIT(j)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BIT() is properly defined, no need for additional parentheses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this got merged already, I can fix if we have other changes to do in a follow-up.
kv2019i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some post-merge comments. I can do a updated PR if needed, please check @lyakh
|
|
||
| for (j = 0; j < dma_ctx->dma_channels; j++) { | ||
| if (!atomic_test_bit(dma_ctx->atomic, j)) | ||
| enabled_chs = atomic_get(dma_ctx->atomic); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lyakh It can change, but it's harmless for this loop as either we do one unnecessary check (for a channel that is already disabled by another core), or we have an additional ISR if it's enabled concurrently.
| if (!(enabled_chs & BIT(j))) { | ||
| continue; | ||
| } | ||
| enabled_chs &= ~(BIT(j)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok this got merged already, I can fix if we have other changes to do in a follow-up.
Use the existing 'atomic' bitmask to speed up ISR processing for CONFIG_DMA_INTEL_ADSP_HDA_TIMING_L1_EXIT. This bitmask is used to track enabled DMA channels.
In the common case, only a few DMA channels are active and low channels are allocated first. Take advantage of this and not iterate over all DMA channels of all all host devices. Rather break out as soon as L1 exit handling is done for all enabled channels.