[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241030061043.eo2vuqgsoqmjytjr@treble.attlocal.net>
Date: Tue, 29 Oct 2024 23:10:43 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: x86@...nel.org, Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel@...r.kernel.org, Indu Bhagat <indu.bhagat@...cle.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org, Mark Brown <broonie@...nel.org>,
linux-toolchains@...r.kernel.org, Jordan Rome <jordalgo@...a.com>,
Sam James <sam@...too.org>, linux-trace-kernel@...r.kerne.org,
Jens Remus <jremus@...ux.ibm.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Florian Weimer <fweimer@...hat.com>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH v3 11/19] unwind: Add deferred user space unwinding API
On Tue, Oct 29, 2024 at 04:32:46PM -0700, Andrii Nakryiko wrote:
> > struct audit_context;
> > @@ -1592,6 +1593,10 @@ struct task_struct {
> > struct user_event_mm *user_event_mm;
> > #endif
> >
> > +#ifdef CONFIG_UNWIND_USER
> > + struct unwind_task_info unwind_task_info;
>
> this is quite a lot of memory to pay on each task, a lot of which a)
> might not have sframe
Frame pointers are also supported.
> and b) might not need stack unwinding during their lifetime.
Right, I'm not super happy about that.
> It can be a pointer and allocated in copy_process(), no?
> Though ideally this should be initialized lazily, if possible.
Problem is, the unwinder doesn't know in advance which tasks will be
unwound.
Its first clue is unwind_user_register(), would it make sense for the
caller to clarify whether all tasks need to be unwound or only a
specific subset?
Its second clue is unwind_user_deferred(), which is called for the task
itself. But by then it's too late because it needs to access the
per-task data from (potentially) irq context so it can't do a lazy
allocation.
I'm definitely open to ideas...
> > + if (!info->entries) {
> > + info->entries = kmalloc(UNWIND_MAX_ENTRIES * sizeof(long),
> > + GFP_KERNEL);
> > + if (!info->entries)
> > + return;
>
> uhm... can we notify callbacks that stack capture failed? otherwise
> we'd need some extra timeouts and other complications if we are
> *waiting* for this callback to be called
Hm, do you actually plan to wait for the callback?
I assume this is BPF, can you give some high-level detail about how it
will use these interfaces?
--
Josh
Powered by blists - more mailing lists