Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3502665ybt; Tue, 23 Jun 2020 04:03:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx04dhHcPCfrngQ3KbbncEo6m1Lz3hYi3sGOTaZI1GVBAwOoJn1cdfjBNtbuF+UnEdjTGwN X-Received: by 2002:a05:6402:1604:: with SMTP id f4mr22012217edv.379.1592910184547; Tue, 23 Jun 2020 04:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592910184; cv=none; d=google.com; s=arc-20160816; b=cLW+LQEiZPUaPyRWAWa121yHVpJ7xzTtIRL7GjKfxppJ0EVIOob/dM+me5R6/J7DcF 4dKD/DEi1xcQ2DF4CeXY0uPsCghIyuZtz6hUhSkOYdLeZozBmsFO8taN7ir0wFDOL15z pTMeGXrAuY/Mh4WGdm1Zzd9NAVuuOK3eURG/09tP0nVXjipWRd1i52wotrgeb45Q0cUd wTGVD3NrNxl0UhuX7Rfrc+7E7S5AyTlMtbwxqP/J3MZmMYF/3hBBQpALJMKUEbQJKoBV AVyWV6Rqo1zhOTloIY59BuFnkPCJsgue/d8JX0MHGK+5lBXts1kCkoBOul+zJCW1LxHO BHGA== 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=lGrEtcs91+dxyWalZ+ucVAHOrATgVM2zxSzA1+acQg4=; b=voCcCdbMH9Ens5SdcxkWTZ6Xj61FmejbK7aMdxvCWooMBwDPt6NjCfS0bWQQRpHS+Z kNSnYy0wGNl4m3osiPLljq5Fbhr0sJqrNoneMAOvFxBO3zGvWe+oYXxAYJPQDVGclkJA A9BALXmbCcyUItSJuUtLFjVMrJ+28hLz8s4TMgw0c+aJG2wl1pgducfR1wCRug2mqZ6K mXbVU4wZo0W6NtBmw6ZAy/4Xv/lAJg7dCTaais3hH43Wv1VLRsyvuzpjCP93ZlW4wUUH Zp2RMHBjAelpBUQyXJTWu4Kk6LsDN+kObcmeR896IvQfYP6KK3YWvYP4VNunWjysVc1Y dS3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H9tF1WoM; 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 d11si4995487edz.263.2020.06.23.04.02.40; Tue, 23 Jun 2020 04:03: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=H9tF1WoM; 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 S1732281AbgFWK7j (ORCPT + 99 others); Tue, 23 Jun 2020 06:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732205AbgFWK7i (ORCPT ); Tue, 23 Jun 2020 06:59:38 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7446EC061573 for ; Tue, 23 Jun 2020 03:59:38 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id b6so20028764wrs.11 for ; Tue, 23 Jun 2020 03:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=lGrEtcs91+dxyWalZ+ucVAHOrATgVM2zxSzA1+acQg4=; b=H9tF1WoMJP6k1NhpjSlDkwABW022ARCBuOHBY6yhnzmiwSYAqbykNym7cUXNasMT6u SYH/QYLJSJCrr7CUmwv3aXRdFcmgJW2Gwwoo/xASmrm9OFhDpLub4rC2K+bd74NpkQHq lWG+gh76ybsLiaR1BwWhYVJXsHOk/KBdAQs8UIbricQv/yRTIZiqpSFXfBkzvln0Ctsb vjT2M8VyzVD2irhFN8vj2aPW6c+IpWbO1W4GpbeTJFqmbP06pguKaskv3AIOztQz348D c9NoaAF07LRY9pUNskKiCKuBa9lFmPvxYUuAcis9DMEgOz9pkcw6Q3JdBRixAwi3DGOE Sgmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=lGrEtcs91+dxyWalZ+ucVAHOrATgVM2zxSzA1+acQg4=; b=gwxkHUdbfvcDiatnEv/jVjjIumz8PUruUmcw6TXH9xF6xY6aFMROcYmIQ3Qq7bqvpq qcnpNWl9TQUt7eDWVIpeHGD+o0dIE8ykqhIhY0qEaeX2rfqTOdFz9YKJuLZNTSMq9zml GoEKwfZg7gNwjzwkrDbjG7gTRe188Cn3Q9e+TKCdg1DNqflnV895/sQC6O/k6RtFO0Ty SWhEMt4COGO8dBaIaMHqXOt7YtYpvH61P4ICosM4sF8GyLAPAzkAEkZg3V5Cn3HKxjqG 2mgeh3JwJRM53jQysjfCoOIJoLqE9PONVtrhuPS3/l+xCttOyUMvtNqCmPeG7T5hPLd+ 8L3Q== X-Gm-Message-State: AOAM5319dcmS/f/G1ZBDiQgzXvUccA4v6GmfrJvFIIksQy6Gt/vsKqnw BYDlBvNvNuUZLeLkmdLViHRifA== X-Received: by 2002:adf:e2ce:: with SMTP id d14mr24896468wrj.415.1592909976531; Tue, 23 Jun 2020 03:59:36 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id n19sm3176388wmi.33.2020.06.23.03.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 03:59:35 -0700 (PDT) Date: Tue, 23 Jun 2020 11:59:34 +0100 From: Daniel Thompson To: Sumit Garg Cc: kgdb-bugreport@lists.sourceforge.net, linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jason Wessel , Douglas Anderson , Jiri Slaby , Russell King - ARM Linux admin , Linux Kernel Mailing List Subject: Re: [PATCH 3/7] kgdb: Add request_nmi() to the io ops table for kgdboc Message-ID: <20200623105934.wvyidi3xgqgd35af@holly.lan> References: <1592835984-28613-1-git-send-email-sumit.garg@linaro.org> <1592835984-28613-4-git-send-email-sumit.garg@linaro.org> <20200622160300.avgfhnfkpqzqqtsr@holly.lan> 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, Jun 23, 2020 at 02:07:47PM +0530, Sumit Garg wrote: > On Mon, 22 Jun 2020 at 21:33, Daniel Thompson > wrote: > > > + irq_set_status_flags(irq, IRQ_NOAUTOEN); > > > + res = request_nmi(irq, fn, IRQF_PERCPU, "kgdboc", dev_id); > > > > Why do we need IRQF_PERCPU here. A UART interrupt is not normally > > per-cpu? > > > > Have a look at this comment [1] and corresponding check in > request_nmi(). So essentially yes UART interrupt is not normally > per-cpu but in order to make it an NMI, we need to request it in > per-cpu mode. > > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/irq/manage.c#n2112 Thanks! This is clear. > > > + if (res) { > > > + res = request_irq(irq, fn, IRQF_SHARED, "kgdboc", dev_id); > > > > IRQF_SHARED? > > > > Currrently there is nothing that prevents concurrent activation of > > ttyNMI0 and the underlying serial driver. Using IRQF_SHARED means it > > becomes possible for both drivers to try to service the same interrupt. > > That risks some rather "interesting" problems. > > > > Could you elaborate more on "interesting" problems? Er... one of the serial drivers we have allowed the userspace to open will, at best, be stone dead and not passing any characters. > BTW, I noticed one more problem with this patch that is IRQF_SHARED > doesn't go well with IRQ_NOAUTOEN status flag. Earlier I tested it > with auto enable set. > > But if we agree that both shouldn't be active at the same time due to > some real problems(?) then I can rid of IRQF_SHARED as well. Also, I > think we should unregister underlying tty driver (eg. /dev/ttyAMA0) as > well as otherwise it would provide a broken interface to user-space. I don't have a particular strong opinion on whether IRQF_SHARED is correct or not correct since I think that misses the point. Firstly, using IRQF_SHARED shows us that there is no interlocking between kgdb_nmi and the underlying serial driver. That probably tells us about the importance of the interlock than about IRQF_SHARED. To some extent I'm also unsure that kgdb_nmi could ever actually know the correct flags to use in all cases (that was another reason for the TODO comment about poll_get_irq() being a bogus API). Daniel.