Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3380737imu; Mon, 28 Jan 2019 04:00:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN72fpx8A6DKh/jFrPwozZCRdFdl7VfHom9yKshrbXu/pTW8ll0SyUZuX6eo0mCc9zpBfpVt X-Received: by 2002:a17:902:142:: with SMTP id 60mr22177422plb.330.1548676831394; Mon, 28 Jan 2019 04:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548676831; cv=none; d=google.com; s=arc-20160816; b=s6odnBuLlT7b3Uo6e9k1MSK3+pLwKx1Y5+pknqQdGoWdMzg1sbuELbh+jzBr/QtzR7 k93zvKRrQHHNIUGiaSf9lFuHHjtnVO7V4ktF7CfslYjZ36zvrKeMplQgKLq8FfgWnTun LEGqwQyUjRaFAmq1tPTfN1jigsQAsj3yuiK59fXfEaTHpz+R1xEzJnztqcnlvig+uJGf fw7TMDYXoFIhl0wdzB4H24pEm2Jr0fwK5FCvrLibfqgK1RtGQRCo64PLmfZMM9Co0yQe emZUql3BW8/1JGFH4y03pV8eNubR4mYzJOO02LGaSP34rJ9VW3XAbNzoUj7F0H4iwI8Y HkrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:user-agent :references:in-reply-to:subject:cc:to:from:message-id:date; bh=pG1IFfZSv5cDdnejY2a1TrskrUyhnGOQS/57GTLItRQ=; b=SfAPuDiIDg4oUbz3LYPrQ80PGfMWuUQiNbHdrT1uabH5swRl+p9JPcIFF9KY+ZOk1f AXVXqOfjpltvhj9oR+5eC29Jm0Ecazss9hWQxgkLuifa/WQzMtID4si013wOx5iEm+b7 SMp9g9hTA5n5xmCfEEt0BcxdquIKoXh06Kn8Y5QixihU3EbMAuhbNF+bdz0iksp+d8Fz qkk7B2/LD+KZug3EYx6aWje0hGOTKOu07iLvXLwFwZnj25I62Xd36M2hhjA5Tzpqtlhx qEBaVpK8nfSvVoPT7fyMlPl7dJn/+2974MA2TZOZLRqpsbCIm4PBV0BiIAd3zHyJ+te6 GH8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f81si13833101pfh.33.2019.01.28.04.00.15; Mon, 28 Jan 2019 04:00:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726805AbfA1L7i (ORCPT + 99 others); Mon, 28 Jan 2019 06:59:38 -0500 Received: from foss.arm.com ([217.140.101.70]:44210 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726648AbfA1L7i (ORCPT ); Mon, 28 Jan 2019 06:59:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D896EBD; Mon, 28 Jan 2019 03:59:37 -0800 (PST) Received: from big-swifty.misterjones.org (big-swifty.cambridge.arm.com [10.1.39.122]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B19DB3F59C; Mon, 28 Jan 2019 03:59:34 -0800 (PST) Date: Mon, 28 Jan 2019 11:59:36 +0000 Message-ID: <86wompuh5j.wl-marc.zyngier@arm.com> From: Marc Zyngier To: Julien Thierry Cc: , , , , , , , , , Thomas Gleixner , Jason Cooper Subject: Re: [PATCH v9 20/26] irqchip/gic-v3: Handle pseudo-NMIs In-Reply-To: <1548084825-8803-21-git-send-email-julien.thierry@arm.com> References: <1548084825-8803-1-git-send-email-julien.thierry@arm.com> <1548084825-8803-21-git-send-email-julien.thierry@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 EasyPG/1.0.0 Emacs/25.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Organization: ARM Ltd MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 21 Jan 2019 15:33:39 +0000, Julien Thierry wrote: > > Provide a higher priority to be used for pseudo-NMIs. When such an > interrupt is received, keep interrupts fully disabled at CPU level to > prevent receiving other pseudo-NMIs while handling the current one. > > Signed-off-by: Julien Thierry > Cc: Thomas Gleixner > Cc: Jason Cooper > Cc: Marc Zyngier > --- > drivers/irqchip/irq-gic-v3.c | 42 ++++++++++++++++++++++++++++++++++++------ > 1 file changed, 36 insertions(+), 6 deletions(-) > > diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c > index 5374b43..4df1e94 100644 > --- a/drivers/irqchip/irq-gic-v3.c > +++ b/drivers/irqchip/irq-gic-v3.c > @@ -41,6 +41,8 @@ > > #include "irq-gic-common.h" > > +#define GICD_INT_NMI_PRI (GICD_INT_DEF_PRI & ~0x80) > + > #define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0) > > struct redist_region { > @@ -381,12 +383,45 @@ static u64 gic_mpidr_to_affinity(unsigned long mpidr) > return aff; > } > > +static inline void gic_deactivate_unexpected_irq(u32 irqnr) Same remark as on some other patches: you should be able to drop the inline attribute without any ill effect. I'd also like this to be renamed "gic_deactivate_spurious", or something similar. > +{ > + if (static_branch_likely(&supports_deactivate_key)) { > + if (irqnr < 8192) > + gic_write_dir(irqnr); > + } else { > + gic_write_eoir(irqnr); > + } > +} > + > +static inline void gic_handle_nmi(u32 irqnr, struct pt_regs *regs) > +{ > + int err; > + > + if (static_branch_likely(&supports_deactivate_key)) > + gic_write_eoir(irqnr); > + /* > + * Leave the PSR.I bit set to prevent other NMIs to be > + * received while handling this one. > + * PSR.I will be restored when we ERET to the > + * interrupted context. > + */ > + err = handle_domain_nmi(gic_data.domain, irqnr, regs); So this is the point where we start having a dependency on the NMI series. We definitely need to start talking merge strategy. > + if (err) > + gic_deactivate_unexpected_irq(irqnr); > +} > + > static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs) > { > u32 irqnr; > > irqnr = gic_read_iar(); > > + if (gic_supports_nmi() && > + unlikely(gic_read_rpr() == GICD_INT_NMI_PRI)) { > + gic_handle_nmi(irqnr, regs); > + return; > + } > + > if (gic_prio_masking_enabled()) { > gic_pmr_mask_irqs(); > gic_arch_enable_irqs(); > @@ -403,12 +438,7 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs > err = handle_domain_irq(gic_data.domain, irqnr, regs); > if (err) { > WARN_ONCE(true, "Unexpected interrupt received!\n"); > - if (static_branch_likely(&supports_deactivate_key)) { > - if (irqnr < 8192) > - gic_write_dir(irqnr); > - } else { > - gic_write_eoir(irqnr); > - } > + gic_deactivate_unexpected_irq(irqnr); > } > return; > } > -- > 1.9.1 > With the above addressed, Acked-by: Marc Zyngier M. -- Jazz is not dead, it just smell funny.