[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211014184825.2vre4bt3fojcfdka@treble>
Date: Thu, 14 Oct 2021 11:48:25 -0700
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Mark Rutland <mark.rutland@....com>
Cc: Peter Zijlstra <peterz@...radead.org>, keescook@...omium.org,
jannh@...gle.com, linux-kernel@...r.kernel.org,
vcaputo@...garu.com, mingo@...hat.com, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, akpm@...ux-foundation.org,
christian.brauner@...ntu.com, amistry@...gle.com,
Kenta.Tada@...y.com, legion@...nel.org,
michael.weiss@...ec.fraunhofer.de, mhocko@...e.com, deller@....de,
zhengqi.arch@...edance.com, me@...in.cc, tycho@...ho.pizza,
tglx@...utronix.de, bp@...en8.de, hpa@...or.com, axboe@...nel.dk,
metze@...ba.org, laijs@...ux.alibaba.com, luto@...nel.org,
dave.hansen@...ux.intel.com, ebiederm@...ssion.com,
ohoono.kwon@...sung.com, kaleshsingh@...gle.com,
yifeifz2@...inois.edu, linux-hardening@...r.kernel.org,
linux-arch@...r.kernel.org, vgupta@...nel.org,
linux@...linux.org.uk, will@...nel.org, guoren@...nel.org,
bcain@...eaurora.org, monstr@...str.eu, tsbogend@...ha.franken.de,
nickhu@...estech.com, jonas@...thpole.se, mpe@...erman.id.au,
paul.walmsley@...ive.com, hca@...ux.ibm.com,
ysato@...rs.sourceforge.jp, davem@...emloft.net, chris@...kel.net
Subject: Re: [PATCH 6/7] arch: __get_wchan || STACKTRACE_SUPPORT
On Thu, Oct 14, 2021 at 07:03:07PM +0100, Mark Rutland wrote:
> On Fri, Oct 08, 2021 at 03:45:59PM +0200, Peter Zijlstra wrote:
> > On Fri, Oct 08, 2021 at 01:40:52PM +0100, Mark Rutland wrote:
> > > [Adding Josh, since there might be a concern here from a livepatch pov]
> > >
> >
> > > > +static unsigned long __get_wchan(struct task_struct *p)
> > > > +{
> > > > + unsigned long entry = 0;
> > > > +
> > > > + stack_trace_save_tsk(p, &entry, 1, 0);
> > >
> > > This assumes stack_trace_save_tsk() will skip sched functions, but I
> > > don't think that's ever been a requirement? It's certinaly not
> > > documented anywhere that I could find, and arm64 doesn't do so today,
> > > and this patch causes wchan to just log `__switch_to` for everything.
> >
> > Confused, arm64 has arch_stack_walk() and should thus use
> > kernel/stacktrace.c's stack_trace_consume_entry_nosched.
>
> Looking at this arm64's *current* get_wchan() unwinds once before
> checking in_sched_functions(), so it skips __switch_to(). As of this
> patch, we check in_sched_functions() first, which stops the unwind
> immediately as __switch_to() isn't marked as __sched.
>
> I think x86 gets away with this because switch_to() is asm, and that
> tail-calls __switch_to() when returning.
>
> Does switch_to() and below need to be marked __sched?
Yes, I would think so, for arches where they otherwise show up on the
stacktrace.
--
Josh
Powered by blists - more mailing lists