Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp606120ybb; Wed, 8 Apr 2020 06:27:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJZNjUsSEjR7SD8a9txEinT4rP0HY1DdnRHmem1MzSti2DCr11KuU6oayQ9bm9ZSARLHwBn X-Received: by 2002:a4a:395e:: with SMTP id x30mr1725294oog.17.1586352432136; Wed, 08 Apr 2020 06:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586352432; cv=none; d=google.com; s=arc-20160816; b=s/V/BTmMkp0S+5zm93AzAMU5B2Jzo5weYMxq14FTIMs+pMA4wz89Ce69BkJ2+Ta4Og bxluC5cXcDQrb8BisAfXKbl2GvikFzjkxIOM9/HNP6N0+rOyhT1CEtb0Q+0s61UUFhpd QqvFYye2Nnitw71kUKuRLb3dqjt5h2SOnQstfi9vuOt8CGJKnGm7hVMIvIycsBXW7zsP DIu7x8POO8Dl9+T2ElxpxeCiNl9coBls+Fu6CGaUnccxUZehJ7mxgcMfX5RwvrOjVM3C JV0HEu1QhBhhjrqHPsB1ywDwtCfugFEwH42RcF/xcCDW1diUuimYJkkdybSxeSJflS/T EjiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=S9bpX5lJNJtBL6Qr482iEP6kK8PIKxoHMXGevtyTdos=; b=PLtxVw8+/0o1XMxisErCbOD1CW9pcm1XAQY7xiUM3WF2DBfDdapd4oqJ7HfdO+Tuka TiWbuLndTkAw5IJFhYmDawnf+PcgylMetZdIyEY1S9pBIp38r9pw/mvypvKzdEnvowUD KU8E7uaXHbQeTG007qvBdhifUZsf3OlDvUXdp1Ksccs+49UxUNaL3/+LNoeH8WC4LlPb H38rjf0ExF/hFtIvOxWpqs2k+AWM9QVC21a5L0C3GgHvsrdPz/5KWTQ5Xxtr9DDCyoX4 uPMpEK+t/Nz+TgKKgzhWf6KsHBYXYXWQjlL4AJSVPLwLnE3BH7NZtCFHO4+Lm38whwey OxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=CvHc61oW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si2373272otb.284.2020.04.08.06.26.57; Wed, 08 Apr 2020 06:27:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=CvHc61oW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbgDHMNW (ORCPT + 99 others); Wed, 8 Apr 2020 08:13:22 -0400 Received: from bilbo.ozlabs.org ([203.11.71.1]:39413 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgDHMNW (ORCPT ); Wed, 8 Apr 2020 08:13:22 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 48y38J2kyXz9sRN; Wed, 8 Apr 2020 22:13:20 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1586348000; bh=ubGzeXSiVoqtebhTvEZLZD3GVQ6q7AW2piVuB1gAlBA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CvHc61oW7tA7kZxZgTKRkrr72INdmtZmz5b2cWNfwTinUYYVcvgEHtnajpTiQwaWq RInLrTI9uvKzzCpougdbGohfsJjFL9K0UTwXHMbirkCHbfkqJOa8/JN++5teOhXBSi ecCRcm7DO8/gqeCaTulSq2i7bmpwZknTMxVoPQIiP0lShZubxMLu2lijoJj9lqco4o Y6W0UUEPlPu/GwkcXy4vdaYBunXvXJAF3QG/zXFcmdTK/HY2RGbe2nq+WKeqIZdQAu btwyGBcmhkxv9hZHS09dfisn+s8WtiOaESPca0aijOPTVwdEucrjnZ1wDkEHrqXuiy L/LyM6dfCLxpg== From: Michael Ellerman To: Leonardo Bras , Benjamin Herrenschmidt , Paul Mackerras , Greg Kroah-Hartman , Enrico Weigelt , Thomas Gleixner , Allison Randal , Christophe Leroy , Leonardo Bras , Nicholas Piggin Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] powerpc/crash: Use NMI context for printk after crashing other CPUs In-Reply-To: <20200406174058.686436-1-leonardo@linux.ibm.com> References: <20200406174058.686436-1-leonardo@linux.ibm.com> Date: Wed, 08 Apr 2020 22:13:31 +1000 Message-ID: <87y2r6jhuc.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Leonardo Bras writes: > Currently, if printk lock (logbuf_lock) is held by other thread during > crash, there is a chance of deadlocking the crash on next printk, and > blocking a possibly desired kdump. > > After sending IPI to all other CPUs, make printk enter in NMI context, > as it will use per-cpu buffers to store the message, and avoid locking > logbuf_lock. > > Signed-off-by: Leonardo Bras > --- > arch/powerpc/kexec/crash.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c > index d488311efab1..9b73e3991bf4 100644 > --- a/arch/powerpc/kexec/crash.c > +++ b/arch/powerpc/kexec/crash.c > @@ -115,6 +115,7 @@ static void crash_kexec_prepare_cpus(int cpu) Added context: printk(KERN_EMERG "Sending IPI to other CPUs\n"); if (crash_wake_offline) ncpus = num_present_cpus() - 1; > > crash_send_ipi(crash_ipi_callback); > smp_wmb(); > + printk_nmi_enter(); Why did you decide to put it there, rather than at the start of default_machine_crash_shutdown() like I did? The printk() above could have already deadlocked if another CPU is stuck with the logbuf lock held. cheers