[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZM0S9gKBBiu83kFq@dhcp22.suse.cz>
Date: Fri, 4 Aug 2023 17:02:14 +0200
From: Michal Hocko <mhocko@...e.com>
To: Doug Anderson <dianders@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>, Arnd Bergmann <arnd@...db.de>,
Borislav Petkov <bp@...en8.de>,
Christophe Leroy <christophe.leroy@...roup.eu>,
"Darrick J. Wong" <djwong@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"David S. Miller" <davem@...emloft.net>,
Gaosheng Cui <cuigaosheng1@...wei.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>,
Guo Ren <guoren@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
Huacai Chen <chenhuacai@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Jianmin Lv <lvjianmin@...ngson.cn>,
Jinyang He <hejinyang@...ngson.cn>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Kees Cook <keescook@...omium.org>,
Lecopzer Chen <lecopzer.chen@...iatek.com>,
Marc Zyngier <maz@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Pingfan Liu <kernelfans@...il.com>,
Qing Zhang <zhangqing@...ngson.cn>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Russell King <linux@...linux.org.uk>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Thomas Gleixner <tglx@...utronix.de>,
Tom Rix <trix@...hat.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Valentin Schneider <vschneid@...hat.com>,
WANG Xuerui <kernel@...0n.name>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
loongarch@...ts.linux.dev, sparclinux@...r.kernel.org,
x86@...nel.org
Subject: Re: [PATCH v3 1/2] nmi_backtrace: Allow excluding an arbitrary CPU
On Fri 04-08-23 06:56:51, Doug Anderson wrote:
> Hi,
>
> On Fri, Aug 4, 2023 at 12:50 AM Michal Hocko <mhocko@...e.com> wrote:
> >
> > On Thu 03-08-23 16:07:57, Douglas Anderson wrote:
> > > The APIs that allow backtracing across CPUs have always had a way to
> > > exclude the current CPU. This convenience means callers didn't need to
> > > find a place to allocate a CPU mask just to handle the common case.
> > >
> > > Let's extend the API to take a CPU ID to exclude instead of just a
> > > boolean. This isn't any more complex for the API to handle and allows
> > > the hardlockup detector to exclude a different CPU (the one it already
> > > did a trace for) without needing to find space for a CPU mask.
> > >
> > > Arguably, this new API also encourages safer behavior. Specifically if
> > > the caller wants to avoid tracing the current CPU (maybe because they
> > > already traced the current CPU) this makes it more obvious to the
> > > caller that they need to make sure that the current CPU ID can't
> > > change.
> >
> > Yes, this looks like the best way forward.
> >
> > It would have been slightly safer to modify arch_trigger_cpumask_backtrace
> > by switching arguments so that some leftovers are captured easier.
>
> I'm not sure I understand. Oh, you're saying make the prototype of
> arch_trigger_cpumask_backtrace() incompatible so that if someone is
> directly calling it then it'll be a compile-time error?
exactly. bool to int promotion would be too easy to miss while the
pointer to int would complain loudly.
> I guess the
> hope is that nobody is calling that directly and they're calling
> through the trigger_...() functions.
Hope is one thing, being preventive another.
> For now I'm going to leave this alone.
If you are going to send another version then please consider this. Not
a hard requirement but better.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists