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

Enable thread safety analysis for system mutex #23678

Merged
merged 4 commits into from
Apr 29, 2023

Conversation

arkq
Copy link
Contributor

@arkq arkq commented Nov 18, 2022

New Feature

Thread Safety Analysis is a clang extension tool which adds static analysis for potential race conditions.

This PR adds support for such thread safety analysis to Matter system mutex class.

Simple usage:

int state CHIP_GUARDED_BY(stateMtx);
chip::System::Mutex stateMtx;

void setState_wrong(int value) {
	state = value;      // <--- this will generate clang error during compilation because mutex is not acquired
}

void setState(int value) {
	chip::System::MutexUniqueLock lock(stateMtx);
	state = value;
}

Testing

CI will test build break with new feature added.

@pullapprove pullapprove bot requested review from ksperling-apple and lpbeliveau-silabs and removed request for isiu-apple December 12, 2022 16:29
@github-actions
Copy link

github-actions bot commented Dec 12, 2022

PR #23678: Size comparison from 29426b4 to b7f2e67

Increases above 0.2%:

platform target config section 29426b4 b7f2e67 change % change
bl702 lighting-app bl702 .debug_abbrev 1529212 1537475 8263 0.5
.debug_info 39221901 39497433 275532 0.7
bl702+rpc .debug_abbrev 1677326 1684511 7185 0.4
.debug_info 43520177 43748779 228602 0.5
psoc6 all-clusters cy8ckit_062s2_43012 .debug_abbrev 1238183 1245059 6876 0.6
.debug_info 27069299 27353808 284509 1.1
.debug_line 3707334 3720168 12834 0.3
all-clusters-minimal cy8ckit_062s2_43012 .debug_abbrev 1230074 1236916 6842 0.6
.debug_info 26806116 27090204 284088 1.1
.debug_line 3726271 3739079 12808 0.3
light cy8ckit_062s2_43012 .debug_abbrev 1064871 1071557 6686 0.6
.debug_info 22268790 22552932 284142 1.3
.debug_line 3293598 3306212 12614 0.4
lock cy8ckit_062s2_43012 .debug_abbrev 1066803 1073150 6347 0.6
.debug_info 22487212 22762877 275665 1.2
.debug_line 3293428 3305706 12278 0.4
Increases (14 builds for bl702, cc13x2_26x2, cyw30739, esp32, k32w, psoc6, telink)
platform target config section 29426b4 b7f2e67 change % change
bl702 lighting-app bl702 .debug_abbrev 1529212 1537475 8263 0.5
.debug_info 39221901 39497433 275532 0.7
.debug_line 5145782 5157524 11742 0.2
.debug_str 3479563 3479710 147 0.0
.text 956090 956092 2 0.0
bl702+rpc .debug_abbrev 1677326 1684511 7185 0.4
.debug_info 43520177 43748779 228602 0.5
.debug_line 5536797 5547059 10262 0.2
.debug_loc 3573873 3573916 43 0.0
.debug_str 3881984 3882036 52 0.0
.text 1030024 1030026 2 0.0
cc13x2_26x2 all-clusters-minimal-app LP_CC2652R7 (read only) 643875 643883 8 0.0
.text 564432 564440 8 0.0
lock-ftd LP_CC2652R7 (read only) 677247 677255 8 0.0
.text 599352 599360 8 0.0
cyw30739 ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 551490 551498 8 0.0
.app_xip_area 433252 433260 8 0.0
esp32 all-clusters-app c3devkit (read only) 1218896 1218898 2 0.0
.flash.text 1218896 1218898 2 0.0
k32w light k32w0+release (read/write) 673096 673112 16 0.0
.text 593404 593420 16 0.0
psoc6 all-clusters cy8ckit_062s2_43012 .debug_abbrev 1238183 1245059 6876 0.6
.debug_info 27069299 27353808 284509 1.1
.debug_line 3707334 3720168 12834 0.3
.debug_loc 3620896 3620980 84 0.0
all-clusters-minimal cy8ckit_062s2_43012 .debug_abbrev 1230074 1236916 6842 0.6
.debug_info 26806116 27090204 284088 1.1
.debug_line 3726271 3739079 12808 0.3
.debug_loc 3608502 3608586 84 0.0
light cy8ckit_062s2_43012 .debug_abbrev 1064871 1071557 6686 0.6
.debug_info 22268790 22552932 284142 1.3
.debug_line 3293598 3306212 12614 0.4
.debug_loc 3306424 3306491 67 0.0
lock cy8ckit_062s2_43012 .debug_abbrev 1066803 1073150 6347 0.6
.debug_info 22487212 22762877 275665 1.2
.debug_line 3293428 3305706 12278 0.4
.debug_loc 3327869 3327922 53 0.0
telink lighting-app tlsr9518adk80d text 719634 719636 2 0.0
ota-requestor-app tlsr9518adk80d text 662496 662498 2 0.0
thermostat tlsr9518adk80d (read/write) 955204 955212 8 0.0
text 651712 651714 2 0.0
Decreases (9 builds for cc13x2_26x2, cyw30739, psoc6, qpg, telink)
platform target config section 29426b4 b7f2e67 change % change
cc13x2_26x2 lock-ftd LP_CC2652R7 (read/write) 171848 171840 -8 -0.0
cyw30739 light cyw930739m2evb_01 (read/write) 588430 588422 -8 -0.0
.app_xip_area 464688 464680 -8 -0.0
lock cyw930739m2evb_01 (read/write) 592242 592234 -8 -0.0
.app_xip_area 463204 463196 -8 -0.0
psoc6 all-clusters cy8ckit_062s2_43012 .debug_str 3449247 3431455 -17792 -0.5
all-clusters-minimal cy8ckit_062s2_43012 .debug_str 3438259 3420467 -17792 -0.5
light cy8ckit_062s2_43012 .debug_str 3243845 3226053 -17792 -0.5
lock cy8ckit_062s2_43012 .debug_str 3259683 3241891 -17792 -0.5
qpg lock-app qpg6105+debug (read/write) 1117276 1117268 -8 -0.0
.text 564372 564364 -8 -0.0
telink all-clusters-app tlsr9518adk80d text 739436 739434 -2 -0.0
Full report (51 builds for bl602, bl702, cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, psoc6, qpg, telink)
platform target config section 29426b4 b7f2e67 change % change
bl602 lighting-app bl602 (read/write) 1355182 1355182 0 0.0
.bss 87057 87057 0 0.0
.data 9984 9984 0 0.0
.text 1037908 1037908 0 0.0
bl602+rpc (read/write) 1400958 1400958 0 0.0
.bss 95097 95097 0 0.0
.data 10384 10384 0 0.0
.text 1069328 1069328 0 0.0
bl702 lighting-app bl702 (read only) 3262 3262 0 0.0
(read/write) 1195567 1195567 0 0.0
.bleromro 6296 6296 0 0.0
.bleromrw 124 124 0 0.0
.boot2 688 688 0 0.0
.bss 67182 67182 0 0.0
.bss_psram 30048 30048 0 0.0
.comment 48 48 0 0.0
.data 4048 4048 0 0.0
.debug_abbrev 1529212 1537475 8263 0.5
.debug_aranges 132680 132680 0 0.0
.debug_frame 486776 486776 0 0.0
.debug_info 39221901 39497433 275532 0.7
.debug_line 5145782 5157524 11742 0.2
.debug_loc 3378857 3378857 0 0.0
.debug_ranges 363704 363704 0 0.0
.debug_str 3479563 3479710 147 0.0
.hbn 509 509 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 144 144 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 116336 116336 0 0.0
.rsvd 3188 3188 0 0.0
.shstrtab 293 293 0 0.0
.stack 2048 2048 0 0.0
.strtab 568679 568679 0 0.0
.symtab 172112 172112 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3262 3262 0 0.0
.text 0 0 0 0.0
956090 956092 2 0.0
bl702+rpc (read only) 3262 3262 0 0.0
(read/write) 1283995 1283995 0 0.0
.bleromro 6296 6296 0 0.0
.bleromrw 124 124 0 0.0
.boot2 688 688 0 0.0
.bss 75198 75198 0 0.0
.bss_psram 30320 30320 0 0.0
.comment 48 48 0 0.0
.data 4576 4576 0 0.0
.debug_abbrev 1677326 1684511 7185 0.4
.debug_aranges 140824 140824 0 0.0
.debug_frame 514248 514248 0 0.0
.debug_info 43520177 43748779 228602 0.5
.debug_line 5536797 5547059 10262 0.2
.debug_loc 3573873 3573916 43 0.0
.debug_ranges 387272 387272 0 0.0
.debug_str 3881984 3882036 52 0.0
.hbn 509 509 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 160 160 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 130048 130048 0 0.0
.rsvd 3188 3188 0 0.0
.shstrtab 293 293 0 0.0
.stack 2048 2048 0 0.0
.strtab 628901 628901 0 0.0
.symtab 190288 190288 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3262 3262 0 0.0
.text 0 0 0 0.0
1030024 1030026 2 0.0
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 679627 679627 0 0.0
(read/write) 171900 171900 0 0.0
.bss 81220 81220 0 0.0
.data 3380 3380 0 0.0
.rodata 89987 89987 0 0.0
.text 589328 589328 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 643875 643883 8 0.0
(read/write) 157996 157996 0 0.0
.bss 80500 80500 0 0.0
.data 3380 3380 0 0.0
.rodata 79123 79123 0 0.0
.text 564432 564440 8 0.0
lock-ftd LP_CC2652R7 (read only) 677247 677255 8 0.0
(read/write) 171848 171840 -8 -0.0
.bss 78876 78876 0 0.0
.data 3304 3304 0 0.0
.rodata 77415 77415 0 0.0
.text 599352 599360 8 0.0
lock-mtd LP_CC2652R7 (read only) 661955 661955 0 0.0
(read/write) 182396 182396 0 0.0
.bss 74132 74132 0 0.0
.data 3304 3304 0 0.0
.rodata 103499 103499 0 0.0
.text 557976 557976 0 0.0
pump-app LP_CC2652R7 (read only) 690183 690183 0 0.0
(read/write) 159648 159648 0 0.0
.bss 78844 78844 0 0.0
.data 3296 3296 0 0.0
.rodata 90935 90935 0 0.0
.text 598764 598764 0 0.0
pump-controller-app LP_CC2652R7 (read only) 674083 674083 0 0.0
(read/write) 175852 175852 0 0.0
.bss 78948 78948 0 0.0
.data 3292 3292 0 0.0
.rodata 86483 86483 0 0.0
.text 587120 587120 0 0.0
shell LP_CC2652R7 (read only) 670830 670830 0 0.0
(read/write) 183024 183024 0 0.0
.bss 83548 83548 0 0.0
.data 3376 3376 0 0.0
.rodata 86726 86726 0 0.0
.text 583788 583788 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 588430 588422 -8 -0.0
.app_xip_area 464688 464680 -8 -0.0
.bss 66200 66200 0 0.0
.data 728 728 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 592242 592234 -8 -0.0
.app_xip_area 463204 463196 -8 -0.0
.bss 71488 71488 0 0.0
.data 736 736 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 551490 551498 8 0.0
.app_xip_area 433252 433260 8 0.0
.bss 60736 60736 0 0.0
.data 684 684 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A+rpc (read/write) 976148 976148 0 0.0
.bss 152252 152252 0 0.0
.data 2168 2168 0 0.0
.text 821708 821708 0 0.0
BRD4161A+rs911x (read/write) 1037800 1037800 0 0.0
.bss 186728 186728 0 0.0
.data 2012 2012 0 0.0
.text 849040 849040 0 0.0
BRD4187C (read/write) 1149228 1149228 0 0.0
.bss 138648 138648 0 0.0
.data 2516 2516 0 0.0
.text 983468 983468 0 0.0
lock-app BRD4161A+wf200 (read/write) 1163488 1163488 0 0.0
.bss 158296 158296 0 0.0
.data 2020 2020 0 0.0
.text 1003152 1003152 0 0.0
window-app BRD4187C (read/write) 1141744 1141744 0 0.0
.bss 140064 140064 0 0.0
.data 2540 2540 0 0.0
.text 974544 974544 0 0.0
esp32 all-clusters-app c3devkit (read only) 1218896 1218898 2 0.0
(read/write) 1790954 1790954 0 0.0
.dram0.bss 76992 76992 0 0.0
.dram0.data 13928 13928 0 0.0
.flash.rodata 248312 248312 0 0.0
.flash.text 1218896 1218898 2 0.0
.iram0.text 71188 71188 0 0.0
m5stack (read only) 1233119 1233119 0 0.0
(read/write) 564179 564179 0 0.0
.dram0.bss 82144 82144 0 0.0
.dram0.data 34224 34224 0 0.0
.flash.rodata 314092 314092 0 0.0
.flash.text 1227735 1227735 0 0.0
.iram0.text 124803 124803 0 0.0
k32w contact k32w0+release (read/write) 662532 662532 0 0.0
.bss 77112 77112 0 0.0
.data 2104 2104 0 0.0
.text 564204 564204 0 0.0
light k32w0+release (read/write) 673096 673112 16 0.0
.bss 74904 74904 0 0.0
.data 2060 2060 0 0.0
.text 593404 593420 16 0.0
lock k32w0+release (read/write) 634068 634068 0 0.0
.bss 75664 75664 0 0.0
.data 2080 2080 0 0.0
.text 553596 553596 0 0.0
linux all-clusters-app debug (read only) 3111497 3111497 0 0.0
(read/write) 158472 158472 0 0.0
.bss 62432 62432 0 0.0
.data 2304 2304 0 0.0
.data.rel.ro 87144 87144 0 0.0
.dynamic 608 608 0 0.0
.got 4768 4768 0 0.0
.init 27 27 0 0.0
.init_array 1184 1184 0 0.0
.rodata 281227 281227 0 0.0
.text 2645778 2645778 0 0.0
all-clusters-minimal-app debug (read only) 2935177 2935177 0 0.0
(read/write) 149872 149872 0 0.0
.bss 61632 61632 0 0.0
.data 2272 2272 0 0.0
.data.rel.ro 79512 79512 0 0.0
.dynamic 608 608 0 0.0
.got 4680 4680 0 0.0
.init 27 27 0 0.0
.init_array 1160 1160 0 0.0
.rodata 280683 280683 0 0.0
.text 2473042 2473042 0 0.0
bridge-app debug (read only) 2472985 2472985 0 0.0
(read/write) 131216 131216 0 0.0
.bss 51456 51456 0 0.0
.data 3792 3792 0 0.0
.data.rel.ro 69912 69912 0 0.0
.dynamic 608 608 0 0.0
.got 4576 4576 0 0.0
.init 27 27 0 0.0
.init_array 840 840 0 0.0
.rodata 211424 211424 0 0.0
.text 2091874 2091874 0 0.0
chip-tool debug (read only) 11248873 11248873 0 0.0
(read/write) 659960 659960 0 0.0
.bss 25912 25912 0 0.0
.data 2754 2754 0 0.0
.data.rel.ro 624736 624736 0 0.0
.dynamic 608 608 0 0.0
.got 5184 5184 0 0.0
.init 27 27 0 0.0
.init_array 728 728 0 0.0
.rodata 604933 604933 0 0.0
.text 9116708 9116708 0 0.0
lighting-app debug+rpc (read only) 2661345 2661345 0 0.0
(read/write) 132328 132328 0 0.0
.bss 49952 49952 0 0.0
.data 2288 2288 0 0.0
.data.rel.ro 73896 73896 0 0.0
.dynamic 608 608 0 0.0
.got 4632 4632 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 227840 227840 0 0.0
.text 2256946 2256946 0 0.0
lock-app debug (read only) 2620409 2620409 0 0.0
(read/write) 127344 127344 0 0.0
.bss 48384 48384 0 0.0
.data 1904 1904 0 0.0
.data.rel.ro 70840 70840 0 0.0
.dynamic 608 608 0 0.0
.got 4664 4664 0 0.0
.init 27 27 0 0.0
.init_array 904 904 0 0.0
.rodata 244104 244104 0 0.0
.text 2204594 2204594 0 0.0
ota-provider-app debug (read only) 2187065 2187065 0 0.0
(read/write) 105480 105480 0 0.0
.bss 46528 46528 0 0.0
.data 2080 2080 0 0.0
.data.rel.ro 51768 51768 0 0.0
.dynamic 608 608 0 0.0
.got 3728 3728 0 0.0
.init 27 27 0 0.0
.init_array 736 736 0 0.0
.rodata 194952 194952 0 0.0
.text 1852594 1852594 0 0.0
ota-requestor-app debug (read only) 2355785 2355785 0 0.0
(read/write) 113824 113824 0 0.0
.bss 49056 49056 0 0.0
.data 2448 2448 0 0.0
.data.rel.ro 57128 57128 0 0.0
.dynamic 608 608 0 0.0
.got 3728 3728 0 0.0
.init 27 27 0 0.0
.init_array 824 824 0 0.0
.rodata 202064 202064 0 0.0
.text 2005010 2005010 0 0.0
shell debug (read only) 2643953 2643953 0 0.0
(read/write) 142936 142936 0 0.0
.bss 57832 57832 0 0.0
.data 1264 1264 0 0.0
.data.rel.ro 78040 78040 0 0.0
.dynamic 608 608 0 0.0
.got 4128 4128 0 0.0
.init 27 27 0 0.0
.init_array 1032 1032 0 0.0
.rodata 239474 239474 0 0.0
.text 2244962 2244962 0 0.0
tv-app debug (read only) 3283297 3283297 0 0.0
(read/write) 262120 262120 0 0.0
.bss 170776 170776 0 0.0
.data 4256 4256 0 0.0
.data.rel.ro 80384 80384 0 0.0
.dynamic 608 608 0 0.0
.got 5000 5000 0 0.0
.init 27 27 0 0.0
.init_array 1064 1064 0 0.0
.rodata 268376 268376 0 0.0
.text 2820930 2820930 0 0.0
tv-casting-app debug (read only) 5641625 5641625 0 0.0
(read/write) 162384 162384 0 0.0
.bss 52088 52088 0 0.0
.data 1936 1936 0 0.0
.data.rel.ro 101760 101760 0 0.0
.dynamic 608 608 0 0.0
.got 4912 4912 0 0.0
.init 27 27 0 0.0
.init_array 1040 1040 0 0.0
.rodata 358841 358841 0 0.0
.text 5005842 5005842 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2463424 2463424 0 0.0
.bss 215012 215012 0 0.0
.data 5872 5872 0 0.0
.text 1426068 1426068 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1190763 1190763 0 0.0
bss 145285 145285 0 0.0
rodata 144448 144448 0 0.0
text 819870 819870 0 0.0
nrf7002dk_nrf5340_cpuapp (read/write) 1360858 1360858 0 0.0
bss 105224 105224 0 0.0
rodata 211552 211552 0 0.0
text 759588 759588 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1136423 1136423 0 0.0
bss 144520 144520 0 0.0
rodata 120764 120764 0 0.0
text 790038 790038 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read only) 841976 841976 0 0.0
(read/write) 1748580 1748580 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 188704 188704 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2664 2664 0 0.0
.debug_abbrev 1238183 1245059 6876 0.6
.debug_aranges 110904 110904 0 0.0
.debug_frame 372244 372244 0 0.0
.debug_info 27069299 27353808 284509 1.1
.debug_line 3707334 3720168 12834 0.3
.debug_loc 3620896 3620980 84 0.0
.debug_ranges 345760 345760 0 0.0
.debug_str 3449247 3431455 -17792 -0.5
.heap 841976 841976 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 571583 571583 0 0.0
.symtab 422000 422000 0 0.0
.text 1548824 1548824 0 0.0
.zero.table 8 8 0 0.0
text 0 0 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read only) 842704 842704 0 0.0
(read/write) 1691108 1691108 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 187976 187976 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2664 2664 0 0.0
.debug_abbrev 1230074 1236916 6842 0.6
.debug_aranges 110376 110376 0 0.0
.debug_frame 375300 375300 0 0.0
.debug_info 26806116 27090204 284088 1.1
.debug_line 3726271 3739079 12808 0.3
.debug_loc 3608502 3608586 84 0.0
.debug_ranges 344376 344376 0 0.0
.debug_str 3438259 3420467 -17792 -0.5
.heap 842704 842704 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 535672 535672 0 0.0
.symtab 408432 408432 0 0.0
.text 1492080 1492080 0 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0
light cy8ckit_062s2_43012 (read only) 850896 850896 0 0.0
(read/write) 1609300 1609300 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 179992 179992 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2456 2456 0 0.0
.debug_abbrev 1064871 1071557 6686 0.6
.debug_aranges 102576 102576 0 0.0
.debug_frame 345636 345636 0 0.0
.debug_info 22268790 22552932 284142 1.3
.debug_line 3293598 3306212 12614 0.4
.debug_loc 3306424 3306491 67 0.0
.debug_ranges 308512 308512 0 0.0
.debug_str 3243845 3226053 -17792 -0.5
.heap 850896 850896 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 471997 471997 0 0.0
.symtab 376800 376800 0 0.0
.text 1418464 1418464 0 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0
lock cy8ckit_062s2_43012 (read only) 845904 845904 0 0.0
(read/write) 1643244 1643244 0 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 184968 184968 0 0.0
.comment 200 200 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2472 2472 0 0.0
.debug_abbrev 1066803 1073150 6347 0.6
.debug_aranges 102960 102960 0 0.0
.debug_frame 347432 347432 0 0.0
.debug_info 22487212 22762877 275665 1.2
.debug_line 3293428 3305706 12278 0.4
.debug_loc 3327869 3327922 53 0.0
.debug_ranges 310368 310368 0 0.0
.debug_str 3259683 3241891 -17792 -0.5
.heap 845904 845904 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 474714 474714 0 0.0
.symtab 378800 378800 0 0.0
.text 1447416 1447416 0 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1151244 1151244 0 0.0
.bss 100436 100436 0 0.0
.data 840 840 0 0.0
.text 598344 598344 0 0.0
lock-app qpg6105+debug (read/write) 1117276 1117268 -8 -0.0
.bss 95908 95908 0 0.0
.data 836 836 0 0.0
.text 564372 564364 -8 -0.0
telink all-clusters-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 1091704 1091704 0 0.0
bss 99808 99808 0 0.0
text 739436 739434 -2 -0.0
all-clusters-minimal-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 1031076 1031076 0 0.0
bss 99032 99032 0 0.0
text 704642 704642 0 0.0
light-switch-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 952500 952500 0 0.0
bss 91272 91272 0 0.0
text 651250 651250 0 0.0
lighting-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 1033916 1033916 0 0.0
bss 100420 100420 0 0.0
text 719634 719636 2 0.0
ota-requestor-app tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 966076 966076 0 0.0
bss 92228 92228 0 0.0
text 662496 662498 2 0.0
thermostat tlsr9518adk80d (read only) 4 4 0 0.0
(read/write) 955204 955212 8 0.0
bss 92664 92664 0 0.0
text 651712 651714 2 0.0

