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

Fix logging filesystem failing to initialize with high number of logs #1294

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

gtaharaedmonds
Copy link
Contributor

@gtaharaedmonds gtaharaedmonds commented Jun 3, 2024

Changelist

On master, if there are a significant number of CAN logs present on the SD card (somewhere in the range 50-100) the watchdog trips at startup. This means the VC never gets past init.

Root cause: Currently, mounting the filesystem and starting logging takes about 250ms for every 100 logs on the SD card, and scales linearly. There is no significant correlation with the size of each log file. Since the watchdog trips if not checked in every 200ms, it just simply takes too long. Note that we start a new log after every boot.

Solution: I think anything less than a second of extra delay at bootup is not a big deal, so I don't think this motivates any big changes to our logging. There is no way to stop the STM32 watchdog peripheral once its started, so instead I added a tasks_preInitWatchdog function which runs after all peripherals are initialized, but before the watchdog is. So, we initialize logging in here and then can proceed like normal.

Also, I added some CAN signals so there will be visibility on when we've logged a significant amount of data.

Testing Done

Tested on VC #2. Able to init logging in ~500ms total with 200 logs without the watchdog tripping, and the VC behaves like normal after that. Tested with large files as well (>>100MB) without any slowdown. Performance is approximately O(N) at all values tested.

Also, interestingly it seems that different SD cards are faster than others. The KOOTION 64GB Micro SDXC card is approximately 2x as fast as the Lexar 300x 32GB SDHC card.

Copy link
Contributor

@philam2001 philam2001 left a comment

Choose a reason for hiding this comment

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

Screen Shot 2024-06-03 at 8 42 03 PM

@gtaharaedmonds gtaharaedmonds merged commit c2c247c into master Jun 4, 2024
27 checks passed
@gtaharaedmonds gtaharaedmonds deleted the gus/fix_logging_init_failing_with_many_logs branch June 4, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants