Hi Levi,
On Wed, Jul 02, 2025 at 10:49:01AM +0100, Yeoreum Yun wrote:
Hi Leo,
{
- return local_cmpxchg(&csdev->mode, CS_MODE_DISABLED, new_mode) ==
CS_MODE_DISABLED;
- int curr = CS_MODE_DISABLED;
- return atomic_try_cmpxchg_acquire(&csdev->mode, &curr, new_mode);
}
Just question. why is acquire symentic enough in here?
My understanding is that acquire semantics ensure ordering between cmpxchg_acquire() and all memory accesses that follow it. However, it does not guarantee that memory accesses appearing before the acquire are ordered as well.
This is exactly what we want in the driver. We must ensure to first grab an active device mode, then it is safe to proceed later operations (e.g. set configurations in driver data and access registers).
before this change, local_cmpxchg seems to use full_fenced.
Not really. Arm64 has atomic instruction for cmpxchg, it does not use full_fenced. It should run into the path of arch_cmpxchg().
Thanks, Leo