On Tue, Jul 29, 2025 at 02:23:10PM -0400, Steven Rostedt wrote:
> @@ -212,32 +225,59 @@ int unwind_deferred_request(struct unwind_work *work,
> u64 *cookie)
>
> *cookie = get_cookie(info);
>
> - /* callback already pending? */
> - pending = READ_ONCE(info->pending);
> - if (pending)
> - return 1;
> + old = READ_ONCE(info->unwind_mask);
>
> - /* Claim the work unless an NMI just now swooped in to do so. */
> - if (!try_cmpxchg(&info->pending, &pending, 1))
> + /* Is this already queued or executed */
> + if (old & bit)
> return 1;
>
> + /*
> + * This work's bit hasn't been set yet. Now set it with the PENDING
> + * bit and fetch the current value of unwind_mask. If ether the
> + * work's bit or PENDING was already set, then this is already queued
> + * to have a callback.
> + */
> + bits = UNWIND_PENDING | bit;
> + old = atomic_long_fetch_or(bits, (atomic_long_t *)&info->unwind_mask);
> + if (old & bits) {
> + /*
> + * If the work's bit was set, whatever set it had better
> + * have also set pending and queued a callback.
> + */
> + WARN_ON_ONCE(!(old & UNWIND_PENDING));
> + return old & bit;
Per the function comment, the function returns 0, 1, or negative. So
this should be
return !!(old & bit)
right?
--
Josh