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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C3BAAC87FCB for ; Sat, 9 Aug 2025 09:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jpt4Lm87Ch4J+vRRRrmcDBl8t1WKrMFhJXaXfM2cwFs=; b=fm1NIrOK+HeHjwoTS20mgpb35e R6px8u+tdNXItJ6X3ZPdISt7JJPZ/b2Dno5uTvu8cQo4fvqDGqhHkoxUEFrS1r9mKJqgaNGF/vZlc f3YlaODez8NX2s1Fyh1BkX4+7pEw8+OVJHWuXQpLAMK09V8H0fJanOf3B/6GlphwytnCvQUUEnm+y gSqDrdGanPiNNJMeYMV9/fqz+S3/RszlBWCKnKO717TZy97c/YNjvmEr5zrgRd/EYjf50mVR/+qR6 b5jfYZt+MM42eHwz0g+YbPmYOt9BMh7FmQ2iLIC3gQDYCqxM3qRjENoCodV7qUyyw1YGH/QONpmxr ouix54nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ukgHI-00000004Kk8-19Av; Sat, 09 Aug 2025 09:54:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ukgEl-00000004KR2-32K6 for linux-arm-kernel@lists.infradead.org; Sat, 09 Aug 2025 09:51:40 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AAE5A5C4850; Sat, 9 Aug 2025 09:51:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 516D8C4CEE7; Sat, 9 Aug 2025 09:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754733098; bh=CNDapeMdSOkxK13mZ13X4XJzYBasQIzVk3eLsFf1QE4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BQRnU3ENv+vT1ZE34MP+sIDQ7I5fpDJpQtVR8MiWUdZuJBj6kRO4ZkmXlIHA8ceib +w5RSrJ8O7CLaertFnzZPT2WWeI12p+O1Gk3eFZRGGhkrkjlu+/d/H9zPCkDDiLF7f 4jyrFCVPrVyxfgMdV6pNqjXp/nNoVWtQAmZo5FXJpZ5LP7MC3dReYwK/NCmHZsd4TV CrVBgknhGOb9O6AHxdl4238YU4PImN60se8yyz2916HEHqPFaAvXWhdVPHguQwcDEV Nj9WZj7ZyPwmiMUrwp9Vb3pZlPrRg27gJtflNDXXtp8ZA3Ta5X4K47SuOFIP60Rt/e K30SyibaBs3vg== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.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 1ukgEh-005bbt-V7; Sat, 09 Aug 2025 10:51:36 +0100 Date: Sat, 09 Aug 2025 10:51:35 +0100 Message-ID: <875xewu8k8.wl-maz@kernel.org> From: Marc Zyngier To: Jinjie Ruan Cc: , , , Subject: Re: [RFC PATCH -next] irqchip/gic-v5: Improve the SPI alloc efficiency In-Reply-To: <20250809092920.3765609-1-ruanjinjie@huawei.com> References: <20250809092920.3765609-1-ruanjinjie@huawei.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/30.1 (aarch64-unknown-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: ruanjinjie@huawei.com, lpieralisi@kernel.org, tglx@linutronix.de, 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250809_025139_802511_42E06F74 X-CRM114-Status: GOOD ( 17.09 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 09 Aug 2025 10:29:20 +0100, Jinjie Ruan wrote: > > If the GICv5 system has a large number of PEs and IRS components, > traversing the linked list to find the irs_data corresponding > to a specific SPI interrupt will be very slow. Define "very slow". > > Since the maximum number of IRS nodes, the minimum and maximum SPI > interrupt numbers for each IRS is known during the initialization > of the IRS nodes, sort the IRS nodes by interrupt number at > the initial stage. This way, when allocating SPI interrupts, we can > directly perform a binary search on the irs_data > using the SPI interrupt number with O(log N) complexity. Here we go again... Frankly, before we start optimising the crap out of this, I really want numbers: - How many IRSs to you imagine having? 2? 64? 4096? - How often do we walk that list? I can't answer the first question, but I can definitely answer the second one: we do it exactly *ONCE* per SPI, at the point of allocation. And once it is allocated, we don't do it again. Unless you demonstrate, with actual figures taken from actual hardware, that what we have is not good enough, that we need some binary search to walk the thousands of IRSs that you have in your system and that it actually affects performance, I don't buy it at all. Premature optimisation, evil, and all that jazz... Thanks, M. -- Jazz isn't dead. It just smells funny.