-
Notifications
You must be signed in to change notification settings - Fork 61
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
[nrf noup] Lock thread stack before factory reset #380
[nrf noup] Lock thread stack before factory reset #380
Conversation
1bd8078
to
4406491
Compare
@@ -176,6 +176,7 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) | |||
void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) | |||
{ | |||
ChipLogProgress(DeviceLayer, "Performing factory reset"); | |||
ThreadStackManager().LockThreadStack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably won't compile (?)
ThreadStackManager().LockThreadStack(); | |
ThreadStackMgr().LockThreadStack(); |
Also, do not assume it's Matter over Thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Damian-Nordic Is there any Matter api which allow to disable thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand, I meant that you should compile this line only if CONFIG_NET_L2_OPENTHREAD
is defined as it may not compile for Wi-Fi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw. you could add a comment explaining why this is needed as Lock
without Unlock
can look weird to newcomers :).
4406491
to
24d13ec
Compare
@@ -176,6 +176,7 @@ void ConfigurationManagerImpl::RunConfigUnitTest(void) | |||
void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) | |||
{ | |||
ChipLogProgress(DeviceLayer, "Performing factory reset"); | |||
ThreadStackMgr().LockThreadStack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be guarded with #ifdef CONFIG_NET_L2_OPENTHREAD
ThreadStackMgr().LockThreadStack(); | |
#ifdef CONFIG_NET_L2_OPENTHREAD | |
ThreadStackMgr().LockThreadStack(); | |
#endif |
Also, as Damian suggested, please describe what is the purpose of this call here and why it can be used here without unlocking the stack.
24d13ec
to
99cfd7a
Compare
81f580e
to
7570c0d
Compare
7570c0d
to
fd65228
Compare
This commit fix a problem with thread activity interrupting factory reset. This activity used to led to “Factory reset fail: -6”. Writing to cleared nvm flash pages caused the problem. Signed-off-by: Patryk Lipinski <[email protected]> Signed-off-by: Michał Szablowski <[email protected]>
fd65228
to
4d80d20
Compare
This commit fix a problem with thread activity interrupting factory reset. This activity used to led to “Factory reset fail: -6”. Writing to cleared nvm flash pages caused the problem.