Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp491852pxa; Tue, 11 Aug 2020 08:01:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUH3thdCIOKn/YMTsFRKoFgoUAOt+yLTSAUsTKnUwboCcXBXig+W4HVPzg9wh01PJxuzaq X-Received: by 2002:a17:906:6d91:: with SMTP id h17mr25733157ejt.531.1597158100466; Tue, 11 Aug 2020 08:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597158100; cv=none; d=google.com; s=arc-20160816; b=tIayNlXcpCDC3Vcbz2Ock6SS/s8OMD+o5OqwE0aifnuthACHYQOrX6OIQ28JMM+Ojx rpg8qaxP7UrPN89GQvJO4lTr0+wsSJGRXSAUTYqLyqKyFpUCBQk/h6lpl5qxVUlXMXn7 nn4GMivWsfVhSK9YHMrCPWyNqmp4xGJ3ptxD1449KlyTq4bT6iZoLA8RY2XgUM6dDtxN siBC3VF78UXv8m5oU5RZEXxDSeptofzBENeLwTWNUzZ633xFZ+qqtsKkyUElGQ0pCUhh 2gqo71jXJb88ADW6l4ZoyzouGDGHSfInEjudnt2SOngfmYGy1tjKf5KoLzkZSWhavUUV gBFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=pMVMIVZdSsNdrrDyPVGa8T7XqBMG4EGBCA1UO46U3jY=; b=jYpK6qy+AjV8mLlr+gfI4NGBV+rm/boh+JS3LK7brL2WdyIUognMLhQ7KPVXt+Uw+O kLEKZfH2d1dp4uX1WTLbNjQIk6lKD42mq2J4WkkFIk694yi+CmIylmyqbV0OuzcgIFEl K/otNbDCAi89Kjs16cpmtMV0Ro606C1pjquZn/xowob/Wt8ykRrkxJCB2cAZB1qT0FPJ rvqQYVpG6PDCSGXl6OlW8w6cBhz/7b8dvcMUHmn/aonC4gmSsTegNglD4zdait4JxGua FvKruAKdbIyl+Ix8NDNukbkgIs/3kDlKgAGhi2iFmFJe67cHOqRmlqxVFfSkEIR7vLfa eFEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HKhalOQM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si12634706edy.237.2020.08.11.08.01.15; Tue, 11 Aug 2020 08:01:40 -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=@kernel.org header.s=default header.b=HKhalOQM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728833AbgHKO6J (ORCPT + 99 others); Tue, 11 Aug 2020 10:58:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:57856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728788AbgHKO6I (ORCPT ); Tue, 11 Aug 2020 10:58:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5D872076C; Tue, 11 Aug 2020 14:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597157887; bh=rpjJYDNyUBJye/pKJy8+A0p0IjypBh/1eTDNkuQVops=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HKhalOQMVaEdBkBATPK3DlaVPy3dsufQphPHD8qF1tXlhOeoUlrWjyw9RvLs3Yqx/ R8vgpRuviQTFGJZ8KVdnpRtGlNtOIwsirOSFeDfIFXshjHzDVq1nnHrOnpg5FaCE3C 7jfYOkaLBoTQBGGebtEeUf1liV8Q3b7Ld5r1gPzs= Date: Tue, 11 Aug 2020 16:58:16 +0200 From: Greg Kroah-Hartman To: Sumit Garg 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 Subject: Re: [RFC 0/5] Introduce NMI aware serial drivers Message-ID: <20200811145816.GA424033@kroah.com> References: <1595333413-30052-1-git-send-email-sumit.garg@linaro.org> <20200811135801.GA416071@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. thanks, greg k-h