mirror of https://github.com/RPCS3/rpcs3.git
rsx/zcull: Improve deadlock avoidance
- Do not acquire eng lock while holding the page lock RSXThread may be waiting on the page lock and will never ack the pause request
This commit is contained in:
parent
a3ea9e2985
commit
e1b95913ea
|
@ -882,7 +882,14 @@ namespace rsx
|
||||||
eng_lock(rsx::thread* target)
|
eng_lock(rsx::thread* target)
|
||||||
:pthr(target)
|
:pthr(target)
|
||||||
{
|
{
|
||||||
if (pthr) pthr->pause();
|
if (pthr->is_current_thread())
|
||||||
|
{
|
||||||
|
pthr = nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pthr->pause();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~eng_lock()
|
~eng_lock()
|
||||||
|
|
|
@ -838,10 +838,7 @@ namespace rsx
|
||||||
|
|
||||||
// Flush all pending writes
|
// Flush all pending writes
|
||||||
m_critical_reports_in_flight += 0x100000;
|
m_critical_reports_in_flight += 0x100000;
|
||||||
{
|
ptimer->sync();
|
||||||
rsx::eng_lock rlock(ptimer->is_current_thread() ? nullptr : ptimer);
|
|
||||||
ptimer->sync();
|
|
||||||
}
|
|
||||||
m_critical_reports_in_flight -= 0x100000;
|
m_critical_reports_in_flight -= 0x100000;
|
||||||
|
|
||||||
// Unlock pages
|
// Unlock pages
|
||||||
|
@ -877,6 +874,7 @@ namespace rsx
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool need_disable_optimizations = false;
|
||||||
{
|
{
|
||||||
reader_lock lock(m_pages_mutex);
|
reader_lock lock(m_pages_mutex);
|
||||||
|
|
||||||
|
@ -891,20 +889,31 @@ namespace rsx
|
||||||
if (fault_page.has_refs())
|
if (fault_page.has_refs())
|
||||||
{
|
{
|
||||||
// R/W to active block
|
// R/W to active block
|
||||||
disable_optimizations(rsx::get_current_renderer(), location);
|
need_disable_optimizations = true; // Defer actual operation
|
||||||
|
m_pages_accessed[location] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// R/W to stale block, unload it and move on
|
// R/W to stale block, unload it and move on
|
||||||
utils::memory_protect(vm::base(page_address), 4096, utils::protection::rw);
|
utils::memory_protect(vm::base(page_address), 4096, utils::protection::rw);
|
||||||
m_locked_pages[location].erase(page_address);
|
m_locked_pages[location].erase(page_address);
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deadlock avoidance, do not pause RSX FIFO eng while holding the pages lock
|
||||||
|
if (need_disable_optimizations)
|
||||||
|
{
|
||||||
|
auto thr = rsx::get_current_renderer();
|
||||||
|
rsx::eng_lock rlock(thr);
|
||||||
|
std::scoped_lock lock(m_pages_mutex);
|
||||||
|
disable_optimizations(thr, location);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue