Citra Git (2017/01/06)
Changelog:
* Merge pull request #2408 from Subv/priority_boosting
Kernel: Removed the priority boost code for starved threads.
* Kernel: Removed the priority boost code for starved threads.
After hwtesting and reverse engineering the kernel, it was found that the CTROS scheduler performs no priority boosting for threads like this, although some other forms of scheduling priority-starved threads might take place.
For example, it was found that hardware interrupts might cause low-priority threads to run if the CPU is preempted in the middle of an SVC handler that deschedules the current (high priority) thread before scheduling it again.
* Merge pull request #2409 from Subv/unused_funcs
Kernel: Remove some unused functions.
* Kernel: Remove some unused functions.
* Merge pull request #2393 from Subv/synch
Kernel: Mutex priority inheritance and synchronization improvements.
* Kernel: Add some asserts to enforce the invariants in the scheduler.
* Kernel: Remove a thread from all of its waiting objects' waiting_threads list when it is awoken.
This fixes a potential bug where threads would not get removed from said list if they awoke after waiting with WaitSynchronizationN with wait_all = false
* Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on.
* Kernel: Use different thread statuses when a thread calls WaitSynchronization1 and WaitSynchronizationN with wait_all = true.
This commit removes the overly general THREADSTATUS_WAIT_SYNCH and replaces it with two more granular statuses:
THREADSTATUS_WAIT_SYNCH_ANY when a thread waits on objects via WaitSynchronization1 or WaitSynchronizationN with wait_all = false.
THREADSTATUS_WAIT_SYNCH_ALL when a thread waits on objects via WaitSynchronizationN with wait_all = true.
* Kernel/Mutex: Propagate thread priority changes to other threads inheriting the priority via mutexes
* Kernel/Mutex: Update a mutex priority when a thread stops waiting on it.
* Kernel/Mutex: Implemented priority inheritance.
The implementation is based on reverse engineering of the 3DS's kernel.
A mutex holder's priority will be temporarily boosted to the best priority among any threads that want to acquire any of its held mutexes.
When the holder releases the mutex, it's priority will be boosted to the best priority among the threads that want to acquire any of its remaining held mutexes.
* Kernel: Object ShouldWait and Acquire calls now take a thread as a parameter.
This will be useful when implementing mutex priority inheritance.
* Kernel/Synch: Do not attempt a reschedule on every syscall.
Not all syscalls should cause reschedules, this commit attempts to remedy that, however, it still does not cover all cases.
http://www.emucr.com/2017/01/citra-git-20170106.html