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

wolfMQTT unexpectedly attempts single-use Espressif hardware lock #353

Open
gojimmypi opened this issue Sep 26, 2023 · 0 comments
Open

wolfMQTT unexpectedly attempts single-use Espressif hardware lock #353

gojimmypi opened this issue Sep 26, 2023 · 0 comments
Assignees

Comments

@gojimmypi
Copy link
Contributor

gojimmypi commented Sep 26, 2023

This issue is not serious and more a potential for HW acceleration performance improvements.

While working on #352 I noticed a curious situation in the SHA hardware accelerator where the hardware lock is not able to be obtained. The code otherwise does not know the HW is busy and should have already been in SW fallback mode. This is observed in my upcoming Espressif AWS_IoT_MQTT Example.

This undesired situation is captured and handled properly in esp_sha_try_hw_lock() - but the unexpected condition triggers many verbose messages when not debugging.

I have wolfSSL/wolfssl#6811 to wrap that line in debugger gate macro, but this issue is for investigation as to how and why the hardware lock is not able to be maintained in wolfMQTT.

In wolfSSL, I've seen similar problems where a copy of a ctx object was used. I believe I've handled that in the merge of wolfSSL/wolfssl#6624 by keeping track of the address of the object that initialized the respective object: when the initialize is not equal to the address of the current object, it must be a copy.

The other place to look is the TLS session that may start multiple, concurrent hashes and never actually finish. Still, the code should have anticipated this. It may be that the code handling the TLS connection and the code for wolfMQTT that may want to perform a HW hash, when running independently, may simply not know about each other having a HW lock or not.

The proper solution is to implement HW interleave mentioned in wolfSSL/wolfssl#6637.

See wolfSSL/wolfssl#6234 for a roadmap of all Espressif improvements currently in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant