sys_spu: Add one more limiting SPU threads creation condition

This commit is contained in:
Eladash 2021-08-04 19:09:15 +03:00 committed by Ivan
parent 9d71369b2c
commit 9f67e00e40
1 changed files with 9 additions and 1 deletions

View File

@ -238,7 +238,7 @@ struct spu_limits_t
raw_spu_count += spu_thread::g_raw_spu_ctr;
if (spu_limit + raw_limit > 6 || raw_spu_count > raw_limit || physical_spus_count + controllable_spu_count > spu_limit)
if (spu_limit + raw_limit > 6 || raw_spu_count > raw_limit || physical_spus_count >= spu_limit || physical_spus_count + controllable_spu_count > spu_limit)
{
return false;
}
@ -714,6 +714,10 @@ error_code sys_spu_thread_group_destroy(ppu_thread& ppu, u32 id)
sys_spu.warning("sys_spu_thread_group_destroy(id=0x%x)", id);
auto& limits = g_fxo->get<spu_limits_t>();
std::lock_guard lock(limits.mutex);
const auto group = idm::withdraw<lv2_spu_group>(id, [](lv2_spu_group& group) -> CellError
{
if (!group.run_state.fetch_op([](spu_group_status& state)
@ -2052,6 +2056,10 @@ error_code raw_spu_destroy(ppu_thread& ppu, u32 id)
(*thread)();
auto& limits = g_fxo->get<spu_limits_t>();
std::lock_guard lock(limits.mutex);
if (auto ret = idm::withdraw<named_thread<spu_thread>>(idm_id, [&](spu_thread& spu) -> CellError
{
if (std::addressof(spu) != std::addressof(*thread))