Thread (79 messages) 79 messages, 6 authors, 2025-06-24

Re: [PATCH v10 07/14] unwind_user/deferred: Make unwind deferral requests NMI-safe

From: Peter Zijlstra <peterz@infradead.org>
Date: 2025-06-19 08:44:36
Also in: bpf, lkml

On Thu, Jun 19, 2025 at 04:37:33AM -0400, Steven Rostedt wrote:
On Thu, 19 Jun 2025 10:34:15 +0200
Peter Zijlstra [off-list ref] wrote:
quoted
Why can't we cmpxchg_local() the thing and avoid this horrible stuff?

static u64 get_timestamp(struct unwind_task_info *info)
{
	u64 new, old = info->timestamp;

	if (old)
		return old;
	
	new = local_clock();
	old = cmpxchg_local(&info->timestamp, old, new);
	if (old)
		return old;
	return new;
}

Seems simple enough; what's wrong with it?
It's a 64 bit number where most 32 bit architectures don't have any
decent cmpxchg on 64 bit values. That's given me hell in the ring
buffer code :-p
Do we really have to support 32bit?

But IIRC a previous version of all this had a syscall counter. If you
make this a per task syscall counter, unsigned long is plenty.

I suppose that was dropped because adding that counter increment to all
syscalls blows. But if you really want to support 32bit, that might be a
fallback.

Luckily, x86 dropped support for !CMPXCHG8B right along with !TSC. So on
x86 we good with timestamps, even on 32bit.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help