Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp204011pxa; Tue, 11 Aug 2020 22:49:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHMB2KIi9JDtrrhCIMzHn/Xd1N1FDuKNOQIpEF5L+BZ3vJJKdg+txeej3Fp79peLH5eQNJ X-Received: by 2002:a05:6402:60e:: with SMTP id n14mr29554332edv.29.1597211377890; Tue, 11 Aug 2020 22:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597211377; cv=none; d=google.com; s=arc-20160816; b=XFTQnK6DxrTElMPnJS2kYe3P0Absfspnl/Jhf0jbzFrerXAMY/7uVm+KjLDIr3fDvB FKMNFl6kaQqhK7Nuh5nv/uuN7d437wH4IqFUBsDAYm+ItHLxxBCvhvgmUfyJECt5wVL2 KVO40/LZF6nhpwh65ljyIH5XjW2DpVeUQUgO+O3XFmuJ5tZf6GrOAB3a57GehLQeyFJl dxLT3Cmzb2a7SK+QYvvdt6cLtjaMLS1rwiscBa2y41IqHH0W+9YGzOEiqvm5u66K0Ork siPZwE1cRJgVFDfEvarL9NlUA3An5aeLnaD/gAZUXTTzZgWjWuYOcRXyt0v5XCfPoCSz SQfg== 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=0zEyjemzrW6tuSgaZxYukJPqD4TDeOcf1QxIdZ2ERWE=; b=fQawdgcUCtqV5/dxbb76rZ/gvutpJBWmOr9YNtE1XlM4qUWh52r1OPFoY1Isy7rweX uHHtlpX+dcXxYI6HHrdxDq42r0WKMMuO0zU0poaK6ffqjFj3H3qltZrwvA/YK7i1zg0S jEKhkyRyqNJ9QaH8FpTiOSPW+77N7+/q0csxyzvHK6CR05YRGqC04FcJEozjxzC1p3IN sYBrCX0/MDUFB+FyLRVnIqsCrROmqhoF3XPsx3b12cyoJ49K64lytnynX0eettctfouL 8GEiqwjvIWb28vbkMG4iXNrIVgRoekKhkMfxqIxwOKwmFgR+970ewNMlEQrC2CUw/Sjb Smgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t3V+ZjoH; 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 be10si650127edb.574.2020.08.11.22.49.14; Tue, 11 Aug 2020 22:49:37 -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=t3V+ZjoH; 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 S1726567AbgHLFsk (ORCPT + 99 others); Wed, 12 Aug 2020 01:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgHLFsh (ORCPT ); Wed, 12 Aug 2020 01:48:37 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CA9BC06174A for ; Tue, 11 Aug 2020 22:48:37 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id h19so844380ljg.13 for ; Tue, 11 Aug 2020 22:48:36 -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=0zEyjemzrW6tuSgaZxYukJPqD4TDeOcf1QxIdZ2ERWE=; b=t3V+ZjoHihxGen/+fgcb+Sl03t+g32bqWe2dXV0gZ0ay5zDsCBaKQXzaAsXiaWlX4M bWnc6EU04acKEt4FPPmZIbGLNgPs5+7PI/M1HLrVIKJCwsyAKf+T8wh9dUqU4Pm5eEev QUX8yIytpIJ9M++9s670b38UU7MBDjMJ4ZRy9uV2/p5zLmLTIsvfYdAMe2lx0r/pv2tr WvI8EyZ0wO9Zz4TYPOT1Ghp3FeHCTh2o4yCQqqN9NuHTgSKAPHEKK4Bi2Dmh9Jk+L/hi mvKVcbex+IDJGph6gi02H2S+N8Qrj6V6jMbx+9fo9F3b6pUnSyZXdf2kOTqQmoqT1mt/ xBKg== 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=0zEyjemzrW6tuSgaZxYukJPqD4TDeOcf1QxIdZ2ERWE=; b=LJTlD0yOSA5wxLsDiQD1xW+8xNLnRLsCxnjO98QOgx//1CF4p575tJci6/jNV/rJ4E YEKa3HRdusvcrD2UPQmlCPtdaf75HNgK/r6jFIt0GUCXnKAjcprDMyZk0fAcKkRY8Lng ZZWjMWB9F6bOtWq7PEx6FAptd/X3yPGoMvFC0B3NuoyZ+4wE7L5YRPP/oMUqVk12NfEM 7QppygUbNvtAeDvRfQdSYXtX6nmgVYTDyVcLKD7AfQG8BbhcHvRQMYGmcfKI83pCqP9m TbcILHpOQkqnKBdSHvHMqC8ii2h4QBoGIrs7txDdON+H5OvzJHEj4YboDj+Lb8MMxib2 WClw== X-Gm-Message-State: AOAM532UseZT8o+uv570tIInjAdLDWTwGcvEyi9iN3+ZngxCeTGcaBtY T6+p63ThId9pCItjyk43eYvdSuubBhufnRDKX5OdQzuB X-Received: by 2002:a05:651c:1293:: with SMTP id 19mr4299748ljc.427.1597211315219; Tue, 11 Aug 2020 22:48:35 -0700 (PDT) MIME-Version: 1.0 References: <1595333413-30052-1-git-send-email-sumit.garg@linaro.org> <20200811135801.GA416071@kroah.com> <20200811145816.GA424033@kroah.com> In-Reply-To: <20200811145816.GA424033@kroah.com> From: Sumit Garg Date: Wed, 12 Aug 2020 11:18:23 +0530 Message-ID: Subject: Re: [RFC 0/5] Introduce NMI aware serial drivers To: Greg Kroah-Hartman Cc: Daniel Thompson , Douglas Anderson , linux-serial@vger.kernel.org, kgdb-bugreport@lists.sourceforge.net, Jiri Slaby , Russell King - ARM Linux admin , Jason Wessel , Linux Kernel Mailing List , linux-arm-kernel 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 On Tue, 11 Aug 2020 at 20:28, Greg Kroah-Hartman wrote: > > On Tue, Aug 11, 2020 at 07:59:24PM +0530, Sumit Garg wrote: > > Hi Greg, > > > > Thanks for your comments. > > > > On Tue, 11 Aug 2020 at 19:27, Greg Kroah-Hartman > > wrote: > > > > > > On Tue, Aug 11, 2020 at 07:20:26PM +0530, Sumit Garg wrote: > > > > On Tue, 21 Jul 2020 at 17:40, Sumit Garg wrote: > > > > > > > > > > Make it possible for UARTs to trigger magic sysrq from an NMI. With the > > > > > advent of pseudo NMIs on arm64 it became quite generic to request serial > > > > > device interrupt as an NMI rather than IRQ. And having NMI driven serial > > > > > RX will allow us to trigger magic sysrq as an NMI and hence drop into > > > > > kernel debugger in NMI context. > > > > > > > > > > The major use-case is to add NMI debugging capabilities to the kernel > > > > > in order to debug scenarios such as: > > > > > - Primary CPU is stuck in deadlock with interrupts disabled and hence > > > > > doesn't honor serial device interrupt. So having magic sysrq triggered > > > > > as an NMI is helpful for debugging. > > > > > - Always enabled NMI based magic sysrq irrespective of whether the serial > > > > > TTY port is active or not. > > > > > > > > > > Currently there is an existing kgdb NMI serial driver which provides > > > > > partial implementation in upstream to have a separate ttyNMI0 port but > > > > > that remained in silos with the serial core/drivers which made it a bit > > > > > odd to enable using serial device interrupt and hence remained unused. It > > > > > seems to be clearly intended to avoid almost all custom NMI changes to > > > > > the UART driver. > > > > > > > > > > But this patch-set allows the serial core/drivers to be NMI aware which > > > > > in turn provides NMI debugging capabilities via magic sysrq and hence > > > > > there is no specific reason to keep this special driver. So remove it > > > > > instead. > > > > > > > > > > Approach: > > > > > --------- > > > > > > > > > > The overall idea is to intercept serial RX characters in NMI context, if > > > > > those are specific to magic sysrq then allow corresponding handler to run > > > > > in NMI context. Otherwise, defer all other RX and TX operations onto IRQ > > > > > work queue in order to run those in normal interrupt context. > > > > > > > > > > This approach is demonstrated using amba-pl011 driver. > > > > > > > > > > Patch-wise description: > > > > > ----------------------- > > > > > > > > > > Patch #1 prepares magic sysrq handler to be NMI aware. > > > > > Patch #2 adds NMI framework to serial core. > > > > > Patch #3 and #4 demonstrates NMI aware uart port using amba-pl011 driver. > > > > > Patch #5 removes kgdb NMI serial driver. > > > > > > > > > > Goal of this RFC: > > > > > ----------------- > > > > > > > > > > My main reason for sharing this as an RFC is to help decide whether or > > > > > not to continue with this approach. The next step for me would to port > > > > > the work to a system with an 8250 UART. > > > > > > > > > > > > > A gentle reminder to seek feedback on this series. > > > > > > It's the middle of the merge window, and I can't do anything. > > > > > > Also, I almost never review RFC patches as I have have way too many > > > patches that people think are "right" to review first... > > > > > > > Okay, I understand and I can definitely wait for your feedback. > > My feedback here is this: > > > > I suggest you work to flesh this out first and submit something that you > > > feels works properly. > > :) > > > IIUC, in order to make this approach substantial I need to make it > > work with 8250 UART (major serial driver), correct? As currently it > > works properly for amba-pl011 driver. > > Yes, try to do that, or better yet, make it work with all serial drivers > automatically. I would like to make serial drivers work automatically but unfortunately the interrupt request/ handling code is pretty specific to the corresponding serial driver. BTW, I will look for ways how we can make it much easier for serial drivers to adapt. -Sumit > > thanks, > > greg k-h