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

[Linux] Fix event loop task consecutive start/stop #26195

Merged
merged 3 commits into from
Apr 25, 2023

Conversation

arkq
Copy link
Contributor

@arkq arkq commented Apr 21, 2023

Problem

On Linux (POSIX implementation) it's not possible to start matter event loop task after calling PlatformMgr().StopEventLoopTask(). Also, it's not possible to reinitialize matter stack, because in that case event loop will not run as well.

Changes

  • reset mShouldRunEventLoop flag on _InitChipStack() and _StartEventLoopTask()
  • modified TestPlatformMgr to properly cover that use case scenario

Testing

CI will verify.

@github-actions
Copy link

PR #26195: Size comparison from 65f075c to 93e0791

Full report (1 build for cc32xx)
platform target config section 65f075c 93e0791 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330829 0 0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

@github-actions
Copy link

PR #26195: Size comparison from 65f075c to 8746d0c

Decreases (1 build for cc32xx)
platform target config section 65f075c 8746d0c change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20330829 20330828 -1 -0.0
Full report (1 build for cc32xx)
platform target config section 65f075c 8746d0c change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330828 -1 -0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

@arkq arkq force-pushed the linux-event-loop-start-stop branch from 8746d0c to 7c798ea Compare April 24, 2023 11:47
@github-actions
Copy link

PR #26195: Size comparison from de0dfcf to 7c798ea

Increases (1 build for cc32xx)
platform target config section de0dfcf 7c798ea change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20330829 20330830 1 0.0
Full report (1 build for cc32xx)
platform target config section de0dfcf 7c798ea change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330830 1 0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

@andy31415
Copy link
Contributor

@arkq it seems we need some fixes regarding std::mutex.

@arkq arkq force-pushed the linux-event-loop-start-stop branch from 7c798ea to 2c76680 Compare April 24, 2023 15:10
@arkq
Copy link
Contributor Author

arkq commented Apr 24, 2023

@arkq it seems we need some fixes regarding std::mutex.

I've changed sync implementation. Open IoT SDK seems to be a platform for MCUs which might use RTOS, so using mutex/condition_variables will be OS-specific. I've changed that sync to use simple busy loop with timeout, so it will work on all platforms.

@github-actions
Copy link

PR #26195: Size comparison from 05d79a2 to e5d4b59

Decreases (1 build for cc32xx)
platform target config section 05d79a2 e5d4b59 change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_info 20330830 20330828 -2 -0.0
Full report (1 build for cc32xx)
platform target config section 05d79a2 e5d4b59 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330830 20330828 -2 -0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

@andy31415 andy31415 merged commit 3124f51 into project-chip:master Apr 25, 2023
@arkq arkq deleted the linux-event-loop-start-stop branch April 25, 2023 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants