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 bottom-half processing by transitioning to workqueue #292

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

nicehorse06
Copy link
Contributor

@nicehorse06 nicehorse06 commented Feb 16, 2025

This PR addresses issue #191 by moving the blocking msleep() call from a tasklet (atomic context) to a workqueue (process context).

This change prevents kernel crashes due to sleeping in atomic context, while still preserving the immediate LED control logic in the ISR.

Summary by Bito

This pull request refactors the kernel's bottom-half processing by replacing tasklets with workqueues, resolving issue #191. It prevents kernel crashes from sleeping in atomic context while ensuring immediate LED control in the ISR. Function names have been updated to reflect these changes.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2 - The changes are straightforward and well-documented, making the review process relatively easy.

@jserv jserv requested a review from linD026 February 17, 2025 06:38
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

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

  1. Read https://cbea.ms/git-commit/ carefully and enforce the rules.
  2. Append Close #191 at the end of git commit messages.

@jserv jserv changed the title fix: Move bottom half processing from tasklet to workqueue Fix bottom-half processing by transitioning to workqueue Feb 17, 2025
Based on issue sysprog21#191 (@trulykyle)'s feedback, the original bottomhalf.c
example was calling msleep() inside a tasklet, which runs in atomic
context and can lead to a kernel crash. This patch moves the time-
consuming work to a workqueue, which runs in process context and allows
sleeping, while preserving the immediate LED control logic in the ISR.

Close sysprog21#191
@nicehorse06
Copy link
Contributor Author

Updated commit message to follow best practices.
Let me know if any further changes are needed. Thanks!

@jserv jserv merged commit eccaa3b into sysprog21:master Feb 17, 2025
1 check passed
@jserv
Copy link
Contributor

jserv commented Feb 17, 2025

Thank @nicehorse06 for contributing!

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.

2 participants