arkq added 2 commits April 28, 2023 15:51
Thread Safety Analysis [1] is a clang extension tool which adds static
analysis for potential race conditions.

This commit adds support for such thread safety analysis to Matter
system mutex class.

Simple usage:

  int state CHIP_GUARDED_BY(stateMtx);
  chip::System::Mutex stateMtx;

	void setState(int value) {
		chip::System::MutexUniqueLock lock(stateMtx);
		state = value;
	}

[1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
@github-actions
Copy link

PR #23678: Size comparison from 6ec5f81 to 840c3ef

Increases (1 build for cc32xx)
platform target config section 6ec5f81 840c3ef change % change
cc32xx lock CC3235SF_LAUNCHXL .debug_abbrev 956984 957407 423 0.0
.debug_info 19521971 19528686 6715 0.0
.debug_line 2682751 2683028 277 0.0
.debug_str 3059490 3059637 147 0.0
Full report (6 builds for cc32xx, nrfconnect, qpg)
platform target config section 6ec5f81 840c3ef change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 602714 602714 0 0.0
(read/write) 204156 204156 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197568 197568 0 0.0
.comment 206 206 0 0.0
.data 1468 1468 0 0.0
.debug_abbrev 956984 957407 423 0.0
.debug_aranges 103664 103664 0 0.0
.debug_frame 350552 350552 0 0.0
.debug_info 19521971 19528686 6715 0.0
.debug_line 2682751 2683028 277 0.0
.debug_line_str 513 513 0 0.0
.debug_loc 33340 33340 0 0.0
.debug_loclists 1506147 1506147 0 0.0
.debug_ranges 4984 4984 0 0.0
.debug_rnglists 96278 96278 0 0.0
.debug_str 3059490 3059637 147 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104250 104250 0 0.0
.shstrtab 265 265 0 0.0
.stack 2048 2048 0 0.0
.strtab 481887 481887 0 0.0
.symtab 287248 287248 0 0.0
.text 496340 496340 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1175616 1175616 0 0.0
bss 155593 155593 0 0.0
rodata 132864 132864 0 0.0
text 806424 806424 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read only) 4 4 0 0.0
(read/write) 1120852 1120852 0 0.0
bss 154749 154749 0 0.0
rodata 109684 109684 0 0.0
text 775816 775816 0 0.0
all-clusters-app nrf7002dk_nrf5340_cpuapp (read only) 4 4 0 0.0
(read/write) 1435216 1435216 0 0.0
bss 135333 135333 0 0.0
rodata 228880 228880 0 0.0
text 776960 776960 0 0.0
qpg lighting-app qpg6105+debug (read/write) 1165872 1165872 0 0.0
.bss 99640 99640 0 0.0
.data 856 856 0 0.0
.text 612972 612972 0 0.0
lock-app qpg6105+debug (read/write) 1135224 1135224 0 0.0
.bss 94792 94792 0 0.0
.data 852 852 0 0.0
.text 582320 582320 0 0.0

src/system/SystemMutex.h Outdated Show resolved Hide resolved
arkq added 2 commits April 28, 2023 20:56
such functionality out of the box. The only requirements is that the
_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 is defined.
@github-actions
Copy link

PR #23678: Size comparison from 6ec5f81 to 35ccb28

Full report (1 build for cc32xx)
platform target config section 6ec5f81 35ccb28 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 602714 602714 0 0.0
(read/write) 204156 204156 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197568 197568 0 0.0
.comment 206 206 0 0.0
.data 1468 1468 0 0.0
.debug_abbrev 956984 956984 0 0.0
.debug_aranges 103664 103664 0 0.0
.debug_frame 350552 350552 0 0.0
.debug_info 19521971 19521971 0 0.0
.debug_line 2682751 2682751 0 0.0
.debug_line_str 513 513 0 0.0
.debug_loc 33340 33340 0 0.0
.debug_loclists 1506147 1506147 0 0.0
.debug_ranges 4984 4984 0 0.0
.debug_rnglists 96278 96278 0 0.0
.debug_str 3059490 3059490 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104250 104250 0 0.0
.shstrtab 265 265 0 0.0
.stack 2048 2048 0 0.0
.strtab 481887 481887 0 0.0
.symtab 287248 287248 0 0.0
.text 496340 496340 0 0.0

@arkq arkq merged commit 29f0d36 into project-chip:master Apr 29, 2023
@arkq arkq deleted the thread-safety branch April 29, 2023 05:55
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.

4 participants