Re: [PATCH v2 00/11] unwind, perf: sframe user space unwinding, deferred perf callchains
From: Peter Zijlstra
Date: Mon Sep 16 2024 - 10:11:48 EST
On Sun, Sep 15, 2024 at 01:11:11PM +0200, Josh Poimboeuf wrote:
> On Sat, Sep 14, 2024 at 08:12:46AM -0400, Steven Rostedt wrote:
> > I think the unwinder should have an interface itself that provides the
> > deferred unwinding, instead of having all the tracers to implement
> > their own.
> >
> > The user space unwinder (regardless of sframe or not) should provide a
> > way to say "I want a user space stack trace for here, but don't do it
> > yet. Just give me a cookie and then call my callback function with the
> > stack and cookie before going back to user space".
>
> We (Steven, Mathieu and I) have been discussing this at GNU Cauldron and
> I think we're in basic agreement on this.
>
> I think the biggest tweak we decided on is that the context id (aka
> "cookie") would be percpu. Its initial value is (cpuid << 48). It gets
> incremented for every entry from user space.
Why? What's the purpose of the cookie? This scheme seems unsound, pin
yourself on CPU0 and trigger 1<<48 unwinds while keeping CPU1 idle.
> > That is, we should have an interface like:
> >
> > typedef void (unwinder_callback_t)(struct user_space_stack *, u64 cookie);
Just make it a void* and let the consumer figure it out.