|
From: | Richard Henderson |
Subject: | Re: hexagon: modeling a shared lock state |
Date: | Sat, 27 Jan 2024 12:19:23 +1000 |
User-agent: | Mozilla Thunderbird |
On 1/26/24 02:28, Brian Cain wrote:
static void do_hwlock(CPUHexagonState *env, bool *lock) { bql_lock(); if (*lock) { env->hwlock_pending = true; cs->halted = true; cs->exception_index = EXCP_HALTED; bql_unlock(); cpu_loop_exit(cs);In place of the above - we have cpu_interrupt(cs, CPU_INTERRUPT_HALT) -- but is that equivalent?
No, it is not. Raising an interrupt will not take effect immediately.
Is there one idiom that's preferred over another? Somehow it seems simpler if we don't need to longjmp and IIRC some of these patterns do.
You need the longjmp to halt and stop execution without completing the current insn, so that the insn can be restarted later.
Oh! Just remembered. You'll want cpu_loop_exit_restore() there, so that pc is updated properly. Better to unwind in the contended case than require the pc be updated along the fast path uncontended case.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |