mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 08:21:29 +12:00
SPURS: Add locks in the system service workload
This commit is contained in:
parent
2d94db4945
commit
b01c17d1a0
1 changed files with 10 additions and 0 deletions
|
@ -585,6 +585,8 @@ void spursSysServiceUpdateWorkload(SPUThread & spu, SpursKernelMgmtData * mgmt)
|
||||||
|
|
||||||
/// Process any messages
|
/// Process any messages
|
||||||
void spursSysServiceProcessMessages(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
void spursSysServiceProcessMessages(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
||||||
|
LV2_LOCK(0);
|
||||||
|
|
||||||
// Process update workload message
|
// Process update workload message
|
||||||
if (mgmt->spurs->m.sysSrvMsgUpdateWorkload.read_relaxed() & (1 << mgmt->spuNum)) {
|
if (mgmt->spurs->m.sysSrvMsgUpdateWorkload.read_relaxed() & (1 << mgmt->spuNum)) {
|
||||||
mgmt->spurs->m.sysSrvMsgUpdateWorkload &= ~(1 << mgmt->spuNum);
|
mgmt->spurs->m.sysSrvMsgUpdateWorkload &= ~(1 << mgmt->spuNum);
|
||||||
|
@ -606,6 +608,8 @@ void spursSysServiceProcessMessages(SPUThread & spu, SpursKernelMgmtData * mgmt)
|
||||||
/// Wait for an external event or exit the SPURS thread group if no workloads can be scheduled
|
/// Wait for an external event or exit the SPURS thread group if no workloads can be scheduled
|
||||||
void spursSysServiceWaitOrExit(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
void spursSysServiceWaitOrExit(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
Emu.GetCoreMutex().lock();
|
||||||
|
|
||||||
// Find the number of SPUs that are idling in this SPURS instance
|
// Find the number of SPUs that are idling in this SPURS instance
|
||||||
u32 nIdlingSpus = 0;
|
u32 nIdlingSpus = 0;
|
||||||
for (u32 i = 0; i < 8; i++) {
|
for (u32 i = 0; i < 8; i++) {
|
||||||
|
@ -665,7 +669,10 @@ void spursSysServiceWaitOrExit(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
||||||
// not yet completely implemented in rpcs3. So we busy wait here.
|
// not yet completely implemented in rpcs3. So we busy wait here.
|
||||||
//u128 r;
|
//u128 r;
|
||||||
//spu.ReadChannel(r, 0);
|
//spu.ReadChannel(r, 0);
|
||||||
|
|
||||||
|
Emu.GetCoreMutex().unlock();
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
|
Emu.GetCoreMutex().lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((allSpusIdle == true && exitIfNoWork == true) || foundReadyWorkload == false) {
|
if ((allSpusIdle == true && exitIfNoWork == true) || foundReadyWorkload == false) {
|
||||||
|
@ -674,6 +681,8 @@ void spursSysServiceWaitOrExit(SPUThread & spu, SpursKernelMgmtData * mgmt) {
|
||||||
mgmt->spurs->m.spuIdling &= ~(1 << mgmt->spuNum);
|
mgmt->spurs->m.spuIdling &= ~(1 << mgmt->spuNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Emu.GetCoreMutex().unlock();
|
||||||
|
|
||||||
if (allSpusIdle == false || exitIfNoWork == false) {
|
if (allSpusIdle == false || exitIfNoWork == false) {
|
||||||
if (foundReadyWorkload == true) {
|
if (foundReadyWorkload == true) {
|
||||||
return;
|
return;
|
||||||
|
@ -696,6 +705,7 @@ void spursSysServiceWorkloadMain(SPUThread & spu, u32 pollStatus) {
|
||||||
if (mgmt->sysSrvInitialised == 0) {
|
if (mgmt->sysSrvInitialised == 0) {
|
||||||
mgmt->sysSrvInitialised = 1;
|
mgmt->sysSrvInitialised = 1;
|
||||||
|
|
||||||
|
LV2_LOCK(0);
|
||||||
if (mgmt->spurs->m.sysSrvOnSpu & (1 << mgmt->spuNum)) {
|
if (mgmt->spurs->m.sysSrvOnSpu & (1 << mgmt->spuNum)) {
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue