From 13de7734869fb9d277ebcc2dfb6825ea68e264b1 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Mon, 26 Oct 2020 04:25:34 +0300 Subject: [PATCH] Remove some vm::reservation_lock instances --- rpcs3/Emu/Cell/Modules/cellSpurs.cpp | 14 +++++++------- rpcs3/Emu/RSX/rsx_methods.cpp | 25 ++----------------------- 2 files changed, 9 insertions(+), 30 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp index 57c425e2ff..ed4a37897f 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp @@ -2401,19 +2401,19 @@ s32 _spurs::add_workload(vm::ptr spurs, vm::ptr wid, vm::cptrwklIdleSpuCountOrReadyCount2[wnum] = 0; } + vm::reservation_light_op(spurs->wklMaxContention[index], [&](atomic_t& 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((wnum <= 15 ? spurs->wklSignal1 : spurs->wklSignal2), [&](atomic_be_t& data) + { + data &= ~(0x8000 >> index); + }); spurs->wklFlagReceiver.compare_and_swap(wnum, 0xff); diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 2d9812e94f..d63f23991b 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -146,34 +146,13 @@ namespace rsx const u32 addr = get_address(offset, ctxt, HERE); - atomic_t* 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(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) {