From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEE53C48BE5 for ; Wed, 23 Jun 2021 17:30:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A5B2F608FE for ; Wed, 23 Jun 2021 17:30:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5B2F608FE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7ccyADzsSNLqbUtVB7FxqzkPcReETfHBNqSw6vwsneg=; b=eJPVeI+VN9GrXm GLYZB3kdCxCziKdqDceaLD4ojQcSKfjJcXfp4XkhmhH+M/gjQuU5otcCSmyWUwD6lHEPIELPBhhZ0 CxKYRgELzLVFFjfERggmvIK3rg9InSxb5h46KS0xr/vdJ9e53JTiiafueQvPVaTZVw3oGk/M7l2PD dfzH+eNlZLicvmKDe88C6azmzJs+UDVJhh25V36y5dApNjOEFSF+ZPhzLcpz4o9x0cPOkWVhg0kGK 11TbqBMqQB/F641wXLXDY3QOVOF7aC4dZ8xlqd/E/pPPVVks0Nng/8TmL+ulcVp+gV3/sKH6tInNz VGfrnhGewi6C5iDbLVlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw6gG-00BOjO-8l; Wed, 23 Jun 2021 17:28:52 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw6gB-00BOi6-Rp for linux-arm-kernel@lists.infradead.org; Wed, 23 Jun 2021 17:28:49 +0000 Received: by mail-lf1-x12d.google.com with SMTP id f30so5468269lfj.1 for ; Wed, 23 Jun 2021 10:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F/vUEwxy90Jyy7FMebdqoObUzJ3pmM2D9gxlfjjbcKQ=; b=TKzKGcBbX+ngqWx+kD0QeNv2Zi3w6KLcMiZbHxJ66bOajlhh/PSJsPh1YFF0rFwySb OhjcEkBvjYXERgo8Bjr4tj0QwbWRc3NjO8/+fL/qlome64TyHL87d/es4MWJuz3/lX7j lZDqU1wg+T0qtaZIq45ttbRUw+cfOwr+ShMjNDgA6QLkWfkJw0Weae2eBMsHTcszUeL8 XdOhUiPOaBMM+JehU1ju3fB9+bPlRaQYs3zKqD8VMfxUJ4q6IDKas/M9POkhNfW2xfXu 63Lj/R6VD3HElc4W0gCAR/rxmxNL/9GBQZ0x2M/m56u0EX3WY+IN/p7p88BVRFkET/nq oTDQ== 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=F/vUEwxy90Jyy7FMebdqoObUzJ3pmM2D9gxlfjjbcKQ=; b=EYVsdFNGGdv18BwwelHA6xrbOHwIoOV+1HlO8uUumT0epAFhLpLIEguVGcLfEJ1p9B KUiQ93ahJlzyFSDLSKM7fdrHBmzqh6Eskvw9fLTw1jyPtkBINOMyISGOv5jtGuYkdo6S 8nLOYxUD4GMJw93cJDHhP9To4+BdSRLfZCU5TUOQVBluDI+bXvrIR5mx944KwkfMxzg8 XoQg2B8gtqIe/wdVnQW6AZGbRhouQaJlij1SubznSCtPk9g8Q6vP+glgQNZaYJnuuawW wQsyxqbxAIC25ZmkaOyovTY1+fV9K+i5A8iofejU6f9wvP1Se0NbYkAmpBWYXiALX4nj menA== X-Gm-Message-State: AOAM532tlIlqKgOYBPonU0rTF70wHsQzFEZ5Mh1D7/37sdVlCZOxtLUf wTPZg68LP4AiBvZ3GQQxnDo97OQNV90RrjDICoWmtg== X-Google-Smtp-Source: ABdhPJxvJDjQTCESK0tRERkzUu8Pe7SBp+bxYBC14IFybM5WsbzZMhHiRxg8c5NTAxXsI0Hi4+a5u3rAbQBxLezVnXI= X-Received: by 2002:a05:6512:1390:: with SMTP id p16mr505946lfa.597.1624469320848; Wed, 23 Jun 2021 10:28:40 -0700 (PDT) MIME-Version: 1.0 References: <20201124141449.572446-1-maz@kernel.org> <20201124141449.572446-3-maz@kernel.org> In-Reply-To: <20201124141449.572446-3-maz@kernel.org> From: Todd Kjos Date: Wed, 23 Jun 2021 10:28:26 -0700 Message-ID: Subject: Re: [PATCH v2 2/6] genirq: Allow an interrupt to be marked as 'raw' To: Marc Zyngier Cc: LAK , linux-kernel , Will Deacon , Catalin Marinas , Thomas Gleixner , Valentin Schneider , Peter Zijlstra , Mark Rutland , Russell King , Android Kernel Team X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210623_102847_948217_4A53B949 X-CRM114-Status: GOOD ( 35.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Nov 24, 2020 at 6:15 AM Marc Zyngier wrote: > > Some interrupts (such as the rescheduling IPI) rely on not going through > the irq_enter()/irq_exit() calls. To distinguish such interrupts, add > a new IRQ flag that allows the low-level handling code to sidestep the > enter()/exit() calls. > > Only the architecture code is expected to use this. It will do the wrong > thing on normal interrupts. Note that this is a band-aid until we can > move to some more correct infrastructure (such as kernel/entry/common.c). > > Signed-off-by: Marc Zyngier > --- > include/linux/irq.h | 2 ++ > kernel/irq/Kconfig | 3 +++ > kernel/irq/debugfs.c | 1 + > kernel/irq/irqdesc.c | 17 ++++++++++++----- > kernel/irq/settings.h | 15 +++++++++++++++ > 5 files changed, 33 insertions(+), 5 deletions(-) > > diff --git a/include/linux/irq.h b/include/linux/irq.h > index c55f218d5b61..605ba5949255 100644 > --- a/include/linux/irq.h > +++ b/include/linux/irq.h > @@ -72,6 +72,7 @@ enum irqchip_irq_state; > * mechanism and from core side polling. > * IRQ_DISABLE_UNLAZY - Disable lazy irq disable > * IRQ_HIDDEN - Don't show up in /proc/interrupts > + * IRQ_RAW - Skip tick management and irqtime accounting > */ > enum { > IRQ_TYPE_NONE = 0x00000000, > @@ -99,6 +100,7 @@ enum { > IRQ_IS_POLLED = (1 << 18), > IRQ_DISABLE_UNLAZY = (1 << 19), > IRQ_HIDDEN = (1 << 20), > + IRQ_RAW = (1 << 21), > }; > > #define IRQF_MODIFY_MASK \ > diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig > index 164a031cfdb6..ae9b13d5ee91 100644 > --- a/kernel/irq/Kconfig > +++ b/kernel/irq/Kconfig > @@ -109,6 +109,9 @@ config GENERIC_IRQ_MATRIX_ALLOCATOR > config GENERIC_IRQ_RESERVATION_MODE > bool > > +config ARCH_WANTS_IRQ_RAW > + bool > + > # Support forced irq threading > config IRQ_FORCED_THREADING > bool > diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c > index e4cff358b437..f53475d88072 100644 > --- a/kernel/irq/debugfs.c > +++ b/kernel/irq/debugfs.c > @@ -140,6 +140,7 @@ static const struct irq_bit_descr irqdesc_states[] = { > BIT_MASK_DESCR(_IRQ_IS_POLLED), > BIT_MASK_DESCR(_IRQ_DISABLE_UNLAZY), > BIT_MASK_DESCR(_IRQ_HIDDEN), > + BIT_MASK_DESCR(_IRQ_RAW), > }; > > static const struct irq_bit_descr irqdesc_istates[] = { > diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c > index 1a7723604399..f5beee546a6f 100644 > --- a/kernel/irq/irqdesc.c > +++ b/kernel/irq/irqdesc.c > @@ -667,10 +667,9 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, > { > struct pt_regs *old_regs = set_irq_regs(regs); > unsigned int irq = hwirq; > + struct irq_desc *desc; > int ret = 0; > > - irq_enter(); > - > #ifdef CONFIG_IRQ_DOMAIN > if (lookup) > irq = irq_find_mapping(domain, hwirq); > @@ -680,14 +679,22 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq, > * Some hardware gives randomly wrong interrupts. Rather > * than crashing, do something sensible. > */ > - if (unlikely(!irq || irq >= nr_irqs)) { > + if (unlikely(!irq || irq >= nr_irqs || !(desc = irq_to_desc(irq)))) { I see a checkpatch error here: ERROR:ASSIGN_IN_IF: do not use assignment in if condition #96: FILE: kernel/irq/irqdesc.c:682: > ack_bad_irq(irq); > ret = -EINVAL; > + goto out; > + } > + > + if (IS_ENABLED(CONFIG_ARCH_WANTS_IRQ_RAW) && > + unlikely(irq_settings_is_raw(desc))) { > + generic_handle_irq_desc(desc); > } else { > - generic_handle_irq(irq); > + irq_enter(); > + generic_handle_irq_desc(desc); > + irq_exit(); > } > > - irq_exit(); > +out: > set_irq_regs(old_regs); > return ret; > } > diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h > index 51acdf43eadc..0033d459fdac 100644 > --- a/kernel/irq/settings.h > +++ b/kernel/irq/settings.h > @@ -18,6 +18,7 @@ enum { > _IRQ_IS_POLLED = IRQ_IS_POLLED, > _IRQ_DISABLE_UNLAZY = IRQ_DISABLE_UNLAZY, > _IRQ_HIDDEN = IRQ_HIDDEN, > + _IRQ_RAW = IRQ_RAW, > _IRQF_MODIFY_MASK = IRQF_MODIFY_MASK, > }; > > @@ -33,6 +34,7 @@ enum { > #define IRQ_IS_POLLED GOT_YOU_MORON > #define IRQ_DISABLE_UNLAZY GOT_YOU_MORON > #define IRQ_HIDDEN GOT_YOU_MORON > +#define IRQ_RAW GOT_YOU_MORON > #undef IRQF_MODIFY_MASK > #define IRQF_MODIFY_MASK GOT_YOU_MORON > > @@ -180,3 +182,16 @@ static inline bool irq_settings_is_hidden(struct irq_desc *desc) > { > return desc->status_use_accessors & _IRQ_HIDDEN; > } > + > +static inline bool irq_settings_is_raw(struct irq_desc *desc) > +{ > + if (IS_ENABLED(CONFIG_ARCH_WANTS_IRQ_RAW)) > + return desc->status_use_accessors & _IRQ_RAW; > + > + /* > + * Using IRQ_RAW on architectures that don't expect it is > + * likely to be wrong. > + */ > + WARN_ON_ONCE(1); > + return false; > +} > -- > 2.28.0 > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel