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

DataModelProvider: add mark dirty for WriteAttribute function #36988

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wqx6
Copy link
Contributor

@wqx6 wqx6 commented Jan 8, 2025

Some write operations in data model provider should not mark the attribute as dirty.
For example, CurrentLevel attribute in LevelControl cluster should not be reported frequently during a transition after the device receives a LevelMove command. Some changes during the transition should be quiet and not reported to the subscriber. So we need to add a markDirty for the WriteAttribute function in DataModelProvider.

Testing

Unit test should pass

Copy link

Review changes with  SemanticDiff

Copy link

github-actions bot commented Jan 8, 2025

PR #36988: Size comparison from dedef1f to 80145a3

Full report (70 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section dedef1f 80145a3 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1354956 1354962 6 0.0
RAM 104152 104152 0 0.0
bl702 lighting-app bl702+eth FLASH 726256 726520 264 0.0
RAM 25361 25361 0 0.0
bl702+wifi FLASH 913126 913134 8 0.0
RAM 14101 14101 0 0.0
bl706+mfd+rpc+littlefs FLASH 1173960 1173968 8 0.0
RAM 23941 23941 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 1083028 1083036 8 0.0
RAM 16612 16612 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 840208 840248 40 0.0
RAM 123696 123696 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825748 825788 40 0.0
RAM 125584 125584 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772568 772608 40 0.0
RAM 114060 114060 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756748 756804 56 0.0
RAM 114260 114260 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 540049 540089 40 0.0
RAM 205800 205800 0 0.0
lock CC3235SF_LAUNCHXL FLASH 574217 574257 40 0.0
RAM 205944 205944 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681745 681785 40 0.0
RAM 78756 78756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701597 701637 40 0.0
RAM 81396 81396 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701597 701637 40 0.0
RAM 81396 81396 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658525 658565 40 0.0
RAM 73824 73824 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618369 618409 40 0.0
RAM 71748 71748 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637997 638037 40 0.0
RAM 74292 74292 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637997 638037 40 0.0
RAM 74292 74292 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637769 637817 48 0.0
RAM 74756 74756 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657477 657525 48 0.0
RAM 77300 77300 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657477 657525 48 0.0
RAM 77300 77300 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614389 614437 48 0.0
RAM 68844 68844 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634241 634289 48 0.0
RAM 71476 71476 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634241 634289 48 0.0
RAM 71476 71476 0 0.0
efr32 lock-app BRD4187C FLASH 932676 932708 32 0.0
RAM 160228 160228 0 0.0
BRD4338a FLASH 747160 747200 40 0.0
RAM 233356 233356 0 0.0
window-app BRD4187C FLASH 1025592 1025624 32 0.0
RAM 128332 128332 0 0.0
esp32 all-clusters-app c3devkit DRAM 95352 95352 0 0.0
FLASH 1541956 1542002 46 0.0
IRAM 82552 82552 0 0.0
m5stack DRAM 116332 116332 0 0.0
FLASH 1548154 1548202 48 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2730137 2730389 252 0.0
RAM 133096 133096 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 6018726 6018946 220 0.0
RAM 523992 523992 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5355204 5355424 220 0.0
RAM 243008 243008 0 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4703618 4703838 220 0.0
RAM 221760 221760 0 0.0
chip-tool debug unknown 5992 5992 0 0.0
FLASH 12866788 12866986 198 0.0
RAM 582586 582586 0 0.0
chip-tool-ipv6only arm64 unknown 21400 21400 0 0.0
FLASH 10995728 10995904 176 0.0
RAM 633584 633584 0 0.0
fabric-admin debug unknown 5816 5816 0 0.0
FLASH 11272273 11272471 198 0.0
RAM 582930 582930 0 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4528852 4529104 252 0.0
RAM 208880 208880 0 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5639429 5639685 256 0.0
RAM 475880 475880 0 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5639409 5639617 208 0.0
RAM 232008 232008 0 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4751986 4752238 252 0.0
RAM 208008 208008 0 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4378612 4378864 252 0.0
RAM 201696 201696 0 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4517520 4517772 252 0.0
RAM 206280 206280 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3036685 3036909 224 0.0
RAM 160736 160736 0 0.0
thermostat-no-ble arm64 unknown 9584 9584 0 0.0
FLASH 4118968 4119208 240 0.0
RAM 246296 246296 0 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5988693 5988917 224 0.0
RAM 599312 599312 0 0.0
tv-casting-app debug unknown 5320 5320 0 0.0
FLASH 11092685 11092893 208 0.0
RAM 695496 695496 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 918100 918148 48 0.0
RAM 143332 143332 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890592 890632 40 0.0
RAM 141519 141519 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 852164 852212 48 0.0
RAM 142244 142244 0 0.0
nxp contact k32w0+release FLASH 585952 586000 48 0.0
RAM 71112 71112 0 0.0
mcxw71+release FLASH 600512 600552 40 0.0
RAM 63208 63208 0 0.0
light k32w0+release FLASH 612716 612748 32 0.0
RAM 70504 70504 0 0.0
k32w1+release FLASH 686920 686960 40 0.0
RAM 48840 48840 0 0.0
lock mcxw71+release FLASH 763264 763304 40 0.0
RAM 70876 70876 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1647500 1647532 32 0.0
RAM 212128 212128 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1555132 1555180 48 0.0
RAM 208944 208944 0 0.0
light cy8ckit_062s2_43012 FLASH 1470236 1470268 32 0.0
RAM 200912 200912 0 0.0
lock cy8ckit_062s2_43012 FLASH 1467956 1468004 48 0.0
RAM 225272 225272 0 0.0
qpg lighting-app qpg6105+debug FLASH 664328 664368 40 0.0
RAM 105456 105456 0 0.0
lock-app qpg6105+debug FLASH 622156 622196 40 0.0
RAM 99908 99908 0 0.0
stm32 light STM32WB5MM-DK FLASH 485080 485120 40 0.0
RAM 144912 144912 0 0.0
telink bridge-app tlsr9258a FLASH 683634 683684 50 0.0
RAM 91248 91248 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623874 623924 50 0.0
RAM 31488 31488 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772708 772758 50 0.0
RAM 49348 49348 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 777324 777374 50 0.0
RAM 99812 99812 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 711316 711366 50 0.0
RAM 73544 73544 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 628320 628370 50 0.0
RAM 142180 142180 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 814334 814384 50 0.0
RAM 99724 99724 0 0.0
tizen all-clusters-app arm unknown 5160 5160 0 0.0
FLASH 1780980 1781144 164 0.0
RAM 93684 93684 0 0.0
chip-tool-ubsan arm unknown 10844 10844 0 0.0
FLASH 17999086 17999382 296 0.0
RAM 7855832 7855920 88 0.0

Copy link
Contributor

@andy31415 andy31415 left a comment

Choose a reason for hiding this comment

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

This needs some design considerations: data model providers should own the data and I am unsure about the syntax of control of when something is dirty: why is the write itself not able to determine dirtyness of things.

This feels like a workaround/hackish at a first glance: adding more things into parameters and we should stop that practice.

Worst case (and I am not sure we should) this kind of flag should be part of the WriteAttributeRequest structure instead since that contains the write request parameters.

@andy31415
Copy link
Contributor

@wqx6 could you provide me with some code links and references about the behaviour that causes issues here? It seems like we want quiet reporting in LevelControl ... but then could we solve it at the cluster level using https://github.com/project-chip/connectedhomeip/blob/master/src/app/cluster-building-blocks/QuieterReporting.h ?

@wqx6
Copy link
Contributor Author

wqx6 commented Jan 14, 2025

@wqx6 could you provide me with some code links and references about the behaviour that causes issues here? It seems like we want quiet reporting in LevelControl ... but then could we solve it at the cluster level using https://github.com/project-chip/connectedhomeip/blob/master/src/app/cluster-building-blocks/QuieterReporting.h ?

https://github.com/project-chip/connectedhomeip/blob/master/src/app/clusters/level-control/level-control.cpp#L412 In level control or color control cluster, we are using AttributeAccessors(such asAttributes::CurrentLevel::Set()) to set the value with markDirty flag, but the AttributeAccessors calls ember functions if we want to replace it with DataModeProvider::WriteAttribute() the WriteAttribute should have a markDirty Input.

Copy link

github-actions bot commented Jan 14, 2025

PR #36988: Size comparison from 5bd63d5 to ecea71f

Full report (70 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 5bd63d5 ecea71f change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1355350 1355354 4 0.0
RAM 103952 103952 0 0.0
bl702 lighting-app bl702+eth FLASH 726034 726294 260 0.0
RAM 25353 25353 0 0.0
bl702+wifi FLASH 912904 912908 4 0.0
RAM 14093 14093 0 0.0
bl706+mfd+rpc+littlefs FLASH 1173762 1173766 4 0.0
RAM 23933 23933 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 1082790 1082794 4 0.0
RAM 16604 16604 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 840176 840216 40 0.0
RAM 123552 123552 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 825692 825724 32 0.0
RAM 125440 125440 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 772620 772660 40 0.0
RAM 113916 113916 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 756816 756856 40 0.0
RAM 114116 114116 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 540041 540081 40 0.0
RAM 205304 205304 0 0.0
lock CC3235SF_LAUNCHXL FLASH 574209 574241 32 0.0
RAM 205448 205448 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 681569 681609 40 0.0
RAM 78596 78596 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 701413 701453 40 0.0
RAM 81236 81236 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 701413 701453 40 0.0
RAM 81236 81236 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 658357 658389 32 0.0
RAM 73664 73664 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 618153 618193 40 0.0
RAM 71588 71588 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 637789 637821 32 0.0
RAM 74132 74132 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 637789 637821 32 0.0
RAM 74132 74132 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 637601 637633 32 0.0
RAM 74596 74596 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 657317 657349 32 0.0
RAM 77140 77140 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 657317 657349 32 0.0
RAM 77140 77140 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614213 614245 32 0.0
RAM 68684 68684 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634065 634097 32 0.0
RAM 71316 71316 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634065 634097 32 0.0
RAM 71316 71316 0 0.0
efr32 lock-app BRD4187C FLASH 932468 932500 32 0.0
RAM 160068 160068 0 0.0
BRD4338a FLASH 749232 749256 24 0.0
RAM 233196 233196 0 0.0
window-app BRD4187C FLASH 1026864 1026888 24 0.0
RAM 128172 128172 0 0.0
esp32 all-clusters-app c3devkit DRAM 95192 95192 0 0.0
FLASH 1541904 1541934 30 0.0
IRAM 82552 82552 0 0.0
m5stack DRAM 116172 116172 0 0.0
FLASH 1548458 1548486 28 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4752 4752 0 0.0
FLASH 2723229 2723403 174 0.0
RAM 133160 133160 0 0.0
all-clusters-app debug unknown 5560 5560 0 0.0
FLASH 5996466 5996608 142 0.0
RAM 526072 526072 0 0.0
all-clusters-minimal-app debug unknown 5456 5456 0 0.0
FLASH 5341652 5341794 142 0.0
RAM 243072 243072 0 0.0
bridge-app debug unknown 5472 5472 0 0.0
FLASH 4696806 4696948 142 0.0
RAM 221824 221824 0 0.0
chip-tool debug unknown 5984 5984 0 0.0
FLASH 12867152 12867326 174 0.0
RAM 587002 587002 0 0.0
chip-tool-ipv6only arm64 unknown 21536 21536 0 0.0
FLASH 10989440 10989600 160 0.0
RAM 638048 638048 0 0.0
fabric-admin debug unknown 5808 5808 0 0.0
FLASH 11274263 11274437 174 0.0
RAM 587346 587346 0 0.0
fabric-bridge-app debug unknown 4728 4728 0 0.0
FLASH 4521756 4521930 174 0.0
RAM 208928 208928 0 0.0
fabric-sync debug unknown 4968 4968 0 0.0
FLASH 5622981 5623157 176 0.0
RAM 477880 477880 0 0.0
lighting-app debug+rpc+ui unknown 6136 6136 0 0.0
FLASH 5631329 5631473 144 0.0
RAM 232072 232072 0 0.0
lock-app debug unknown 5408 5408 0 0.0
FLASH 4744568 4744742 174 0.0
RAM 208072 208072 0 0.0
ota-provider-app debug unknown 4768 4768 0 0.0
FLASH 4372108 4372282 174 0.0
RAM 201744 201744 0 0.0
ota-requestor-app debug unknown 4720 4720 0 0.0
FLASH 4510120 4510294 174 0.0
RAM 206312 206312 0 0.0
shell debug unknown 4248 4248 0 0.0
FLASH 3023197 3023341 144 0.0
RAM 160792 160792 0 0.0
thermostat-no-ble arm64 unknown 9552 9552 0 0.0
FLASH 4110296 4110456 160 0.0
RAM 246368 246368 0 0.0
tv-app debug unknown 5736 5736 0 0.0
FLASH 5966741 5966885 144 0.0
RAM 601312 601312 0 0.0
tv-casting-app debug unknown 5312 5312 0 0.0
FLASH 11102349 11102525 176 0.0
RAM 700496 700496 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 917804 917840 36 0.0
RAM 143172 143172 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 890868 890904 36 0.0
RAM 141359 141359 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 851932 851968 36 0.0
RAM 142084 142084 0 0.0
nxp contact k32w0+release FLASH 585968 586000 32 0.0
RAM 70952 70952 0 0.0
mcxw71+release FLASH 601488 601528 40 0.0
RAM 63168 63168 0 0.0
light k32w0+release FLASH 612588 612636 48 0.0
RAM 70344 70344 0 0.0
k32w1+release FLASH 687152 687192 40 0.0
RAM 48760 48760 0 0.0
lock mcxw71+release FLASH 763464 763496 32 0.0
RAM 70796 70796 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1652124 1652140 16 0.0
RAM 211632 211632 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1557884 1557932 48 0.0
RAM 208448 208448 0 0.0
light cy8ckit_062s2_43012 FLASH 1472492 1472524 32 0.0
RAM 200416 200416 0 0.0
lock cy8ckit_062s2_43012 FLASH 1470276 1470308 32 0.0
RAM 224768 224768 0 0.0
qpg lighting-app qpg6105+debug FLASH 664144 664184 40 0.0
RAM 105296 105296 0 0.0
lock-app qpg6105+debug FLASH 622004 622036 32 0.0
RAM 99748 99748 0 0.0
stm32 light STM32WB5MM-DK FLASH 484976 485008 32 0.0
RAM 144752 144752 0 0.0
telink bridge-app tlsr9258a FLASH 683552 683582 30 0.0
RAM 91088 91088 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 623810 623840 30 0.0
RAM 31488 31488 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 772652 772682 30 0.0
RAM 49348 49348 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 777256 777286 30 0.0
RAM 99652 99652 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 711250 711280 30 0.0
RAM 73384 73384 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 628264 628294 30 0.0
RAM 142020 142020 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 814266 814296 30 0.0
RAM 99564 99564 0 0.0
tizen all-clusters-app arm unknown 5120 5120 0 0.0
FLASH 1767272 1767368 96 0.0
RAM 93708 93708 0 0.0
chip-tool-ubsan arm unknown 10904 10904 0 0.0
FLASH 17949774 17950566 792 0.0
RAM 7842672 7843116 444 0.0

@bzbarsky-apple
Copy link
Contributor

Why would you be replacing that with a WriteAttribute? Wouldn't you just update the cluster state as needed?

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