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

SystemLayerImplSelect: make safe with unbalanced Request/ClearCallback #21359

Merged

Conversation

woody-apple
Copy link
Contributor

This is an inproved version of #21135

Problem

Original version (3ca630c) could cause non balanced dispatch_suspend/dispatch_resume which is not allowed by the dispatch API, as pointed out in #pullrequestreview-1051517126.

Change overview

This version does not use dispatch_suspend/resume any more to prevent the problem, additionally making the implementation behaving as similar as possible as, and compatible with, the select() based fallback.

The fallback is required by some tests even on dispatch based platforms, when no dispatch queue can be started.

But for real applications on dispatch based platforms, there should always be a dispatch queue, so the implementation now issues a warning when RequestCallbackOnPendingXXX is called without a dispatch queue available.

Testing

  • functionality is covered by existing network test, which all pass (tested on Darwin)

…Callback (#21349)

Original version (3ca630c) could cause non balanced dispatch_suspend/dispatch_resume which is not allowed by the dispatch API, as pointed out in #pullrequestreview-1051517126.

This version does not use dispatch_suspend/resume any more to prevent the problem, additionally making the implementation behaving as similar as possible as, and compatible with, the select() based fallback.

The fallback is required by some tests even on dispatch based platforms, when no dispatch queue can be started.

But for real applications on dispatch based platforms, there should always be a dispatch queue, so the implementation now issues a warning when RequestCallbackOnPendingXXX is called without a dispatch queue available.
@github-actions
Copy link

github-actions bot commented Jul 28, 2022

PR #21359: Size comparison from efb3209 to 2d6edbb

Increases (3 builds for cc13x2_26x2, esp32, telink)
platform target config section efb3209 2d6edbb change % change
cc13x2_26x2 lock-mtd LP_CC2652R7 (read only) 653283 653291 8 0.0
.text 551928 551936 8 0.0
esp32 all-clusters-app c3devkit (read only) 1022586 1022590 4 0.0
.flash.text 1022586 1022590 4 0.0
telink lighting-app tlsr9518adk80d text 583758 583760 2 0.0
Decreases (2 builds for cc13x2_26x2, cyw30739)
platform target config section efb3209 2d6edbb change % change
cc13x2_26x2 lock-mtd LP_CC2652R7 (read/write) 183940 183932 -8 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 582918 582910 -8 -0.0
.app_xip_area 459880 459872 -8 -0.0
Full report (43 builds for bl602, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section efb3209 2d6edbb change % change
bl602 lighting-app bl602 (read/write) 1381050 1381050 0 0.0
.bss 117618 117618 0 0.0
.data 4480 4480 0 0.0
.text 1051348 1051348 0 0.0
bl602+rpc (read/write) 1426498 1426498 0 0.0
.bss 125058 125058 0 0.0
.data 4600 4600 0 0.0
.text 1083044 1083044 0 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 668147 668147 0 0.0
(read/write) 183196 183196 0 0.0
.bss 74236 74236 0 0.0
.data 3372 3372 0 0.0
.rodata 88195 88195 0 0.0
.text 579636 579636 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 633731 633731 0 0.0
(read/write) 157820 157820 0 0.0
.bss 73532 73532 0 0.0
.data 3372 3372 0 0.0
.rodata 77411 77411 0 0.0
.text 555996 555996 0 0.0
lock-ftd LP_CC2652R7 (read only) 671175 671175 0 0.0
(read/write) 170360 170360 0 0.0
.bss 71316 71316 0 0.0
.data 3296 3296 0 0.0
.rodata 76263 76263 0 0.0
.text 594432 594432 0 0.0
lock-mtd LP_CC2652R7 (read only) 653283 653291 8 0.0
(read/write) 183940 183932 -8 -0.0
.bss 67004 67004 0 0.0
.data 3296 3296 0 0.0
.rodata 100875 100875 0 0.0
.text 551928 551936 8 0.0
pump-app LP_CC2652R7 (read only) 680455 680455 0 0.0
(read/write) 161912 161912 0 0.0
.bss 71380 71380 0 0.0
.data 3296 3296 0 0.0
.rodata 88863 88863 0 0.0
.text 591108 591108 0 0.0
pump-controller-app LP_CC2652R7 (read only) 666199 666199 0 0.0
(read/write) 176304 176304 0 0.0
.bss 71516 71516 0 0.0
.data 3292 3292 0 0.0
.rodata 84679 84679 0 0.0
.text 581040 581040 0 0.0
shell LP_CC2652R7 (read only) 660830 660830 0 0.0
(read/write) 186032 186032 0 0.0
.bss 76556 76556 0 0.0
.data 3376 3376 0 0.0
.rodata 85166 85166 0 0.0
.text 575348 575348 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 582918 582910 -8 -0.0
.app_xip_area 459880 459872 -8 -0.0
.bss 65624 65624 0 0.0
.data 744 744 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 588822 588822 0 0.0
.app_xip_area 461056 461056 0 0.0
.bss 70352 70352 0 0.0
.data 748 748 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 588642 588642 0 0.0
.app_xip_area 466420 466420 0 0.0
.bss 64864 64864 0 0.0
.data 688 688 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read/write) 1087728 1087728 0 0.0
.bss 133260 133260 0 0.0
.data 2064 2064 0 0.0
.text 952384 952384 0 0.0
BRD4161A+rpc (read/write) 1142044 1142044 0 0.0
.bss 149940 149940 0 0.0
.data 2276 2276 0 0.0
.text 989808 989808 0 0.0
BRD4161A+rs911x (read/write) 973000 973000 0 0.0
.bss 161736 161736 0 0.0
.data 2048 2048 0 0.0
.text 809196 809196 0 0.0
lock-app BRD4161A+wf200 (read/write) 1128016 1128016 0 0.0
.bss 144368 144368 0 0.0
.data 2056 2056 0 0.0
.text 981572 981572 0 0.0
window-app BRD4161A (read/write) 1081204 1081204 0 0.0
.bss 134732 134732 0 0.0
.data 2092 2092 0 0.0
.text 944356 944356 0 0.0
esp32 all-clusters-app c3devkit (read only) 1022586 1022590 4 0.0
(read/write) 1486274 1486274 0 0.0
.dram0.bss 70296 70296 0 0.0
.dram0.data 14600 14600 0 0.0
.flash.rodata 215936 215936 0 0.0
.flash.text 1022586 1022590 4 0.0
.iram0.text 62902 62902 0 0.0
m5stack (read only) 1076183 1076183 0 0.0
(read/write) 488312 488312 0 0.0
.dram0.bss 75808 75808 0 0.0
.dram0.data 34144 34144 0 0.0
.flash.rodata 246364 246364 0 0.0
.flash.text 1070799 1070799 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w0+release (read/write) 642528 642528 0 0.0
.bss 69712 69712 0 0.0
.data 2044 2044 0 0.0
.text 568044 568044 0 0.0
lock k32w0+release (read/write) 699584 699584 0 0.0
.bss 70152 70152 0 0.0
.data 2052 2052 0 0.0
.text 624652 624652 0 0.0
linux all-clusters-app debug (read only) 2989369 2989369 0 0.0
(read/write) 155584 155584 0 0.0
.bss 61888 61888 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 85272 85272 0 0.0
.dynamic 608 608 0 0.0
.got 4568 4568 0 0.0
.init 27 27 0 0.0
.init_array 1144 1144 0 0.0
.rodata 269195 269195 0 0.0
.text 2541602 2541602 0 0.0
all-clusters-minimal-app debug (read only) 2832393 2832393 0 0.0
(read/write) 147288 147288 0 0.0
.bss 61088 61088 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 77864 77864 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 1136 1136 0 0.0
.rodata 269355 269355 0 0.0
.text 2387074 2387074 0 0.0
bridge-app debug+rpc (read only) 2350761 2350761 0 0.0
(read/write) 127160 127160 0 0.0
.bss 50176 50176 0 0.0
.data 3824 3824 0 0.0
.data.rel.ro 67304 67304 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 816 816 0 0.0
.rodata 201480 201480 0 0.0
.text 1986514 1986514 0 0.0
chip-tool debug (read only) 10426521 10426521 0 0.0
(read/write) 631224 631224 0 0.0
.bss 24856 24856 0 0.0
.data 3266 3266 0 0.0
.data.rel.ro 596592 596592 0 0.0
.dynamic 608 608 0 0.0
.got 5088 5088 0 0.0
.init 27 27 0 0.0
.init_array 760 760 0 0.0
.rodata 535381 535381 0 0.0
.text 8439252 8439252 0 0.0
chip-tool-ipv6only arm64 (read only) 9843908 9843908 0 0.0
(read/write) 678753 678753 0 0.0
.bss 32897 32897 0 0.0
.data 3272 3272 0 0.0
.data.rel.ro 624080 624080 0 0.0
.dynamic 560 560 0 0.0
.got 13552 13552 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 467588 467588 0 0.0
.text 7793828 7793828 0 0.0
lighting-app debug+rpc (read only) 2573641 2573641 0 0.0
(read/write) 130096 130096 0 0.0
.bss 49728 49728 0 0.0
.data 2096 2096 0 0.0
.data.rel.ro 72344 72344 0 0.0
.dynamic 608 608 0 0.0
.got 4392 4392 0 0.0
.init 27 27 0 0.0
.init_array 904 904 0 0.0
.rodata 217168 217168 0 0.0
.text 2185618 2185618 0 0.0
lock-app debug (read only) 2538817 2538817 0 0.0
(read/write) 125176 125176 0 0.0
.bss 48160 48160 0 0.0
.data 1712 1712 0 0.0
.data.rel.ro 69352 69352 0 0.0
.dynamic 608 608 0 0.0
.got 4424 4424 0 0.0
.init 27 27 0 0.0
.init_array 880 880 0 0.0
.rodata 232112 232112 0 0.0
.text 2140626 2140626 0 0.0
ota-provider-app debug (read only) 2343161 2343161 0 0.0
(read/write) 118944 118944 0 0.0
.bss 47776 47776 0 0.0
.data 1936 1936 0 0.0
.data.rel.ro 63336 63336 0 0.0
.dynamic 608 608 0 0.0
.got 4488 4488 0 0.0
.init 27 27 0 0.0
.init_array 760 760 0 0.0
.rodata 207704 207704 0 0.0
.text 1971794 1971794 0 0.0
ota-requestor-app debug (read only) 2464073 2464073 0 0.0
(read/write) 126304 126304 0 0.0
.bss 50144 50144 0 0.0
.data 2240 2240 0 0.0
.data.rel.ro 67992 67992 0 0.0
.dynamic 608 608 0 0.0
.got 4480 4480 0 0.0
.init 27 27 0 0.0
.init_array 824 824 0 0.0
.rodata 211264 211264 0 0.0
.text 2080530 2080530 0 0.0
shell debug (read only) 2572865 2572865 0 0.0
(read/write) 141736 141736 0 0.0
.bss 57736 57736 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 76944 76944 0 0.0
.dynamic 608 608 0 0.0
.got 4136 4136 0 0.0
.init 27 27 0 0.0
.init_array 1016 1016 0 0.0
.rodata 231250 231250 0 0.0
.text 2183554 2183554 0 0.0
thermostat-no-ble arm64 (read only) 2342812 2342812 0 0.0
(read/write) 141633 141633 0 0.0
.bss 55313 55313 0 0.0
.data 1672 1672 0 0.0
.data.rel.ro 75880 75880 0 0.0
.dynamic 560 560 0 0.0
.got 4992 4992 0 0.0
.init 24 24 0 0.0
.init_array 408 408 0 0.0
.rodata 138964 138964 0 0.0
.text 1966608 1966608 0 0.0
tv-app debug (read only) 3123569 3123569 0 0.0
(read/write) 257416 257416 0 0.0
.bss 167256 167256 0 0.0
.data 4736 4736 0 0.0
.data.rel.ro 78888 78888 0 0.0
.dynamic 608 608 0 0.0
.got 4848 4848 0 0.0
.init 27 27 0 0.0
.init_array 1064 1064 0 0.0
.rodata 253512 253512 0 0.0
.text 2681058 2681058 0 0.0
tv-casting-app debug (read only) 5378729 5378729 0 0.0
(read/write) 158592 158592 0 0.0
.bss 51352 51352 0 0.0
.data 2432 2432 0 0.0
.data.rel.ro 98432 98432 0 0.0
.dynamic 608 608 0 0.0
.got 4736 4736 0 0.0
.init 27 27 0 0.0
.init_array 1024 1024 0 0.0
.rodata 338641 338641 0 0.0
.text 4773010 4773010 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2450536 2450536 0 0.0
.bss 214516 214516 0 0.0
.data 5872 5872 0 0.0
.text 1413180 1413180 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1177167 1177167 0 0.0
bss 143120 143120 0 0.0
rodata 142552 142552 0 0.0
text 812540 812540 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1157223 1157223 0 0.0
bss 142356 142356 0 0.0
rodata 134088 134088 0 0.0
text 801856 801856 0 0.0
p6 all-clusters-app default (read only) 881560 881560 0 0.0
(read/write) 1686844 1686844 0 0.0
.bss 149136 149136 0 0.0
.data 2648 2648 0 0.0
.text 1526672 1526672 0 0.0
all-clusters-minimal-app default (read only) 882280 882280 0 0.0
(read/write) 1630956 1630956 0 0.0
.bss 148416 148416 0 0.0
.data 2648 2648 0 0.0
.text 1471504 1471504 0 0.0
light-app default (read only) 890584 890584 0 0.0
(read/write) 1552140 1552140 0 0.0
.bss 140320 140320 0 0.0
.data 2440 2440 0 0.0
.text 1400992 1400992 0 0.0
lock-app default (read only) 886112 886112 0 0.0
(read/write) 1589764 1589764 0 0.0
.bss 144776 144776 0 0.0
.data 2456 2456 0 0.0
.text 1434144 1434144 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 799520 799520 0 0.0
bss 70796 70796 0 0.0
noinit 40416 40416 0 0.0
text 567156 567156 0 0.0
lighting-app tlsr9518adk80d (read/write) 819652 819652 0 0.0
bss 71640 71640 0 0.0
noinit 40416 40416 0 0.0
text 583758 583760 2 0.0

@woody-apple woody-apple enabled auto-merge (squash) July 29, 2022 19:05
@woody-apple woody-apple merged commit 0db2d02 into sve Jul 29, 2022
@woody-apple woody-apple deleted the cherry-pick-00b5886344bac107348a1810040e929b9df590b6 branch July 29, 2022 20:21
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.

2 participants