On Thu, Nov 28, 2024 at 1:33 AM Jiri Slaby <jslaby@suse.cz> wrote:
On 27. 11. 24, 20:15, Andrii Nakryiko wrote:
You can do DWARF unwinding in the kernel as well (as well as stack capturing for FP based unwinding).
Not really. Kernel itself doesn't support it, and if you were to implement it in a BPF program yourself you'd run into many practical issues. The most damning would be inability to page in memory that contains .eh_frame section contents from non-sleepable context, in which stack trace is typically captured (NMI, tracepoints, kprobes). See above.
We won't enable FPs in kernels in any case. Assembler is annotated only by ORC and many asm functions do not save/restore FP, so it'd be kind of useless anyway.
Are you sure we are discussing the same topic here? This proposal is about frame pointers and capturing stack traces **for user space**. But you keep bringing up kernel stack traces. Two different beasts, with vastly different limitations (for one, kernel memory in which those ORC tables are stored is guaranteed to be mapped in physical memory, so available at all times, including in NMI context; there is no such guarantee for .eh_frame for user space; neither there is for SFrame tables, btw). ORC does indeed work in the kernel, and we do use ORC instead of frame pointers **for kernel**. There is no ORC for user space, though. SFrame is sort of that thing, but as I said there is tons of technical work to make it happen, and we are moving in that direction, but are not there yet. Meanwhile frame pointers are the only reasonable alternative.
regards, -- js suse labs