Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp795053imn; Sat, 30 Jul 2022 03:27:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vBqo05KUZpKm9cwsjKf5BsoHNxGg9fnotkzcOiSS5Zsofax7b5POMXeWAS54beHMzOmkVv X-Received: by 2002:a05:6a00:a8b:b0:4cd:6030:4df3 with SMTP id b11-20020a056a000a8b00b004cd60304df3mr7292759pfl.40.1659176872455; Sat, 30 Jul 2022 03:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659176872; cv=none; d=google.com; s=arc-20160816; b=CDX/CNwhSAjN7PNu4EN/vL7peoQcRuiPlUUTmu+pm3kZ1owv/kbzT3rILb5/jY8tCZ y6G5/GqQe3nWGWWtS2jPOVyqpIlDA9ZDmQrP7aepLmnUUME6fU5GOcPOHYTN/z1LZf0i QReog5rdgvJNtFqUTl8CjNMCFDrUnJOZTjHMgV5cKoA0PPdoYMvJqkLGnho+cqDveOaR 0r6SSCnjJoTZDj/Nos1RLWLBb/OLCVJZBrSpqi1zB/GPO1pAspHRXbYD7Z96l8EE/CFY oBFIt+zxpXGRq3Gz22+MW0sUR69V2c8nru0Pb3EOxLgHirPtlCJXqukf2ydmhG5xZlG7 siKQ== 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=BclgT3CyHf3kJpiKJbw+9A0fpSQ/H3x5TjX2Qa97bxk=; b=WErUCqORDoCZKPah5dns+zJ/iCl7LE86z6fnJPccCrk7RXVLO22779+PvgKUHa8LZw lz4ItUnqEZHpZdQZFf0i2QxJtGpFbpZs5P0AjCsHxoljodjcyb9vUcCYuJ6Kt7PbO6IQ b1WPjGZ9u89PxMTTqSmabbZ0PZzI8a1CZ9Eq8mw/BqgsmmxG0KgYt+oEnakWWHtCgIpU a0tWbbuLxTEoKvd3zM/U7vO/P/uUUoI3g1i46pGY+KuQOVb59XbEDykJk7y4p3XYQM4E aXFn40t/Msgsg2bOqys509lIeI0IMTHEXQTbmhYOJZdm/wggmdv4cCFn9rlrUvr9tuIJ auMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a8eFu1NQ; 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 u17-20020a170902e5d100b0016bf943aeafsi7040551plf.28.2022.07.30.03.27.37; Sat, 30 Jul 2022 03:27:52 -0700 (PDT) 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=a8eFu1NQ; 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 S233692AbiG3J7O (ORCPT + 99 others); Sat, 30 Jul 2022 05:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231377AbiG3J7M (ORCPT ); Sat, 30 Jul 2022 05:59:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A02BC14D0D for ; Sat, 30 Jul 2022 02:59:10 -0700 (PDT) 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 1785860BF9 for ; Sat, 30 Jul 2022 09:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68265C433D6; Sat, 30 Jul 2022 09:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659175148; bh=Zj9FJ9QQfn9R7TXZrdKOHXrw9ZlPfJJ+ED/6ITiGV9c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=a8eFu1NQRRMx8AgxJpCgGFsoT0KB2iv6DAcJCbPsjNR4vuAY3fKJoNXOLNexVEIkh PuaFusIimTFz20UF7NUnmMAKwMWnUfQvjigBcTNACCiA4Y1Kd36vQXjTLeutDNdMqI 9Z1qpzpPM383EbEDnt2BkXKYRMK5f88VA5727ECceUg7DIcyGbNSYDPNvfiq6zajzu MnziO+QJRWWV0PqZnC+5rUPbxebbXXtWEZu4sJ/7sFWMO2hsnfRXaMQ5iqnLypxeGJ 0DggdoCk5w9bYyVmYUUl3ah5fnd2mAnzLgBPxEPlA/pnQgshGKsVKEL1JHkLjNEhm9 53cjRq0CAPOXw== Received: from sofa.misterjones.org ([185.219.108.64] 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 1oHjFR-00B1VW-Vx; Sat, 30 Jul 2022 10:59:06 +0100 Date: Sat, 30 Jul 2022 10:59:05 +0100 Message-ID: <87wnbuc45y.wl-maz@kernel.org> From: Marc Zyngier To: Daniel Walker Cc: Thomas Gleixner , George Cherian , sgoutham@marvell.com, "BOBBY Liu (bobbliu)" , xe-linux-external@cisco.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] genirq: allow selection of number of sparse irqs In-Reply-To: <20220729182156.GS821407@zorba> References: <20220728030420.2279713-1-danielwa@cisco.com> <980a561ed87c5530aab2e2b067074862@kernel.org> <20220729182156.GS821407@zorba> 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.219.108.64 X-SA-Exim-Rcpt-To: danielwa@cisco.com, tglx@linutronix.de, george.cherian@marvell.com, sgoutham@marvell.com, bobbliu@cisco.com, xe-linux-external@cisco.com, 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.7 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 Fri, 29 Jul 2022 19:21:56 +0100, Daniel Walker wrote: > > On Thu, Jul 28, 2022 at 09:52:18AM +0100, Marc Zyngier wrote: > > On 2022-07-28 04:04, Daniel Walker wrote: > > > Currently the maximum number of interrupters is capped at 8260 (64 + > > > 8196) in most of the architectures were CONFIG_SPARSE_IRQ is selected. > > > This upper limit is not sufficient for couple of existing SoC's from > > > Marvell. > > > For eg: Octeon TX2 series of processors support a maximum of 32K > > > interrupters. > > > > > > Allow configuration of the upper limit of the number of interrupts. > > > > > > Cc: George Cherian > > > Cc: sgoutham@marvell.com > > > Cc: "BOBBY Liu (bobbliu)" > > > Cc: xe-linux-external@cisco.com > > > Signed-off-by: Daniel Walker > > > --- > > > kernel/irq/Kconfig | 23 +++++++++++++++++++++++ > > > kernel/irq/internals.h | 10 +++++++++- > > > 2 files changed, 32 insertions(+), 1 deletion(-) > > > > > > diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig > > > index db3d174c53d4..b356217abcfe 100644 > > > --- a/kernel/irq/Kconfig > > > +++ b/kernel/irq/Kconfig > > > @@ -125,6 +125,29 @@ config SPARSE_IRQ > > > > > > If you don't know what to do here, say N. > > > > > > +choice > > > + prompt "Select number of sparse irqs" > > > + depends on SPARSE_IRQ > > > + default SPARSE_IRQ_EXTEND_8K > > > + help > > > + Allows choosing the number of sparse irq's available on the > > > + system. For each 8k of additional irqs added there is > > > approximatly > > > + 1kb of kernel size increase. > > > + > > > +config SPARSE_IRQ_EXTEND_8K > > > + bool "8k" > > > + > > > +config SPARSE_IRQ_EXTEND_16K > > > + bool "16K" > > > + > > > +config SPARSE_IRQ_EXTEND_32K > > > + bool "32K" > > > + > > > +config SPARSE_IRQ_EXTEND_64K > > > + bool "64K" > > > + > > > +endchoice > > > + > > > config GENERIC_IRQ_DEBUGFS > > > bool "Expose irq internals in debugfs" > > > depends on DEBUG_FS > > > diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h > > > index f09c60393e55..25fe5abf6c16 100644 > > > --- a/kernel/irq/internals.h > > > +++ b/kernel/irq/internals.h > > > @@ -12,7 +12,15 @@ > > > #include > > > > > > #ifdef CONFIG_SPARSE_IRQ > > > -# define IRQ_BITMAP_BITS (NR_IRQS + 8196) > > > +# if defined(CONFIG_SPARSE_IRQ_EXTEND_8K) > > > +# define IRQ_BITMAP_BITS (NR_IRQS + 8192 + 4) > > > +# elif defined(CONFIG_SPARSE_IRQ_EXTEND_16K) > > > +# define IRQ_BITMAP_BITS (NR_IRQS + 16384 + 4) > > > +# elif defined(CONFIG_SPARSE_IRQ_EXTEND_32K) > > > +# define IRQ_BITMAP_BITS (NR_IRQS + 32768 + 4) > > > +# elif defined(CONFIG_SPARSE_IRQ_EXTEND_64K) > > > +# define IRQ_BITMAP_BITS (NR_IRQS + 65536 + 4) > > > +# endif > > > #else > > > # define IRQ_BITMAP_BITS NR_IRQS > > > #endif > > > > It really feels like the wrong approach. If your system > > supports a large number of interrupt (I guess it has > > a GICv3 ITS), this shouldn't impact the lesser machines > > (most people are using a distro kernel). > > > > It also doesn't really scale: the GICv3 architecture gives > > you up to 24 bits of interrupts. Are we going to allocate > > 2MB worth of bitmap? Future interrupt architectures may have > > even larger interrupt spaces. > > > > As it turns out, we already store the irqdesc in an rb-tree. > > It doesn't take too much imagination to turn this into a > > xarray and use it for both allocation and tracking. > > > > It would also conveniently replace the irqs_resend bitmap > > if using marks to flag the IRQs to be resent. > > Marvell submitted a similar change, but non-selectable, about a > month ago. Which wasn't really acceptable either. > > The limitation prevents Cisco and Marvell hardware from > functioning. I don't think we're well versed enough on the generic > irq system to implement what your suggesting, even if we did Thomas > would not likely accept it. I don't think you can speak for Thomas here. In my experience of working with him, he's in general much more inclined to look at a scalable, long term solution than at a point hack. Specially given that we already use xarrays for MSIs. > Your suggestion is more of a long term solution vs. our short term > solution. Exactly. Experience shows that short term hacks are almost always a bad idea and result in something that isn't maintainable. > I'm not wedded to any solution, we just need to relieve > the limitation so our hardware starts working. I would imagine other > companies have this issue, but I don't know which ones currently. This architecture has been in the wild for the best part of 10 years, in Linux for 8 years, and nobody so far screamed because of this perceived limitation. It would help if you described exactly what breaks in your system, because just saying "give me more" is not exactly helping (there are other limitations in the GICv3 ITS driver that may bite you anyway). > I would rather to use an upstream solution verses holding the > patches privately. I would suggest if this limitation would not be > overcome for 3-4 releases the short term solution should be > acceptable over that time frame to be replaced by something else > after that. If you want to have an impact on the features being merged in the upstream kernel, a good start would be to take feedback on board. Thanks, M. -- Without deviation from the norm, progress is not possible.