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

prevent I2C from hanging on lost interrupt #1657

Merged
merged 7 commits into from
Mar 15, 2024
Merged

Conversation

bcantrill
Copy link
Collaborator

@bcantrill bcantrill commented Mar 14, 2024

Draft commit message:

This addresses #1631 by adding a (long) timeout whenever we wait for
an interrupt from the I2C controller.  This timeout shouldn't ever
fire:  if it does, something seriously is amiss, so we record more or
less everything we can out of the I2C controller and explicitly panic.

@bcantrill bcantrill marked this pull request as ready for review March 14, 2024 16:41
task/spd/src/main.rs Outdated Show resolved Hide resolved
drv/stm32xx-i2c/src/lib.rs Show resolved Hide resolved
drv/stm32xx-i2c/src/lib.rs Show resolved Hide resolved
drv/stm32xx-i2c/src/lib.rs Show resolved Hide resolved
drv/stm32xx-i2c/src/lib.rs Show resolved Hide resolved
hawkw added a commit that referenced this pull request Mar 14, 2024
The `ringbuf` crate has a `"disabled` feature flag, which disables ring
buffers, intended for use on memory-constrained targets. Currently,
setting the `"disabled"` feature flag still enables counters for ring
buffers declared using the `counted_ringbuf!` macro, because counters
generally require less RAM than full ringbufs. However, on some targets,
even counters are too large, especially when a ringbuf's entry type has
too many variants (e.g. see [this comment][1] from @bcantrill --- the
`i2c_driver` ringbuf must disable counters in order to fit in Donglet's
RAM).

Therefore, this commit adds an additional `"counters-disabled"` feature
flag to the `ringbuf` crate, to allow disabling counters as well as ring
buffers.

[1]: #1657 (comment)
hawkw added a commit that referenced this pull request Mar 14, 2024
The `ringbuf` crate has a `"disabled` feature flag, which disables ring
buffers, intended for use on memory-constrained targets. Currently,
setting the `"disabled"` feature flag still enables counters for ring
buffers declared using the `counted_ringbuf!` macro, because counters
generally require less RAM than full ringbufs. However, on some targets,
even counters are too large, especially when a ringbuf's entry type has
too many variants (e.g. see [this comment][1] from @bcantrill --- the
`i2c_driver` ringbuf must disable counters in order to fit in Donglet's
RAM).

Therefore, this commit adds an additional `"counters-disabled"` feature
flag to the `ringbuf` crate, to allow disabling counters as well as ring
buffers.

[1]: #1657 (comment)
@bcantrill bcantrill merged commit 97a635f into master Mar 15, 2024
83 checks passed
hawkw added a commit that referenced this pull request Mar 19, 2024
Using the `irq_status` system call I added in #1661, we can extend the
panic function added to `stm32xx-i2c` in #1657 to also include the state
of any IRQs currently mapped to its notification mask. This way, if an
I2C driver panics, we can also include the kernel's understanding of its
IRQ state in the dump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants