Remove some vm::reservation_lock instances

This commit is contained in:
Nekotekina 2020-10-26 04:25:34 +03:00
parent 4966f6de73
commit 13de773486
2 changed files with 9 additions and 30 deletions

View file

@ -2401,19 +2401,19 @@ s32 _spurs::add_workload(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid, vm::cptr<vo
spurs->wklIdleSpuCountOrReadyCount2[wnum] = 0;
}
vm::reservation_light_op(spurs->wklMaxContention[index], [&](atomic_t<u8>& data)
{
auto [res, rtime] = vm::reservation_lock(spurs.addr());
spurs->wklMaxContention[index].atomic_op([wnum, maxContention](u8& v)
data.atomic_op([&](u8& v)
{
v &= (wnum <= 15 ? ~0xf : ~0xf0);
v |= (maxContention > 8 ? 8 : maxContention) << 4;
});
(wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2).fetch_and(~(0x8000 >> index));
});
res.release(rtime + 128);
res.notify_all();
}
vm::reservation_light_op<true>((wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2), [&](atomic_be_t<u16>& data)
{
data &= ~(0x8000 >> index);
});
spurs->wklFlagReceiver.compare_and_swap(wnum, 0xff);

View file

@ -146,34 +146,13 @@ namespace rsx
const u32 addr = get_address(offset, ctxt, HERE);
atomic_t<u64>* res{};
bool upd = false;
// TODO: Check if possible to write on reservations
if (rsx->label_addr >> 28 != addr >> 28)
{
if (g_use_rtm)
{
upd = true;
}
else
{
res = &vm::reservation_lock(addr).first;
}
rsx_log.fatal("NV406E semaphore unexpected address. Please report to the developers. (offset=0x%x, addr=0x%x)", offset, addr);
}
vm::_ref<RsxSemaphore>(addr).val = arg;
if (res)
{
res->fetch_add(64);
res->notify_all();
}
else if (upd)
{
// TODO: simply writing semaphore from RSX thread is wrong on TSX path
vm::reservation_update(addr);
}
}
}
@ -1535,7 +1514,7 @@ namespace rsx
const auto write_length = out_pitch * (line_count - 1) + line_length;
rsx->invalidate_fragment_program(dst_dma, dst_offset, write_length);
if (const auto result = rsx->read_barrier(read_address, read_length, !is_block_transfer);
result == rsx::result_zcull_intr)
{