2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #12557 from merryhime/termination-ipi

KThread: Send termination interrupt to all cores a thread has affinity to
This commit is contained in:
liamwhite 2024-01-04 15:50:40 -05:00 committed by GitHub
commit 246cffb624
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1258,11 +1258,11 @@ ThreadState KThread::RequestTerminate() {
// Change the thread's priority to be higher than any system thread's.
this->IncreaseBasePriority(TerminatingThreadPriority);
// If the thread is runnable, send a termination interrupt to other cores.
// If the thread is runnable, send a termination interrupt to cores it may be running on.
if (this->GetState() == ThreadState::Runnable) {
if (const u64 core_mask = m_physical_affinity_mask.GetAffinityMask() &
~(1ULL << GetCurrentCoreId(m_kernel));
core_mask != 0) {
// NOTE: We do not mask the "current core", because this code may not actually be
// executing from the thread representing the "current core".
if (const u64 core_mask = m_physical_affinity_mask.GetAffinityMask(); core_mask != 0) {
Kernel::KInterruptManager::SendInterProcessorInterrupt(m_kernel, core_mask);
}
}