mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
CPU: use unsigned (u8) priority in suspend_all
This commit is contained in:
parent
8a50880613
commit
bc61835d97
5 changed files with 13 additions and 13 deletions
|
@ -910,8 +910,8 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen
|
|||
// Extract queue and reverse element order (FILO to FIFO) (TODO: maybe leave order as is?)
|
||||
auto* head = queue.exchange(nullptr);
|
||||
|
||||
s8 min_prio = head->prio;
|
||||
s8 max_prio = head->prio;
|
||||
u8 min_prio = head->prio;
|
||||
u8 max_prio = head->prio;
|
||||
|
||||
if (auto* prev = head->next)
|
||||
{
|
||||
|
@ -925,8 +925,8 @@ bool cpu_thread::suspend_work::push(cpu_thread* _this, bool cancel_if_not_suspen
|
|||
head = std::exchange(prev, pre2);
|
||||
|
||||
// Fill priority range
|
||||
min_prio = std::min<s8>(min_prio, head->prio);
|
||||
max_prio = std::max<s8>(max_prio, head->prio);
|
||||
min_prio = std::min<u8>(min_prio, head->prio);
|
||||
max_prio = std::max<u8>(max_prio, head->prio);
|
||||
}
|
||||
while (prev);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
struct suspend_work
|
||||
{
|
||||
// Task priority
|
||||
s8 prio;
|
||||
u8 prio;
|
||||
|
||||
// Size of prefetch list workload
|
||||
u32 prf_size;
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
};
|
||||
|
||||
// Suspend all threads and execute op (may be executed by other thread than caller!)
|
||||
template <s8 Prio = 0, typename F>
|
||||
template <u8 Prio = 0, typename F>
|
||||
static auto suspend_all(cpu_thread* _this, std::initializer_list<void*> hints, F op)
|
||||
{
|
||||
if constexpr (std::is_void_v<std::invoke_result_t<F>>)
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
}
|
||||
|
||||
// Push the workload only if threads are being suspended by suspend_all()
|
||||
template <s8 Prio = 0, typename F>
|
||||
template <u8 Prio = 0, typename F>
|
||||
static bool if_suspended(cpu_thread* _this, std::initializer_list<void*> hints, F op)
|
||||
{
|
||||
static_assert(std::is_void_v<std::invoke_result_t<F>>, "Unimplemented (must return void)");
|
||||
|
|
|
@ -1703,7 +1703,7 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
|
|||
auto& all_data = *vm::get_super_ptr<spu_rdata_t>(addr & -128);
|
||||
auto& sdata = *vm::get_super_ptr<atomic_be_t<u64>>(addr & -8);
|
||||
|
||||
const bool ok = cpu_thread::suspend_all<+1>(&ppu, {all_data, all_data + 64, &res}, [&]
|
||||
const bool ok = cpu_thread::suspend_all<+3>(&ppu, {all_data, all_data + 64, &res}, [&]
|
||||
{
|
||||
if ((res & -128) == rtime && cmp_rdata(ppu.rdata, all_data))
|
||||
{
|
||||
|
|
|
@ -2013,7 +2013,7 @@ void spu_thread::do_dma_transfer(spu_thread* _this, const spu_mfc_cmd& args, u8*
|
|||
{
|
||||
if (_cpu->state & cpu_flag::pause)
|
||||
{
|
||||
cpu_thread::if_suspended(_cpu, {dst, dst + 64, &res}, [&]
|
||||
cpu_thread::if_suspended<0>(_cpu, {dst, dst + 64, &res}, [&]
|
||||
{
|
||||
std::memcpy(dst, src, size0);
|
||||
res += 128;
|
||||
|
@ -2545,7 +2545,7 @@ bool spu_thread::do_putllc(const spu_mfc_cmd& args)
|
|||
{
|
||||
auto& data = *vm::get_super_ptr<spu_rdata_t>(addr);
|
||||
|
||||
const bool ok = cpu_thread::suspend_all<+1>(this, {data, data + 64, &res}, [&]()
|
||||
const bool ok = cpu_thread::suspend_all<+3>(this, {data, data + 64, &res}, [&]()
|
||||
{
|
||||
if ((res & -128) == rtime)
|
||||
{
|
||||
|
@ -2698,7 +2698,7 @@ void do_cell_atomic_128_store(u32 addr, const void* to_write)
|
|||
auto& sdata = *vm::get_super_ptr<spu_rdata_t>(addr);
|
||||
auto& res = vm::reservation_acquire(addr, 128);
|
||||
|
||||
cpu_thread::suspend_all<0>(cpu, {&res}, [&]
|
||||
cpu_thread::suspend_all<+2>(cpu, {&res}, [&]
|
||||
{
|
||||
mov_rdata_nt(sdata, *static_cast<const spu_rdata_t*>(to_write));
|
||||
res += 127;
|
||||
|
@ -2958,7 +2958,7 @@ bool spu_thread::process_mfc_cmd()
|
|||
{
|
||||
auto& sdata = *vm::get_super_ptr<spu_rdata_t>(addr);
|
||||
|
||||
verify(HERE), cpu_thread::if_suspended<-1>(this, {}, [&]
|
||||
cpu_thread::if_suspended<0>(this, {}, [&]
|
||||
{
|
||||
// Guaranteed success
|
||||
ntime = vm::reservation_acquire(addr, 128);
|
||||
|
|
|
@ -629,7 +629,7 @@ namespace vm
|
|||
auto& res = vm::reservation_acquire(addr, 1);
|
||||
auto* ptr = vm::get_super_ptr(addr & -128);
|
||||
|
||||
cpu_thread::suspend_all(get_current_cpu_thread(), {ptr, ptr + 64, &res}, [&]
|
||||
cpu_thread::suspend_all<+1>(get_current_cpu_thread(), {ptr, ptr + 64, &res}, [&]
|
||||
{
|
||||
if (func())
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue