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

Deadlock in QueueClockEvent #47

Closed
DeanoBurrito opened this issue Jan 4, 2023 · 1 comment
Closed

Deadlock in QueueClockEvent #47

DeanoBurrito opened this issue Jan 4, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@DeanoBurrito
Copy link
Owner

QueueClockEvent can be called inside of an interrupt handler (in response to a timer interrupt firing), and if the event is periodic it will be re-queued. If the interrupted code was inside of one of the heap locks we may deadlock. This deadlock is pretty hard to come back, as it would use the smallest slab, which is mostly unused by the rest of the kernel, but still possible.

The line is question is: https://github.com/DeanoBurrito/northport/blob/master/kernel/tasking/Clock.cpp#L91

One possible solution would be to not free the memory when dequeuing the event initially (which is another possible deadlock), and then reuse this memory when re-adding later. This seems fine but is not scalable if we have the issue again in the future, maybe we add some sort of magazine allocator which caches extra entries?

@DeanoBurrito DeanoBurrito added the bug Something isn't working label Jan 4, 2023
@DeanoBurrito
Copy link
Owner Author

Fixed in cf8d1cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant