Re: [PATCH 3/4] x86: Rewrite switch_to() code

From: Josh Poimboeuf
Date: Tue Jul 12 2016 - 10:16:39 EST


On Mon, May 23, 2016 at 10:03:54AM -0700, Andy Lutomirski wrote:
> Do you have any understanding of why there are so many unwinder
> implementations? Your reliable unwinder seems to be yet another copy
> of more or less the same code.
>
> I'd like to see a single, high-quality unwinder implemented as a state
> machine, along the lines of:
>
> struct unwind_state state;
> unwind_start_inactive_task(&state, ...); or
> unwind_start_pt_regs(&state, regs); or whatever.
> unwind_next_frame(&state);
>
> where, after unwind_next_frame, state encodes whatever registers are
> known (at least bp and ip, but all the GPRs would be nice and are
> probably mandatory for DWARF) and an indication of whether this is a
> real frame or a guessed frame (the things that currently show up as
> '?').

FYI, I'm working on something very similar to this which replaces
dump_trace(). The frame pointer encoding patches were going to require
more changes to the unwinder than I expected, and more callback sprawl.
So it looks like it's going to be easier to just go ahead and rewrite
the unwinder first.

--
Josh