Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp268010rwb; Thu, 10 Nov 2022 00:05:45 -0800 (PST) X-Google-Smtp-Source: AMsMyM5fJQI7PLVUsAfNe5XDSPeOsodiLTE8Uvk8OnzcqN0zorPeHGW3F1XBxwMB6XSugqIb57gi X-Received: by 2002:aa7:ccd1:0:b0:450:fb10:fdec with SMTP id y17-20020aa7ccd1000000b00450fb10fdecmr1842648edt.339.1668067544695; Thu, 10 Nov 2022 00:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668067544; cv=none; d=google.com; s=arc-20160816; b=vwB42I/s6JHrMo393omn93coTUqZrDYnKC9xrHXPuEi+L8v4KHoHPLorW3YsYv8kl4 jTd9nYoWCv5OF2g2C86cq/OaSU0RtitBGtSzbOv9CMYzyDcXM9M+PvQSHczSB4R7Yhzn ZKLuWV2y9oNGVn9LCoY3RI3yR7oAkn9DBU+DWGDKT0i2qbxWTDx4IjVOtSV91gQHxHS1 KvqV/FAqLRNNAhRebQ9vIQ34EZDQb/PPDttntcx74rowIU3a6Xd5StrtIuGmuYRib3v/ YBpaUBSxncyo+4iDPN9Wd7IkMnTeHIayVFKj2TTWHrXWg5a65DCrZilWVNzvtgeNjVZV 2msg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=0CvVCwNRmw0Ax41QbzZCQ8W/rW9vcKNb6SxCt6J9skU=; b=S0YT1ROjvk+rqzwRKkG9V80+NdFLf5arZyP2Pa6bPF7LRi7GTLasfBpXQ6KHrgj8PL hMks9Tt3wN0fLY/JEfh07MvWDS+jl5H/EiEMFD7uCIB5oLv/nwhAu/FE/zLfLNIO61aa GHmsseroCQTv8B2ZSgaXPvpZDinybfTtxKeWhkc8TB0roOVyL8qCFjK/+SDn3877ZlBc WRG7zKQ1X3LVqkPXXnaV0oEbdjrWNFJAdCxto8v4pZsAlmVimH3ZbRcOeWoh0hTBD6Mf GRRUzx3C2DvV8vjyZkElzU+9wbu6GEO9QIPmuowUhrcQ/CY4iOuoRu5z1rhnqWbsgbWV N8iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mlg3WM6C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y8-20020a056402270800b0045d539f05a8si20136937edd.576.2022.11.10.00.05.21; Thu, 10 Nov 2022 00:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mlg3WM6C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbiKJHz3 (ORCPT + 93 others); Thu, 10 Nov 2022 02:55:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232607AbiKJHz2 (ORCPT ); Thu, 10 Nov 2022 02:55:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3742323142 for ; Wed, 9 Nov 2022 23:55:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9404161DAE for ; Thu, 10 Nov 2022 07:55:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5552C433D6; Thu, 10 Nov 2022 07:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668066926; bh=zueNbw+jPJTDWHCg8mwDS8nIwETIt+nDl7eJklC7Ipk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mlg3WM6Cn+trZxeUjquZK4DcP8Zfp4sf25FroXLLO0vl2RF5FGJh3Vd19XtxJRsON 6u7Zg/I99FSvcJacwNIsIaGIJ5sE0uxhHfqpwl+iPx3PwVRw9lE24FF17g7S46soVi sboO3SGu1z6+XU05YjofYbw+HWr7MWq5a5NIZvuwdjTj6y8DQtjrfmWAWddIoA4eqM IB2tU0A4Vw2bv4UUvNhNuFvgdzXeG4LvoVYKfDjpy/K8UUfddkNlYrLE7dtW1aMqE3 Bs5XPPUkzCdCLHGA6T/XF34soptCmow2iQlQ6uW7K9+iwEp0CKMAHh/Ux9nH0u2M8N 0NMJdAcnGkvJQ== Received: from ip-185-104-136-29.ptr.icomera.net ([185.104.136.29] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ot2PD-00562k-D6; Thu, 10 Nov 2022 07:55:23 +0000 Date: Thu, 10 Nov 2022 07:54:54 +0000 Message-ID: <87o7tfutv5.wl-maz@kernel.org> From: Marc Zyngier To: Mukesh Ojha Cc: , , , Thomas Gleixner , lkml Subject: Re: Query on handling some special Group0 interrupt in Linux In-Reply-To: <8d6f41f6-96ae-2f34-4bc7-58b63bf55159@quicinc.com> References: <86tu38oupr.wl-maz@kernel.org> <8d6f41f6-96ae-2f34-4bc7-58b63bf55159@quicinc.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.104.136.29 X-SA-Exim-Rcpt-To: quic_mojha@quicinc.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 09 Nov 2022 19:57:24 +0000, Mukesh Ojha wrote: > > Hi Marc, > > Thanks for your reply. > > On 11/9/2022 11:50 PM, Marc Zyngier wrote: > > On Wed, 09 Nov 2022 16:20:35 +0000, > > Mukesh Ojha wrote: > >> > >> Hi, > >> > >> I was working on a use case where both el2/el3 are implemented and we > >> have a watchdog interrupt (SPI), which is used for detecting software > >> hangs and cause device reset; If that interrupt's current cpu affinity > >> is on a core, where interrupts are disabled, we won't be able to serve > >> it or if this interrupt comes on a core which has interrupt enabled, > >> calling panic() or with smp_send_stop(), we would not be able > >> to know the call stack of the other cores which is running with > >> interrupt disabled. > >> > >> I was thinking of configuring both a watchdog irq(SPI) and IPI_STOP > >> (SGI) or any reserve IPI as an FIQ. And from the watchdog irq handler, > >> I was thinking of calling panic() which eventually sends IPI_STOP(SGI > >> FIQ) to all the cores. And with this we will able to dump all the core > >> call stack. > >> > >> I am able to achieve this but wanted to know if this is acceptable to > >> the community to support/allow such use cases like above and enable > >> group0 interrupt from GIC for some special use cases. > > > > For a start, we only deal with Group-1 interrupts in Linux. Group-0 > > interrupts are for the firmware, and we really don't want to see them > > (this is consistent with your HW having EL3). > > What is the downside of it we support this ? I see one of the > implementation here. > > https://elixir.bootlin.com/linux/v6.0.7/source/drivers/irqchip/irq-apple-aic.c#L510 You do realise that this system doesn't even have a GIC, and only uses FIQ to represent per-CPU interrupts, right? > > > We also mask IRQ and FIQ at the same time, so this is a non-starter. > This can be taken care if we support this. No. We've made the decision not to treat IRQ and FIQ differently, because FIQ only matters for systems with a single security domain such as VMs or wonky systems such as the above. With that, all systems behave the same and are treated the same, making the rules for interrupt preemption understandable and we don't have to think of IRQ and FIQ racing with each other. > > > > > If you want to be able to deliver an interrupt while the interrupts > > are masked, what you are looking for is the NMI framework, for which > > you can register SPIs as (pseudo-)NMI. > > Yes, kind of NMI. I have already looked into this. Since, in our > system El2 is implemented and each physical interrupt get routed to > hypervisor and later vIrq comes to El1 and each interrupt > enable/disable call exercise pmr register trap can cause latency in > regular run(like multiple VM). Then your hypervisor needs fixing. There is no need to trap accesses to PMR. Also, PMR being per-CPU, there should be no extra overhead depending on the number of VM even if you were trapping PMR (for example to work around broken HW). To sum it up, none of the above makes much sense to me. > Since, some of the use-case could be special like i have mentioned > in my initial mail where such interrupt will be fatal and system will > get reset after that. I am not able to think of any other use case than > this but can this not be considered as one of the feature. Well, we don't add stuff to the kernel based on idle considerations, and what you are describing so far matches 100% the requirement for an NMI-like feature. The architecture has two ways to implement almost-NMIs: interrupt priorities (our current crop of pseudo-NMIs) and the ARMv8.8 FEAT_NMI. The former is already there, and there are patches on the list for the latter. Do we need a third way that only works for odd corner cases and that adds a huge amount of complexity? No, thank you. M. -- Without deviation from the norm, progress is not possible.