On Tue, Apr 16, 2019 at 03:15:59PM -0500, Josh Poimboeuf wrote: > If you do the regs->eflags thing to mark the regs as fake in > (perf_arch_fetch_caller_regs()), then I don't think skip_sp would be > needed, because regs->sp could probably mark the skip point. > > Instead I was actually hoping we could get rid of fake regs and > perf_arch_fetch_caller_regs() altogether, because it's a nasty hack. > But I don't know what else those fake regs are used for.
This is the generic perf generate a sample path. It doesn't know the context. Normally it is an interrupt or exception of sorts and we simply pass the pt_regs from that down the chain and all is good. It is just for a few software events, such as SW_CONTEXT_SWITCH, SW_MIGRATIONS and all the TP muck that we do not have regs to pass down. These regs are used by: - SAMPLE_IP, - SAMPLE_CALLCHAIN (this here issue), - SAMPLE_REGS_INTR, - a few misc bits There's actually comment on top of perf_fetch_caller_regs() that tries to explain what is needed -- although I suppose that could do with an update.