Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp446767ybk; Fri, 15 May 2020 05:05:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJrwGEYHzRlokWEgr66fWznYWR7ICa1nQ09ggYD+5aC/9xXziZzksYr6J2XNSRR/pra3b6 X-Received: by 2002:a50:a624:: with SMTP id d33mr2529943edc.58.1589544304677; Fri, 15 May 2020 05:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589544304; cv=none; d=google.com; s=arc-20160816; b=vpVusXPY9cxqX9lcdEbV3oeLXttO9rMX3DfP7CQrrqqcJD8pPwE0bm7gJAMw/TI71g sV2hLTN7Ozcu6s/g+JGE4HS0WdbFZHBmqKynjhkz+4XRwWv0caBUjvgwP8N2gaxFpaJM FIxLwdLBzyGoKo2JAwWbA8dsxKjvCgcIiXmfbDSaYBovkg7zyEnkN6jDbGACEdajLlH6 BhsYD90wLH7uff4CWl2CKzSJqSqU29+xqiZR2cF6k2pULk1gwfjNFPpGaC6XGe/5jgUb 5vZNFgSUNR4YMp05cWO1cDcwwrJUL3XypZ9shRDg1gPm0kkW/ox26Ba/8qLKX9lgSgsf zK8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=EQ+MSLCM1FfK9aeAp+m5Aux8g42PMTCx+zx8TzWAujU=; b=G6hACRzLJkVlSeorSn2cetwv+/OnlM46L3pI3P++aBg8Dm9unb0ZpEkCLYeegeRNPM mncRGDRjysHdkdsig1vEgYrv23p5n64uQMPIUaawo440V38O8L28eHB6MgIP4Q5hUFtR ZcfyuXL9VIoOs+0FuwyCyZgG5F268q6t6qrqdxtpNT9XDvphN0pkYCVNv0YoEs3g+0mY h3A1L9VuSMX2qtj6Y1HTnX0R0qYQc8DJEU3hT6JtdkaVTEU8OiW1j4VnYbA3lyAAWbx5 sRIUNdwtWz5F81ceALgMq+C355O9BHcEJPdyl4dsTvsciwZQmPkUykoXkeBt9/YwaCQE rfvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xa/ToNKh"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd22si986609edb.162.2020.05.15.05.04.40; Fri, 15 May 2020 05:05:04 -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=@linaro.org header.s=google header.b="xa/ToNKh"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbgEOMDM (ORCPT + 99 others); Fri, 15 May 2020 08:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbgEOMDL (ORCPT ); Fri, 15 May 2020 08:03:11 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3D3CC061A0C for ; Fri, 15 May 2020 05:03:09 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id x27so1485692lfg.9 for ; Fri, 15 May 2020 05:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EQ+MSLCM1FfK9aeAp+m5Aux8g42PMTCx+zx8TzWAujU=; b=xa/ToNKhDgoNnwHQ4aUO++Zmfp93IQTCpctnvYKOZTbKBjg4xMYYskVBTSvr6nAvHB nSvIi9FkaPBtSTQ8y4plyLib2B0RhtLzqYFSD23tagBV9eqEGUReK2mo0tGa04bkpH6F kx89QudofULMU8FOht++19CTimQ6s1VSdFX6FSM0rppyILJa27wxE0+p5ybtCfqDM9aw WTT0vmim8nrF7cL1Gg9TlQ2CGoMYrzR9vp6XWSwcJJ/wkDLgKalGQRbshmbEsLVKmBh9 9QOFJhDh4wlFTH0i3xmcIe6+CC4xM1YhY6RCVFN9JYlrzO/p9qVwmIDDkTl2PHUAC841 dkrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EQ+MSLCM1FfK9aeAp+m5Aux8g42PMTCx+zx8TzWAujU=; b=dVxwfxvMX2gxO3qGNsCNKpnbf85Spgqb+/glmKYtBRxNiXDQrz8Yt+Tcg4y4tv+GRk BcwOF07HY4RPgUzr0YYW5yuGR55+Pw29HEa0VDUlWZ16XNJKC1OlOBmzbfoX4HY60057 E+YJdV9e43vCaLHpemMMSXgnKzzAJwykx/4NtHg0LCLvL6UstydDG1k/nOiFcmM4YqTB e8Vvin8OF6WD7mm49ZgQy/cYC+PdWBAZUxati4fBw3ReRhH9MTahtbDRCZguq6YzZyM9 DM4dWeJjn2pI+GzifGW2WZCA4+H5DPPKprJydekYwrX341/0jbPi8vYVwQ84u9vs7R+n tCGg== X-Gm-Message-State: AOAM533eHnH7gDgmsoSPWBqs9qZ36jmKzk435ffQPb86EZJ7VdQ7GyLa CDmI4Wh8SDteE94/r75Vc9c5g27ruQXYQoOdrYviEg== X-Received: by 2002:ac2:4293:: with SMTP id m19mr2245484lfh.204.1589544187846; Fri, 15 May 2020 05:03:07 -0700 (PDT) MIME-Version: 1.0 References: <1589273314-12060-1-git-send-email-sumit.garg@linaro.org> <20200512142533.ta4uejwmq5gchtlx@holly.lan> <20200514084230.GO17734@linux-b0ei> <20200515085021.GS17734@linux-b0ei> <20200515103308.GD42471@jagdpanzerIV.localdomain> In-Reply-To: <20200515103308.GD42471@jagdpanzerIV.localdomain> From: Sumit Garg Date: Fri, 15 May 2020 17:32:56 +0530 Message-ID: Subject: Re: [PATCH] printk/kdb: Redirect printk messages into kdb in any context To: Sergey Senozhatsky Cc: Petr Mladek , Daniel Thompson , Jason Wessel , Douglas Anderson , kgdb-bugreport@lists.sourceforge.net, Linux Kernel Mailing List , Arnd Bergmann , Andrew Morton , Peter Zijlstra , Steven Rostedt , John Ogness Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sergey, On Fri, 15 May 2020 at 16:03, Sergey Senozhatsky wrote: > > On (20/05/15 10:50), Petr Mladek wrote: > > kdb is able to stop kernel even in NMI context where printk() is redirected > > to the printk_safe() lockless variant. Move the check and redirect to kdb > > even in this case. > > Can I please have some context what problem does this solve? You can find the problem description here [1] which leads to this fix. > I can see that vkdb_printf() calls into console drivers: > > for_each_console(c) { > c->write(c, cp, retlen - (cp - kdb_buffer)); > touch_nmi_watchdog(); > } > > Is this guaranteed that we never execute this path from NMI? Yes the above code could run in NMI context but it will only run after we stop the kernel (drop into debugger) and on a single CPU at a time. AFAIK, we drop into the debugger either via sysrq or during oops_in_progress. So I think it should be a lockless entry into the console driver for write operations. TBH, it's very much possible that I may miss some aspect. So please feel free to correct me. [1] https://lkml.org/lkml/2020/5/12/213 -Sumit > If so, can this please be added to the commit message? A more > detailed commit message will help a lot. > > -ss