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

dispatch_next: Never start dispatching before the kernel is fully initialized #116

Closed
perlun opened this issue Dec 25, 2017 · 0 comments
Closed
Labels

Comments

@perlun
Copy link
Contributor

perlun commented Dec 25, 2017

This can sometimes happen, if we have stupid code that does things like this:

mutex_kernel_wait(&tss_tree_mutex); // lock the mutex
mutex_kernel_wait(&tss_tree_mutex); // attempt to lock it again

This will never work, because our mutexing code presumes multi-tasking to be enabled (which is a bit silly, but it's the way it is) and will try to dispatch the next available task if the mutex happens to be locked... This all makes sense if multi-tasking is indeed enabled, since you don't want to wait in the current timeslice more than necessary; it's better to give another process a (smaller) slice to let it run, hopefully reducing overall lock contention.

So, if mutex_kernel_wait is being called like this, dispatch_next should do a DEBUG_HALT, clearly indicating that this likely to be the problem. This will simplify our lives while debugging the code.

@perlun perlun added the bug label Dec 25, 2017
perlun added a commit that referenced this issue Dec 25, 2017
Also added much more error handling and similar.

Fixes #102, fixes #79. 🎉
Fixes #116.
perlun added a commit that referenced this issue Dec 25, 2017
Also added much more error handling and similar.

Fixes #102, fixes #79. 🎉
Fixes #116.
@perlun perlun closed this as completed in 1ada4b8 Dec 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant