Re: [PATCH v10 07/14] unwind_user/deferred: Make unwind deferral requests NMI-safe
From: Steven Rostedt
Date: Thu Jun 19 2025 - 09:04:44 EST
On Thu, 19 Jun 2025 12:39:51 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Thu, Jun 19, 2025 at 06:19:28AM -0400, Steven Rostedt wrote:
>
> > We currently care about x86-64, arm64, ppc 64 and s390. I'm assuming
> > they all have a proper 64 bit cmpxchg.
>
> They do. The only 64bit architecture that does not is HPPA IIRC.
It appears that I refactored the ring buffer code to get rid of all 64
bit cmpxchg(), but I do have this in the code:
if ((!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) ||
IS_ENABLED(CONFIG_GENERIC_ATOMIC64)) &&
(unlikely(in_nmi()))) {
return NULL;
}
We could do something similar, in the function that asks for a deferred
stack trace:
/* NMI requires having safe 64 bit cmpxchg operations */
if ((!IS_ENABLED(CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG) || !IS_ENABLED(CONFIG_64BIT)) && in_nmi())
return -EINVAL;
As the only thing not supported is requesting a deferred stack trace
from NMI context when 64 bit cmpxchg is not available. No reason to not
support the rest of the functionality.
I'll have to wrap the cmpxchg too to not be performed and just do the
update, as for these archs, NMI is not an issue and interrupts will be
disabled, so no cmpxchg is needed.
-- Steve