-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
logging: uart_backend: add uncached async uart buffers support #87846
base: main
Are you sure you want to change the base?
logging: uart_backend: add uncached async uart buffers support #87846
Conversation
When async UART is used & DCache is enabled, some SoCs, like STM32H7, require UART buffers to be placed in nocache memory to avoid cache coherence issues. Fixes issue 87795 Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Enable the sample to run on stm32h750b-dk board with async UART backend Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
(.uart_dev = DEVICE_DT_GET(node_id),)) \ | ||
.data = &lbu_data##__VA_ARGS__, \ | ||
(.uart_dev = DEVICE_DT_GET(node_id),)) .data = \ | ||
&lbu_data##__VA_ARGS__, \ |
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.
To keep Clang-format happy :)
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.
No need to add this, clang-format isn't enforced.
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.
But it doesn't pass in CI too, is that okey?
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.
It's excluded in CI
zephyr/.github/workflows/compliance.yml
Line 75 in 19c6240
./scripts/ci/check_compliance.py --annotate -e KconfigBasic -e SysbuildKconfigBasic -e ClangFormat \ |
@@ -225,8 +225,15 @@ const struct log_backend_api log_backend_uart_api = { | |||
.format_set = format_set, | |||
}; | |||
|
|||
#ifdef CONFIG_LOG_BACKEND_UART_ASYNC |
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.
Maybe we should add && (defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H7RSX))
here as well since it's the (only) series concerned by this AFAIK.
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.
Putting buffer in __nocache will help but it will slow down the performance. Maybe it would be better to use STM guards for now. Other vendors may prefer to use cache line aligned memory and do the cache writeback which would have better performance. Nordic is using different appraoch. We have generic module used in drivers that detects if input buffer requires special action and uses memory pool to allocate buffer from a special location, do the copy and writeback if necessary.
#ifdef CONFIG_LOG_BACKEND_UART_ASYNC | ||
#define NOCACHE_ATTR __nocache | ||
#else | ||
#define ALIGN_BUF |
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.
is this used somewhere?
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.
No, just a leftover, will remove.
@@ -225,8 +225,15 @@ const struct log_backend_api log_backend_uart_api = { | |||
.format_set = format_set, | |||
}; | |||
|
|||
#ifdef CONFIG_LOG_BACKEND_UART_ASYNC |
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.
Putting buffer in __nocache will help but it will slow down the performance. Maybe it would be better to use STM guards for now. Other vendors may prefer to use cache line aligned memory and do the cache writeback which would have better performance. Nordic is using different appraoch. We have generic module used in drivers that detects if input buffer requires special action and uses memory pool to allocate buffer from a special location, do the copy and writeback if necessary.
When async UART is used & DCache is enabled, some SoCs, like STM32H7, require UART buffers to be placed in nocache memory to avoid cache coherence issues.
__nocache
attribute will have no effect ifCONFIG_NOCACHE_MEMORY=n
Fixes #87795