From: Peter Zijlstra <peterz@infradead.org>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Leonardo Bras <leonardo@linux.ibm.com>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Enrico Weigelt <info@metux.net>,
Allison Randal <allison@lohutok.net>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/1] ppc/crash: Skip spinlocks during crash
Date: Mon, 30 Mar 2020 13:02:31 +0200 [thread overview]
Message-ID: <20200330110231.GG20696@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <af505ef0-e0df-e0aa-bb83-3ed99841f151@c-s.fr>
On Fri, Mar 27, 2020 at 07:50:20AM +0100, Christophe Leroy wrote:
>
>
> Le 26/03/2020 à 23:28, Leonardo Bras a écrit :
> > During a crash, there is chance that the cpus that handle the NMI IPI
> > are holding a spin_lock. If this spin_lock is needed by crashing_cpu it
> > will cause a deadlock. (rtas_lock and printk logbuf_log as of today)
> >
> > This is a problem if the system has kdump set up, given if it crashes
> > for any reason kdump may not be saved for crash analysis.
> >
> > Skip spinlocks after NMI IPI is sent to all other cpus.
> >
> > Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
> > ---
> > arch/powerpc/include/asm/spinlock.h | 6 ++++++
> > arch/powerpc/kexec/crash.c | 3 +++
> > 2 files changed, 9 insertions(+)
> >
> > diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
> > index 860228e917dc..a6381d110795 100644
> > --- a/arch/powerpc/include/asm/spinlock.h
> > +++ b/arch/powerpc/include/asm/spinlock.h
> > @@ -111,6 +111,8 @@ static inline void splpar_spin_yield(arch_spinlock_t *lock) {};
> > static inline void splpar_rw_yield(arch_rwlock_t *lock) {};
> > #endif
> > +extern bool crash_skip_spinlock __read_mostly;
> > +
> > static inline bool is_shared_processor(void)
> > {
> > #ifdef CONFIG_PPC_SPLPAR
> > @@ -142,6 +144,8 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
> > if (likely(__arch_spin_trylock(lock) == 0))
> > break;
> > do {
> > + if (unlikely(crash_skip_spinlock))
> > + return;
>
> You are adding a test that reads a global var in the middle of a so hot path
> ? That must kill performance. Can we do different ?
This; adding code to a super hot patch like this for an exceptional case
like the crash handling seems like a very very bad trade to me.
One possible solution is to simply write 0 to the affected spinlocks
after sending the NMI IPI thing, no?
next prev parent reply other threads:[~2020-03-30 11:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 22:28 [PATCH 1/1] ppc/crash: Skip spinlocks during crash Leonardo Bras
2020-03-26 23:26 ` Leonardo Bras
2020-03-27 6:50 ` Christophe Leroy
2020-03-27 15:51 ` Leonardo Bras
2020-03-28 10:19 ` Christophe Leroy
2020-03-30 14:33 ` Leonardo Bras
2020-03-30 11:02 ` Peter Zijlstra [this message]
2020-03-30 14:12 ` Leonardo Bras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200330110231.GG20696@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=allison@lohutok.net \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=info@metux.net \
--cc=leonardo@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox