Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp253782ybk; Tue, 12 May 2020 22:20:39 -0700 (PDT) X-Google-Smtp-Source: APiQypIyOYRSvEgHgiOXG/WHs2c7XqkgtgD74fnFWUMAfETl07/l/whK0o4Z/lTDeMTSmH/nm+Jc X-Received: by 2002:a17:906:2418:: with SMTP id z24mr20540456eja.42.1589347239682; Tue, 12 May 2020 22:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589347239; cv=none; d=google.com; s=arc-20160816; b=OP91RZyGwvjOnXaUJ5gdbu+db6bP8kGKjCXRMxEg3yxGRip3LzL+KtCJg1Zg7QarM8 T18qgT9KQyKiK/Z+wCx1R8hKv8J1sqoXiuAINzaM9lAS1MdDZ/tZXUSfq5vaN9qxhqFG KCKfNQybew6dETSAZjOrs8+BAXQZxDWZl5hw1g6Z7sat/jhpk/DUzAYtTzNuKAGkhLOm 7eh7GfkJhV9pI1HjAHhzZeZWvOY3WU3OqEE0w0tL98Q6XFP8FZ1Ipd/FszHJfLNsnIIw 7C2uv/MqasdU68BZ36oHTYyql6rw5j9KXLQG2D1MSFD9lddBCK4/F9p43d8+Cab9ZBN6 ufjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=kuNAvbqiOq9VWIGuyjkC9WGSpZO1oJmYNzCCBwUSpwk=; b=zdM2ne4NfUGqyA3DSNHQyJz9vamJn7mqr7W8R9EyC5SiIUyfExsO+zKLfaRKB7BDKO 5pBYNWVhRmQwCrSl2Rhu7QSnLuzeCW/2jq6kOUwo6rAsHX3DOQXZfVRy5HR4jcA6nxo+ +Hvp67t9wNTvVJxJOtjYl0rmgdz9zh/IjiAKduUFD2z2Yv/QHWFwvKuBv8bWWkgcGiXV J2493xBZUV3c8sR7306fm2EazF5ond6g1VJB1xR4G1x6+pOfQf24K2w9zIM9430AF9PK 3Lwd2QrcCJNUCIP4eHA2vuSBsOI8+XokI6cMoyCtkB8WW+3MSuOytixr5yNz4P+o46BG X+Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gFpn58/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si1275489edp.57.2020.05.12.22.20.16; Tue, 12 May 2020 22:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gFpn58/z"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728097AbgEMFRN (ORCPT + 99 others); Wed, 13 May 2020 01:17:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726092AbgEMFRM (ORCPT ); Wed, 13 May 2020 01:17:12 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899C7C061A0C for ; Tue, 12 May 2020 22:17:12 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id z80so10652823qka.0 for ; Tue, 12 May 2020 22:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:user-agent:mime-version:content-transfer-encoding; bh=kuNAvbqiOq9VWIGuyjkC9WGSpZO1oJmYNzCCBwUSpwk=; b=gFpn58/zD4GPNaUUWwT8ECKmCRTGvN+48akn7IqlEJsbO9P9acoKe60CZdlE5BOJSH UPFkmNqajJwfcr94aXrzanMfeQiaCRf67Cn/jAWhsviyRsPMQmRQ4Se1NYDsYldwCNdx SRtDNGrCWzQgX2EMPinCEG7uPhzJ7lnSOJqiuZxn5xdfU8mjAmcxLYYIvcBTnQewvmJr H8jBV7OTYFpJD0UZnKp00al4aM+NXxzdT64XbPQR5VxKUIehikETK325PNgvFyG3hgIt yD16uh1Ic23W9w/6uQ0C6LMQyQsZAP+7juubWkATRhDe06tGbuXT9aFo+91o4eKlX5y9 BrtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:organization:user-agent:mime-version :content-transfer-encoding; bh=kuNAvbqiOq9VWIGuyjkC9WGSpZO1oJmYNzCCBwUSpwk=; b=sA1xbZaPrcmWRy0W60O+9rzjWr9ogG3R5q8e/3hbfwBGNsKN+pdpUeHgtr7f6eop/r luKdXVGzj94szJwOq0PdLRLudoKJdj+inNUtwsXd5ZTv4WU0/a9MSOjuZ12F2hbELS8O P5vMQRykSuoMQf4adgXP3BdsE3bd+Amn/9zAnOVGtwGf6qBd/9n/nRyva+HuL9mQ7HWU 4EYvbjtp77kxQh218enZd3nYVA6jclV6ivWMLWNYQGtC0DnQE1MfZ3czzEURkyPC/Mmx faxQB02nK4S38ezOBnaYRLZwtUWKXLw4XS0793EG8M9Pv9RCEWmkQwXd3eA+/u8N4rr7 DEfQ== X-Gm-Message-State: AGi0Pubzjg0yHsmqH537YDY1xfGruzXLW5fLIR9hiSqybGSafNHd4DdN i7xxxc6y0DSSRBRSPcvBt44= X-Received: by 2002:a37:6506:: with SMTP id z6mr24966820qkb.246.1589347031619; Tue, 12 May 2020 22:17:11 -0700 (PDT) Received: from LeoBras (179-125-143-209.dynamic.desktop.com.br. [179.125.143.209]) by smtp.gmail.com with ESMTPSA id 10sm15859166qtp.4.2020.05.12.22.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2020 22:17:10 -0700 (PDT) Message-ID: Subject: Re: [PATCH v2 1/1] powerpc/crash: Use NMI context for printk when starting to crash From: Leonardo Bras To: Nicholas Piggin , Alexios Zavras , Benjamin Herrenschmidt , Christophe Leroy , Greg Kroah-Hartman , Enrico Weigelt , Michael Ellerman , Paul Mackerras , Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 13 May 2020 02:16:58 -0300 In-Reply-To: <1589344247.2akwhmzwhg.astroid@bobo.none> References: <20200512214533.93878-1-leobras.c@gmail.com> <1589344247.2akwhmzwhg.astroid@bobo.none> Organization: IBM Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Nick, thanks for your feedback. Comments inline: On Wed, 2020-05-13 at 14:36 +1000, Nicholas Piggin wrote: > Excerpts from Leonardo Bras's message of May 13, 2020 7:45 am: > > 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. > > > > At the start of default_machine_crash_shutdown, make printk enter > > NMI context, as it will use per-cpu buffers to store the message, > > and avoid locking logbuf_lock. > > printk_nmi_enter is used in one other place outside nmi_enter. > > Is there a different/better way to handle this? What do other > architectures do? To be honest, I was unaware of nmi_enter() and I have yet to study what other architectures do here. > Other subsystems get put into an nmi-mode when we call nmi_enter > (lockdep, ftrace, rcu etc). It seems like those would be useful for > similar reasons, so at least explaining why that is not used in a > comment would be good. My reasoning for using printk_nmi_enter() here was only to keep it from using printk regular buffer (and locking logbuf_lock) at this point of the crash. I have yet to see how nmi_enter() extra functions would happen to interfere with the crash at this point. (In a quick look at x86, (native_machine_crash_shutdown) I could not see it using any printk, so it may not be necessary). > Aside from that, I welcome any effort to make our crashes more reliable > so thanks for working on this stuff. > > Thanks, > Nick Thank you, it means a lot. Leonardo Bras