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 2527BC38147 for ; Wed, 18 Jan 2023 12:28:15 +0000 (UTC) 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7Lz+IiGbm1MtlEEOuYyoHkQtqPNK3ALtrrFpbUoEW0c=; b=bhl8FFnMr7Etfi r6aE3S23u5B1WK56WpacfiwlR7GhLb938boG7miAak195p1WlqzlpZbz3HWRT5URRebzgDKfQhv/X FbTLnnGpFka/qX5UJJgRM7AnX0mOw6q2zQel0+3+CqQ+Xdm/69GXv+T3bJkkrW0cFDYlT+EmTX0o9 rL9DsbC2rLiTaWNDMiL4728NvkZ3lPbmL0o+SoYiZ014hiYYIARHurYFVxRLoCqIQZXb66uaGoMSk pecmjgMUcYvr88+rwEBWnGJrcooBNy1A0sy2UoNegg2kGEMkzpuakhDlUe5EXnYoAGK6WlCXghTeu SbPgoDh3i2GdWE2ylWdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI7X3-000o9Z-6g; Wed, 18 Jan 2023 12:27:10 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI7Wn-000o5Y-Jo for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 12:26:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BBE2A169C; Wed, 18 Jan 2023 04:27:34 -0800 (PST) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EB9523F67D; Wed, 18 Jan 2023 04:26:51 -0800 (PST) Date: Wed, 18 Jan 2023 12:26:45 +0000 From: Cristian Marussi To: Matthew Wilcox Cc: Dan Carpenter , linux-arm-kernel@lists.infradead.org Subject: Re: [bug report] firmware: arm_scmi: Add per-channel Raw injection support Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_042653_769141_B491993A X-CRM114-Status: GOOD ( 16.86 ) 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, Jan 17, 2023 at 02:49:31PM +0000, Matthew Wilcox wrote: > On Tue, Jan 17, 2023 at 02:30:43PM +0000, Cristian Marussi wrote: > > > 1118 ret = idr_alloc(&raw->queues_idr, q, > > > 1119 channels[i], channels[i] + 1, > > > 1120 GFP_KERNEL); > > > 1121 if (ret != channels[i]) > > > 1122 dev_err(dev, > > > 1123 "Fail to allocate Raw queue 0x%02X\n", > > > 1124 channels[i]); > > > > > > Heh. I've never seen anyone use an IDR range of one value before... > > > > Well, the choice was between wasting an hashtable or a radix-tree IDR for a > > few mapping channel--->q and I went for the 1-range IDR which is already > > used in SCMI stack to map various refs to channel numbers. > > (I avoid in general to put a simple plain 256 array on the stack that can > > lead to stack-size issues especially while compiling on armv7) > > The "range of one" idiom is fairly frequently used, but generally it is > an indication that you want to use the XArray API instead of the IDR API, > which is deprecated in any case. > > I've given up tilting at that windmill as I'm more concerned with the > folio work, but it'd be nice if you could convert from IDR to XArray here. Hi, thanks for the hint Matthew, never used XArrays till now. I'll reworked the above with XArray in: https://lore.kernel.org/linux-arm-kernel/20230118121426.492864-17-cristian.marussi@arm.com/T/#u Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel