Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ppannuto
Copy link
Member

Pull Request Overview

This is one of the capsules blocking #2462.

In contrast to the other PRs in the #2462 series, there's not really so much
meaning to "owning" an Async GPIO peripheral, so this PR effectively
just virtualizes the peripheral rather than enforcing single-process semantics.

Current GPIO HIL semantics notify all processes of interrupts to any
pin with interrupts configured (and it's left to higher layers to filter
activity based on which pin generated their interrupt). For Async GPIO,
this is awkward to virtualize (or not), as there is no owning process of
a pin for activity interrupts, but there is for configuration result
interrupts.

Note, however, that the underlying hardware likely can't handle multiple
concurrent configurations from multiple apps.
For now then, this capsule tracks a configuration while it is in flight
and notifies the correct process that their configuration has succeeded.
It does not track pin "owners", and notifies all apps of events on pins
(which is the same behavior as the regular gpio capsule).
In the rare case where two apps attempt concurrent configuration
requests, the later app will receive EBUSY. A retry loop should be
sufficient for most apps to handle this case.

Testing Strategy

Compiling.

TODO or Help Wanted

Not sure I love the 'notify all apps of all GPIO events' behavior, but
I believe we made that call because assigning owners to each pin
would incur non-trivial memory overhead. Might be worth thinking
through whether the same argument holds for Aysnc GPIO, but this
PR probably isn't the best place for that discussion.

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

Current GPIO HIL semantics notify *all* processes of interrupts to any
pin with interrupts configured (and it's left to higher layers to filter
activity based on which pin generated their interrupt). For Async GPIO,
this is awkward to virtualize (or not), as there is no owning process of
a pin for activity interrupts, but there is for configuration result
interrupts. Also, the underlying hardware likely can't handle multiple
concurrent configurations from multiple apps.

For now then, this capsule tracks a configuration while it is in flight
and notifies the correct process that their configuration has succeeded.
In the rare case where two apps attempt concurrent configuration
requests, the later app will receive `EBUSY`. A retry loop should be
sufficient for most apps to handle this rare case.
Copy link
Member

@lschuermann lschuermann left a comment

Choose a reason for hiding this comment

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

This is great. I think that this is a really good compromise between a peripheral somewhat hard to virtualize, and a driver which fits the Tock ecosystem. There might be potential edge-cases where the fact that one application can influence the callbacks delivered to another app due to the interrupt configuration, but it's already much better than the previous non-virtualized solution.

I think it's fine that an application might get more callbacks than it asked for, given it can ignore the ones not requested, or just unsubscribe entirely.

Copy link
Contributor

@hudson-ayers hudson-ayers left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 27, 2021

@bors bors bot merged commit b91f490 into master Apr 27, 2021
@bors bors bot deleted the gpio-async-grant branch April 27, 2021 20:46
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.

4 participants