[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250504122131.6ca0d50c@batman.local.home>
Date: Sun, 4 May 2025 12:21:31 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Masami
Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, x86@...nel.org, Jiri Olsa
<jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH v7 08/17] unwind_user/deferred: Add unwind cache
On Sun, 4 May 2025 11:37:54 +0200
Ingo Molnar <mingo@...nel.org> wrote:
Hi Ingo,
> * Steven Rostedt <rostedt@...dmis.org> wrote:
>
> > -struct unwind_task_info {
> > +struct unwind_cache {
> > unsigned long *entries;
> > + unsigned int nr_entries;
> > +};
> > +
> > +struct unwind_task_info {
> > + struct unwind_cache cache;
> > };
>
> > @@ -19,17 +20,29 @@ int unwind_deferred_trace(struct unwind_stacktrace *trace)
> > if (current->flags & PF_EXITING)
> > return -EINVAL;
> >
> > - if (!info->entries) {
> > - info->entries = kmalloc_array(UNWIND_MAX_ENTRIES, sizeof(long),
> > - GFP_KERNEL);
> > - if (!info->entries)
> > - return -ENOMEM;
> > + if (!cache->entries) {
> > + cache->entries = kmalloc_array(UNWIND_MAX_ENTRIES, sizeof(long),
> > + GFP_KERNEL);
> > + if (!cache->entries)
> > + return -ENOMEM;
> > + }
>
> That's just sloppy: why isn't the unwind_cache a pointer to begin with,
> with the dynamically allocated object containing ::nr_entries?
Basically you want?
struct unwind_task_info {
struct unwind_cache *cache;
};
Then have:
struct unwind_cache {
int nr_entries;
unsigned long entries[];
};
And allocate the unwind_cache to include the size (using the dynamic
structure macro helpers)?
That makes sense to me.
>
> Also, the code has whitespace damage.
>
> > +
> > + trace->entries = cache->entries;
> > +
> > + if (cache->nr_entries) {
> > + /*
> > + * The user stack has already been previously
> > unwound in this
> > + * entry context. Skip the unwind and use the
> > cache.
> > + */
> > + trace->nr = cache->nr_entries;
> > + return 0;
>
> Whitespace damage here too. Maybe in other patches as well.
>
> Please don't rush this series without first reviewing it carefully ...
Hmm, For whitespace damage, I usually rely on git show to show me where
whitespace damage is. But if there's no tabs, then it doesn't show. The
whitespace damage came from when I pulled in Josh's work and rebased it
on the latest kernel. There were conflicts which was solved by having
to do some cut and paste from .rej files, and somehow it added spaces
instead of tabs.
Peter caught this is the beginning, and I thought I got all the
locations that had that white space issue. This patch hasn't been
touched much during the various versions.
I'll do a search for spaces to see if there's more in any of the other
patches.
Thanks!
-- Steve
Powered by blists - more mailing lists