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

[spinel] add support for logging crash dumps #10061

Merged
merged 4 commits into from Apr 29, 2024

Conversation

lmnotran
Copy link
Contributor

@lmnotran lmnotran commented Apr 24, 2024

Supersedes #9829
Closes #10048

This PR adds a new feature that allows platforms to log crash logs.

Additions

  • void otPlatLogCrashDump(void) - API that logs a crash dump using OpenThread Logging APIs
  • SPINEL_PROP_RCP_LOG_CRASH_DUMP - spinel prop that calls otPlatLogCrashDump() when Set
  • SPINEL_CAP_RCP_LOG_CRASH_DUMP - spinel capability denoting that a RCP supports logging crash dumps

Usage

  • For ot-cli-ftd|mtd, otPlatLogCrashDump() is called at the end of app initialization, before the main loop. See [main.c]
  • For Host/RCP setups, during initialization, the Host gets the RCP capabilities. If the RCP has the SPINEL_CAP_RCP_LOG_CRASH_DUMP capability, the Host will Set the SPINEL_PROP_RCP_LOG_CRASH_DUMP property, triggering the RCP to call otPlatLogCrashDump().
    • If RCP Recovery is enabled, the this will also happen once the RCP has been restored

Example logs

ot-cli-syslog_ot-rcp-fault-triggered-by-diag-command.md
ot-cli-syslog_ot-rcp-autofaulting-every-2-seconds.md

@lmnotran lmnotran force-pushed the feature/add-crash-dump-over-spinel branch from d39169f to 0924abe Compare April 24, 2024 21:03
Copy link

size-report bot commented Apr 24, 2024

Size Report of OpenThread

Merging #10061 into main(93f3113).

name branch text data bss total
ot-cli-ftd main 467096 856 66364 534316
#10061 467096 856 66364 534316
+/- 0 0 0 0
ot-ncp-ftd main 436012 760 61576 498348
#10061 436012 760 61576 498348
+/- 0 0 0 0
libopenthread-ftd.a main 236154 95 40310 276559
#10061 236154 95 40310 276559
+/- 0 0 0 0
libopenthread-cli-ftd.a main 57545 0 8075 65620
#10061 57545 0 8075 65620
+/- 0 0 0 0
libopenthread-ncp-ftd.a main 31863 0 5916 37779
#10061 31863 0 5916 37779
+/- 0 0 0 0
ot-cli-mtd main 364712 760 51220 416692
#10061 364712 760 51220 416692
+/- 0 0 0 0
ot-ncp-mtd main 347244 760 46448 394452
#10061 347244 760 46448 394452
+/- 0 0 0 0
libopenthread-mtd.a main 158171 0 25182 183353
#10061 158171 0 25182 183353
+/- 0 0 0 0
libopenthread-cli-mtd.a main 39787 0 8059 47846
#10061 39787 0 8059 47846
+/- 0 0 0 0
libopenthread-ncp-mtd.a main 24743 0 5916 30659
#10061 24743 0 5916 30659
+/- 0 0 0 0
ot-cli-ftd-br main 550216 864 131212 682292
#10061 550216 864 131212 682292
+/- 0 0 0 0
libopenthread-ftd-br.a main 324464 100 105134 429698
#10061 324464 100 105134 429698
+/- 0 0 0 0
libopenthread-cli-ftd-br.a main 71208 0 8099 79307
#10061 71208 0 8099 79307
+/- 0 0 0 0
ot-rcp main 62248 564 20604 83416
#10061 62248 564 20604 83416
+/- 0 0 0 0
libopenthread-rcp.a main 9542 0 5052 14594
#10061 9542 0 5052 14594
+/- 0 0 0 0
libopenthread-radio.a main 18870 0 214 19084
#10061 18870 0 214 19084
+/- 0 0 0 0

@lmnotran lmnotran force-pushed the feature/add-crash-dump-over-spinel branch from 0924abe to c58511f Compare April 25, 2024 02:01
@lmnotran lmnotran marked this pull request as ready for review April 25, 2024 06:53
@lmnotran
Copy link
Contributor Author

@zhanglongxia @abtink Could you please review this when you get a chance? Thanks!

Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

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

Thanks @lmnotran. Some suggestions below. Thank you.

include/openthread/platform/misc.h Show resolved Hide resolved
etc/cmake/options.cmake Show resolved Hide resolved
src/lib/spinel/spinel.h Outdated Show resolved Hide resolved
src/lib/spinel/spinel.h Outdated Show resolved Hide resolved
src/ncp/ncp_base_dispatcher.cpp Show resolved Hide resolved
src/ncp/ncp_base_dispatcher.cpp Outdated Show resolved Hide resolved
src/ncp/ncp_base_radio.cpp Outdated Show resolved Hide resolved
tests/unit/test_platform.cpp Show resolved Hide resolved
@lmnotran lmnotran force-pushed the feature/add-crash-dump-over-spinel branch 3 times, most recently from 40d6610 to 7ddfc12 Compare April 25, 2024 21:12
This API will trigger a platform to log a crash dump if one available.
@lmnotran lmnotran force-pushed the feature/add-crash-dump-over-spinel branch 2 times, most recently from 7d33e83 to eb39342 Compare April 25, 2024 21:18
@lmnotran lmnotran requested a review from abtink April 26, 2024 13:27
Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks. 👍

One small suggestion below.

src/lib/spinel/radio_spinel.cpp Outdated Show resolved Hide resolved
@lmnotran lmnotran force-pushed the feature/add-crash-dump-over-spinel branch from eb39342 to 788a4a1 Compare April 26, 2024 15:19
@lmnotran
Copy link
Contributor Author

Looks great. Thanks. 👍

One small suggestion below.

Thanks for reviewing, @abtink !

Copy link
Contributor

@zhanglongxia zhanglongxia left a comment

Choose a reason for hiding this comment

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

LGTM

@lmnotran
Copy link
Contributor Author

@jwhui Could you review this soon please? This is blocking a release issue for us. Thanks!

@jwhui jwhui changed the title [api][spinel] add support for logging crash dumps [spinel] add support for logging crash dumps Apr 29, 2024
@jwhui jwhui merged commit 502797c into openthread:main Apr 29, 2024
102 checks passed
@lmnotran lmnotran deleted the feature/add-crash-dump-over-spinel branch April 29, 2024 16:12
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.

Request for a new hook that occurs after Host gets RCP capabilities
4 participants