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

Slower OpenThread PSKc calculation #24963

Closed
markus-becker-tridonic-com opened this issue May 5, 2020 · 8 comments
Closed

Slower OpenThread PSKc calculation #24963

markus-becker-tridonic-com opened this issue May 5, 2020 · 8 comments
Assignees
Labels
area: OpenThread bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Regression Something, which was working, does not anymore

Comments

@markus-becker-tridonic-com
Copy link
Contributor

After updating

and using the sample samples/net/openthread/ncp/ on a K64 board the time to generate a PSKc on the NCP/K64 with wpanctl commissioner gen-psk increased from slightly below 5s to slightly above 5s. Unfortunately the timeout value of the OpenThread tools is 5s: https://github.com/openthread/wpantund/blob/master/src/wpantund/NCPConstants.h#L23.

What might have slowed down in the updates between the SHAs mentioned above?

@markus-becker-tridonic-com markus-becker-tridonic-com added the bug The issue is a bug, or the PR is fixing a bug label May 5, 2020
@carlescufi
Copy link
Member

@rlubos is this a regression in performance in OpenThread itself? If so this is perhaps better suited for the upstream project.

@carlescufi carlescufi added the Regression Something, which was working, does not anymore label May 5, 2020
@carlescufi
Copy link
Member

@markus-becker-tridonic-com the K64F doesn't have a 15.4 radio, so are you using a shield or an external radio IC of some sort?

@carlescufi carlescufi added area: OpenThread priority: low Low impact/importance bug labels May 5, 2020
@dleach02
Copy link
Member

dleach02 commented May 5, 2020

@markus-becker-tridonic-com, can you add the following to your project config file for a test:

CONFIG_XOROSHIRO_RANDOM_GENERATOR=y

@markus-becker-tridonic-com
Copy link
Contributor Author

@markus-becker-tridonic-com the K64F doesn't have a 15.4 radio, so are you using a shield or an external radio IC of some sort?

RF2XX as external radio IC.

@markus-becker-tridonic-com
Copy link
Contributor Author

@markus-becker-tridonic-com, can you add the following to your project config file for a test:

CONFIG_XOROSHIRO_RANDOM_GENERATOR=y

CONFIG_XOROSHIRO_RANDOM_GENERATOR=n results in 5087ms.
CONFIG_XOROSHIRO_RANDOM_GENERATOR=y results in 5212ms.
With about 1ms variance between different runs.

@rlubos
Copy link
Contributor

rlubos commented May 6, 2020

@carlescufi @markus-becker-tridonic-com
I've compared the two OT revisions, but changes in there are mostly cosmetic:
https://github.com/zephyrproject-rtos/openthread/blob/46194ba9053d71966ddbf7c159c0ff68f93d6497/src/core/meshcop/commissioner.cpp#L1061
https://github.com/zephyrproject-rtos/openthread/blob/46194ba9053d71966ddbf7c159c0ff68f93d6497/src/core/crypto/pbkdf2_cmac.cpp#L44
There's also mbedTLS involved, and I guess we spend most of the time there during PSKc generation, but we use the same revision in both cases.

I don't know what else could've changed in regards to that board/radio. I'd verify the execution time of the GeneratePskc() function, to see if there's really a regression in PSKc generation time, or is it some other issue (like CPU being busy processing higher priority thread before switching to OT).

@carlescufi
Copy link
Member

@markus-becker-tridonic-com have you logged an issue with upstream OpenThread? Maybe it's as simple as increasing the timeout value in wpantund?

@markus-becker-tridonic-com
Copy link
Contributor Author

turned out to be CONFIG_MBEDTLS_DEBUG=y was the culprit and adding approximately 500ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: OpenThread bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug Regression Something, which was working, does not anymore
Projects
None yet
Development

No branches or pull requests

4 participants