Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7447909rwl; Tue, 10 Jan 2023 00:33:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQC6lI+Q4Anfpvc08orcxmcMhlqxyryaLm/RdcA1w0cU5W6QE/yRsR7uDbkjiW8M9BbCVr X-Received: by 2002:a17:902:f60b:b0:189:e924:e279 with SMTP id n11-20020a170902f60b00b00189e924e279mr74989534plg.49.1673339610432; Tue, 10 Jan 2023 00:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673339610; cv=none; d=google.com; s=arc-20160816; b=GMCs72eWOk3hNbiOOBtX110kkFeaiju92wOkDtpiUGgaSaEVwbJG2thcP0xdhCA9O0 nxfVuVCfYw3Wr9cembc0kV8LbNF972zsoUaBHD0TR9drCbnBR5eV4ADd7YTTWF6vv1pY cIPMp3LVtQylihuUZ54LwyWjW8fggtfBu91ZFTCi7y/kY1akuGhWaJ/7SXYXUvKF96xB Mks50KwzGzLheN5ULTSY5wCpBjeDkyOKmA7+w+GUbLbuvz1OB6xVPcNGjh8puAe34t0I OrXT+4JMRHnVNNYHE/53KXOerkG7xK+gT91ymESkpsJv6et61I1IE+Z6kpCA0pIhhWHA PGRA== 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=4Y8+aFnY0J6yuR6kQpL+BwDcfBeJHCCcdxEZFW4RoJc=; b=GCNeVcuN03ypVH5wJFLPplEVyED3PCPCpnqO7cOuEr7kti6soXYaRxjzMOLekuJvBq jqM873pAC5s4pmtUINDGQ3ycaiCTE/mcrKlqLCiYKXgivXkUaPyhLVnN1KMYsXJ667wD N7IcyvX/PBry7tzNOsADgB6R5zKYaiFZ5qkWvxlpxE728lLxkpBDfUp8skhxjpqTjJIY oofzkIR4go93lHj/77/dcB78907yucxCgkyqNbMQFHwTSZELTQu/w/KJdeqEAtQenHKC IHA0M253DOSce99U3UMSa+ECMzkXim2IU7GvSxJUAJ7Gbq0WQK2imaciDaZgdr3u1evr KA9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pmlOIOZ7; 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 z5-20020a170903018500b00189d0fa14d6si12289069plg.13.2023.01.10.00.33.24; Tue, 10 Jan 2023 00:33:30 -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=pmlOIOZ7; 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 S230263AbjAJIVy (ORCPT + 53 others); Tue, 10 Jan 2023 03:21:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbjAJIVx (ORCPT ); Tue, 10 Jan 2023 03:21:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA6B11A22 for ; Tue, 10 Jan 2023 00:21:51 -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 034D461511 for ; Tue, 10 Jan 2023 08:21:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 420C0C433D2; Tue, 10 Jan 2023 08:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673338910; bh=vbqWNUveq6DaJ6LQ1YU6cnSkGkBsp8r/3HKPlPuYGuM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pmlOIOZ702LLEg51BS9tYjXySdTjKPOi90FXlkCS9lxwkOeT0gvutDcscfLkSeagI 7DFcuFKcD4+NvdLu7A76ktIKyabfdV5L/SEQhwHOX0ujTH/yfKvrGaOMfloJnlC4Pa D70oqqFM6Pto3+OecsWAB2735s8FqU1dAP2PZWKtoURReUhxE+JgqE5GV+CW2Ai+4r t472xdHh635onVrIjtZ4YNUm2AFiTV1mizxptbEr1EO/wDT8eFb8rvF3K9qi3xKbIP jM+JlImNoCmiZInuthr/Q/S78hVg4kHOfc8lnCS6KjW38P+VyMDhaeqHYbFG51Proz UJQF/GFRixtxg== 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 1pF9tD-000W4f-Q4; Tue, 10 Jan 2023 08:21:47 +0000 Date: Tue, 10 Jan 2023 08:20:38 +0000 Message-ID: <87pmbmer6x.wl-maz@kernel.org> From: Marc Zyngier To: Shanker Donthineni Cc: Catalin Marinas , Will Deacon , James Morse , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] arm64: gic: increase the number of IRQ descriptors In-Reply-To: References: <20230104023738.1258925-1-sdonthineni@nvidia.com> <86sfgq7jb3.wl-maz@kernel.org> <2a0116a8-fbd0-d866-ada0-ed50f0523f1d@nvidia.com> <86k0216ydh.wl-maz@kernel.org> <4cc4114d-7fa5-1c23-3504-0ca4dbdd0f62@nvidia.com> <86fscjoe3i.wl-maz@kernel.org> 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: sdonthineni@nvidia.com, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, linux-arm-kernel@lists.infradead.org, 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 Mon, 09 Jan 2023 17:13:25 +0000, Shanker Donthineni wrote: > > >>> I'm happy to help with it, but I'm certainly not willing to accept any > >>> sort of new compile-time limit. > >> > >> Thanks for helping with a scalable solution instead of static > >> allocation. Please include me whenever patches posted to LKML. I'm > >> happy to verify on NVIDIA server platforms and provide test > >> feedback. > >> > > > > I offered to help you. I didn't offer to do the work for you! ;-) > > > > I've looked at the IDR/IDA API. There is no suitable function for > allocating contiguous IDs to replace bitmap API. > > __irq_alloc_descs(): > > mutex_lock(&sparse_irq_lock); > > start = bitmap_find_next_zero_area(allocated_irqs, IRQ_BITMAP_BITS, > from, cnt, 0); > ret = -EEXIST; > > Is there any existing API that I can use for allocating contiguous IDs? I think you should address the problem the other way around, as there are lower hanging fruits: - turn the irq_desc_tree radix tree into a XArray - use the XArray mark feature to reimplement the irqs_resend bitmap Once you have done that, you have already halved the memory usage. To implement the allocated_irqs bitmap functionality, you have a bunch of options: - make the XArray an allocating XArray, and iterate over XA_FREE_MARK to find the free range (see how the infiniband subsystem is doing exactly that) - use another Xarray mark to annotate the allocated IRQs, find the distance between two allocations, and use this range if the request fits (a poor man's variation of the above) - use a sideband data structure such as the GICv3 LPI allocator, which is already dealing with range allocation (I'd rather avoid that) - something else? It should be fairly straightforward to perform the conversion in place. Thanks, M. -- Without deviation from the norm, progress is not possible.