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

Skip to content

Conversation

@GabrielPavaloiu
Copy link
Contributor

Pull Request Overview

This pull request adds a method to GrantKernelData that removes all pending upcalls of the current driver with the given subscriber_num from the process's upcall queue.

This was needed in order to remove outdated upcalls from within a capsule.

Testing Strategy

This pull request was tested by implementing a capsule that uses this feature.

Documentation Updated

  • No updates are required.

Formatting

  • Ran make prepush.

bradjc
bradjc previously approved these changes Dec 11, 2024
@lschuermann
Copy link
Member

I like this addition, it makes sense for a driver to be able to "update" a scheduled, but not yet delivered upcall. One change that would make it even more useful is to return the number of upcalls removed, or better yet, an iterator over them. A driver can then use this to reason about whether an upcall was delivered, and consequently whether scheduling another, updated one is necessary or not.

Added a method to GrantKernelData that removes all pending upcalls of
the current driver with the given subscriber_num from the process's
upcall queue.
Changed remove_pending_upcalls to return the number of tasks removed.
Added an API to call remove_upcall from GrantKernelData.
@GabrielPavaloiu
Copy link
Contributor Author

GabrielPavaloiu commented Dec 12, 2024

I modified the function so that it returns the number of upcalls removed.
I also added a function to call Process::remove_upcall. In order to get all tasks removed, one could call this function repeatedly instead of calling the remove_pending_upcalls one. To update a task, one could try to remove the task and then schedule an updated upcall.

@alevy
Copy link
Member

alevy commented Dec 12, 2024

Since there are no current uses of these methods upstream (at least in this PR), can you an example use case to help reason about the API?

Copy link
Member

@alevy alevy left a comment

Choose a reason for hiding this comment

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

Generally looks good to me!

@GabrielPavaloiu
Copy link
Contributor Author

Since there are no current uses of these methods upstream (at least in this PR), can you an example use case to help reason about the API?

Sorry for the delay.

If an app does not call yield often enough, multiple outdated upcalls could pile up.
For example, a capsule could poll all apps to decide if the chip is allowed to enter sleep mode. If an app rarely yields and another one denies each sleep request, the first app would need to respond to multiple old requests, with the risk of filling up the upcall queue.

With this API, the capsule could delete all old requests when issuing a new one.

@alevy alevy added this pull request to the merge queue Dec 17, 2024
Merged via the queue into tock:master with commit 7c88a62 Dec 17, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants