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

Thread scheduler rewrite #393

Merged
merged 11 commits into from Sep 18, 2018
Merged

Thread scheduler rewrite #393

merged 11 commits into from Sep 18, 2018

Conversation

@gdkchan
Copy link
Member

@gdkchan gdkchan commented Aug 29, 2018

The goal is more accurately emulating the thread scheduler used on horizon. This is still incomplete, a few svcs are missing, and some are not fully implemented, so this is WIP.

Big thanks to TuxSH for helping me with it.

If anyone is interested in testing, I mostly want to make sure there are no regressions with this PR (games that worked before not working anymore, or something of the sort).

@gdkchan
Copy link
Member Author

@gdkchan gdkchan commented Aug 31, 2018

I added another scheduling mode that should only allows one thread to run at a time, and switch cores on a round robin fashion. It is enabled by default, and should help spoting bugs related to multithreading.

This can have some impact on speed and on startup aswell, since translation of new functions will block execution.

@gdkchan gdkchan changed the title [WIP] Thread scheduler rewrite Thread scheduler rewrite Sep 11, 2018
@gdkchan
Copy link
Member Author

@gdkchan gdkchan commented Sep 11, 2018

This should be pretty much done, althrough a bunch of things are still not tested.
@jduncanator was working on some exclusive monitor improvements, currently its tracking exclusive access state per core, however currently only the exclusive monitor for core 0 is used. I don't think it's worth to finish that since a new exclusive monitor is already being worked on.

A new config entry called MultiCore_Scheduling_Enable was added. When enabled it should behave like before, with 4 virtual cores, and 4 guest threads running simultaneously. When disabled (now the default) only one guest thread can run at a time. However, everything else is still multithreaded as before.

Will try to do more broad testing tomorrow, it will be nice if others could test it aswell. If no regressions are found I will merge.

Thanks again to TuxSH for helping me to understand stuff and helping finding issues on the impl!

@jduncanator
Copy link
Contributor

@jduncanator jduncanator commented Sep 11, 2018

I'll do some testing on this branch, currently the exclusive monitor changes are branched from master (a while back), but given this is finalized I'll rebase my changes and work on the exclusive access updates on top of this. There are a number of things changed in this branch that I'll need to rejig in the rebase.

@gdkchan gdkchan force-pushed the sched branch from 40cc856 to e0d9416 Sep 18, 2018
gdkchan added 2 commits Sep 18, 2018
@gdkchan gdkchan merged commit b8133c1 into master Sep 18, 2018
1 check passed
1 check passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@gdkchan gdkchan deleted the sched branch Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.