Skip to content
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

tests: drivers: uart_async_api: fix userspace fault #78023

Merged

Conversation

EmilioCBen
Copy link
Contributor

Fixes #71983

@zephyrbot zephyrbot added area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers labels Sep 4, 2024
@dcpleung dcpleung assigned dleach02 and unassigned dcpleung Sep 4, 2024
decsny
decsny previously requested changes Sep 5, 2024
Copy link
Member

@decsny decsny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pay attention to what I did in this PR https://github.com/zephyrproject-rtos/zephyr/pull/71900/files

drivers/serial/uart_mcux_lpuart.c Outdated Show resolved Hide resolved
@@ -0,0 +1,2 @@
# Userspace is unable to access the nocache region.
CONFIG_USERSPACE=n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please explain this change in the commit message, and maybe the 1064 conf/overlay should be a separate commit, is it fixing the same issue? why is it only for rt1064? original issue was reported on rt1010

drivers/serial/uart_mcux_lpuart.c Outdated Show resolved Hide resolved
@EmilioCBen
Copy link
Contributor Author

Greetings @dcpleung and @andrewboie , I was wondering if you could take a look at this PR?
Context This PR added the ability to use the nocache region on the uart_async_api test. This in return broke some nxp platforms, for instance here with the mimxrt1064_evk, when using the sdram0 for sram, the 1064 can take advantage of using the nocache memory, but Userspace is unable to access the nocache region at the moment. What are your thoughts, should we be using Userspace for the uart test? I also notice @andrewboie, you explicitly set Userspace to be enabled, I know this may have been some time ago, but is there a particular reason you explicitly enabled it?
Happy to hear feedback from both of you.

@dcpleung
Copy link
Member

dcpleung commented Sep 5, 2024

Which test fails? There is a test drivers.uart.async_api.nocache_mem which explicitly disables userspace when there is nocache region.

@decsny
Copy link
Member

decsny commented Sep 5, 2024

commit message is out of date

@@ -81,9 +81,6 @@ tests:
harness_config:
fixture: gpio_loopback
depends_on: gpio
platform_allow:
- nucleo_f746zg
- nucleo_h723zg
Copy link
Collaborator

@hakehuang hakehuang Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better not change this but add supported platform instead

Copy link
Contributor Author

@EmilioCBen EmilioCBen Sep 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to see why this was added, what platforms are failing if this is not here? Also I was going to confirm if this part of the yaml file is even working, when I build with these two nucleo platforms, the extra Kconfig did not appear, neither did they appear for any of the rt series which is causing the tests to fail, however if I manually add the extra Kconfigs on the command line, the rt series passes.
@dcpleung @danieldegrasse
What am I missing from the file with this information?

@EmilioCBen EmilioCBen added the DNM This PR should not be merged (Do Not Merge) label Sep 24, 2024
@EmilioCBen
Copy link
Contributor Author

Added DNM tag, platforms are not passing right now

@EmilioCBen EmilioCBen force-pushed the fix/uart_async_api_fault branch 2 times, most recently from 05fb3b6 to 53dbab9 Compare September 24, 2024 15:06
@hakehuang
Copy link
Collaborator

@EmilioCBen , now all board testing PASS with CONFIG_USERSPACE=n for mcux series, but there is a annoying message for this case, for uart driver.
I do not understand the code below in the uart_mcux_lpuart.c function mcux_lpuart_rx_disable

	/* No active RX buffer, cannot disable */
	if (!data->async.rx_dma_params.buf) {
		LOG_ERR("No buffers to release from RX DMA!");

why send thie error message

2024-09-25 03:03:34,938 - twister - DEBUG - DEVICE: *** Booting Zephyr OS build v3.7.0-3110-g53dbab9a2da5 ***
2024-09-25 03:03:34,942 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_chain_read
2024-09-25 03:03:34,948 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:34,951 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:34,955 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:34,957 - twister - DEBUG - DEVICE: START - test_chained_read
2024-09-25 03:03:35,386 - twister - DEBUG - DEVICE: PASS - test_chained_read in 0.426 seconds
2024-09-25 03:03:35,392 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:35,396 - twister - DEBUG - DEVICE: TESTSUITE uart_async_chain_read succeeded
2024-09-25 03:03:35,400 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_chain_write
2024-09-25 03:03:35,406 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:35,409 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:35,412 - twister - DEBUG - DEVICE: START - test_chained_write
2024-09-25 03:03:35,417 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:35,420 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:35,424 - twister - DEBUG - DEVICE: PASS - test_chained_write in 0.009 seconds
2024-09-25 03:03:35,430 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:35,434 - twister - DEBUG - DEVICE: TESTSUITE uart_async_chain_write succeeded
2024-09-25 03:03:35,437 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_double_buf
2024-09-25 03:03:35,443 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:35,447 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:35,449 - twister - DEBUG - DEVICE: START - test_double_buffer
2024-09-25 03:03:36,112 - twister - DEBUG - -- west flash: using runner linkserver
-- runners.linkserver: LinkServer: /usr/local/LinkServer/LinkServer, version v1.6.121

2024-09-25 03:03:38,855 - twister - DEBUG - DEVICE: PASS - test_double_buffer in 3.403 seconds
2024-09-25 03:03:38,861 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:38,865 - twister - DEBUG - DEVICE: TESTSUITE uart_async_double_buf succeeded
2024-09-25 03:03:38,868 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_long_buf
2024-09-25 03:03:38,874 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:38,878 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:38,880 - twister - DEBUG - DEVICE: START - test_long_buffers
2024-09-25 03:03:39,045 - twister - DEBUG - DEVICE: PASS - test_long_buffers in 0.162 seconds
2024-09-25 03:03:39,051 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:39,055 - twister - DEBUG - DEVICE: TESTSUITE uart_async_long_buf succeeded
2024-09-25 03:03:39,058 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_multi_rx
2024-09-25 03:03:39,064 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:39,067 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:39,070 - twister - DEBUG - DEVICE: START - test_multiple_rx_enable
2024-09-25 03:03:39,474 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:39,678 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:39,782 - twister - DEBUG - DEVICE: PASS - test_multiple_rx_enable in 0.709 seconds
2024-09-25 03:03:39,789 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:39,792 - twister - DEBUG - DEVICE: TESTSUITE uart_async_multi_rx succeeded
2024-09-25 03:03:39,795 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_read_abort
2024-09-25 03:03:39,802 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:39,805 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:39,807 - twister - DEBUG - DEVICE: START - test_read_abort
2024-09-25 03:03:40,930 - twister - DEBUG - DEVICE: PASS - test_read_abort in 1.120 seconds
2024-09-25 03:03:40,936 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:40,940 - twister - DEBUG - DEVICE: TESTSUITE uart_async_read_abort succeeded
2024-09-25 03:03:40,944 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_single_read
2024-09-25 03:03:40,949 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:40,953 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:40,955 - twister - DEBUG - DEVICE: START - test_single_read
2024-09-25 03:03:41,310 - twister - DEBUG - DEVICE: PASS - test_single_read in 0.352 seconds
2024-09-25 03:03:41,316 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:41,320 - twister - DEBUG - DEVICE: TESTSUITE uart_async_single_read succeeded
2024-09-25 03:03:41,323 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_timeout
2024-09-25 03:03:41,329 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:41,332 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:41,335 - twister - DEBUG - DEVICE: START - test_forever_timeout
2024-09-25 03:03:43,347 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:44,339 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:44,343 - twister - DEBUG - DEVICE: PASS - test_forever_timeout in 3.004 seconds
2024-09-25 03:03:44,349 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:44,352 - twister - DEBUG - DEVICE: TESTSUITE uart_async_timeout succeeded
2024-09-25 03:03:44,356 - twister - DEBUG - DEVICE: Running TESTSUITE uart_async_write_abort
2024-09-25 03:03:44,362 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:44,365 - twister - DEBUG - DEVICE: E: No buffers to release from RX DMA!
2024-09-25 03:03:44,368 - twister - DEBUG - DEVICE: START - test_write_abort
2024-09-25 03:03:44,472 - twister - DEBUG - DEVICE: PASS - test_write_abort in 0.102 seconds
2024-09-25 03:03:44,478 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:44,482 - twister - DEBUG - DEVICE: TESTSUITE uart_async_write_abort succeeded
2024-09-25 03:03:44,486 - twister - DEBUG - DEVICE: ------ TESTSUITE SUMMARY START ------
2024-09-25 03:03:44,496 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_chain_read]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.426 seconds
2024-09-25 03:03:44,502 - twister - DEBUG - DEVICE: - PASS - [uart_async_chain_read.test_chained_read] duration = 0.426 seconds
2024-09-25 03:03:44,512 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_chain_write]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.009 seconds
2024-09-25 03:03:44,519 - twister - DEBUG - DEVICE: - PASS - [uart_async_chain_write.test_chained_write] duration = 0.009 seconds
2024-09-25 03:03:44,529 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_double_buf]: pass = 1, fail = 0, skip = 0, total = 1 duration = 3.403 seconds
2024-09-25 03:03:44,536 - twister - DEBUG - DEVICE: - PASS - [uart_async_double_buf.test_double_buffer] duration = 3.403 seconds
2024-09-25 03:03:44,546 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_long_buf]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.162 seconds
2024-09-25 03:03:44,552 - twister - DEBUG - DEVICE: - PASS - [uart_async_long_buf.test_long_buffers] duration = 0.162 seconds
2024-09-25 03:03:44,562 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_multi_rx]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.709 seconds
2024-09-25 03:03:44,569 - twister - DEBUG - DEVICE: - PASS - [uart_async_multi_rx.test_multiple_rx_enable] duration = 0.709 seconds
2024-09-25 03:03:44,579 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_read_abort]: pass = 1, fail = 0, skip = 0, total = 1 duration = 1.120 seconds
2024-09-25 03:03:44,586 - twister - DEBUG - DEVICE: - PASS - [uart_async_read_abort.test_read_abort] duration = 1.120 seconds
2024-09-25 03:03:44,596 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_single_read]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.352 seconds
2024-09-25 03:03:44,603 - twister - DEBUG - DEVICE: - PASS - [uart_async_single_read.test_single_read] duration = 0.352 seconds
2024-09-25 03:03:44,612 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_timeout]: pass = 1, fail = 0, skip = 0, total = 1 duration = 3.004 seconds
2024-09-25 03:03:44,619 - twister - DEBUG - DEVICE: - PASS - [uart_async_timeout.test_forever_timeout] duration = 3.004 seconds
2024-09-25 03:03:44,629 - twister - DEBUG - DEVICE: SUITE PASS - 100.00% [uart_async_write_abort]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.102 seconds
2024-09-25 03:03:44,636 - twister - DEBUG - DEVICE: - PASS - [uart_async_write_abort.test_write_abort] duration = 0.102 seconds
2024-09-25 03:03:44,639 - twister - DEBUG - DEVICE: ------ TESTSUITE SUMMARY END ------
2024-09-25 03:03:44,645 - twister - DEBUG - DEVICE: ===================================================================
2024-09-25 03:03:44,649 - twister - DEBUG - DEVICE: RunID: 02c9747a5bbfb924d0ba261679e00679
2024-09-25 03:03:44,651 - twister - DEBUG - DEVICE: PROJECT EXECUTION SUCCESSFUL

this is not related to this fixing PR. maybe we can work this with a new PR. Thanks

hakehuang
hakehuang previously approved these changes Sep 25, 2024
@EmilioCBen EmilioCBen removed the DNM This PR should not be merged (Do Not Merge) label Sep 25, 2024
@EmilioCBen
Copy link
Contributor Author

Thank you @hakehuang, I can look into this error message!

decsny
decsny previously approved these changes Sep 25, 2024
Updated overlay files to test using nocache.
and run outside of usersapce mode to avoid
inaccessible memory regions when using nocache on RT parts.
Also updated testcase file to reflect nocache testing.

Signed-off-by: Emilio Benavente <[email protected]>
@MaureenHelm MaureenHelm merged commit a6ed05e into zephyrproject-rtos:main Sep 30, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests: driver: drivers.uart.async_api.lpuart: mimxrt10xx_evk: hardfault
8 participants