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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D783CC433EF for ; Tue, 30 Nov 2021 21:08:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240434AbhK3VLi (ORCPT ); Tue, 30 Nov 2021 16:11:38 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:50962 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235904AbhK3VLf (ORCPT ); Tue, 30 Nov 2021 16:11:35 -0500 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 sin.source.kernel.org (Postfix) with ESMTPS id C5101CE1C4F; Tue, 30 Nov 2021 21:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78438C53FC7; Tue, 30 Nov 2021 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638306491; bh=CGQDQlRxlHpJq0xzSuKQi7AU9OYm37j7CJ7xfuMMlQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MQT0554slXBNgzV6dz6ATkc3EGBq02EcnyIjFHm4NC/TQW+Ti/5+ZwpYdUyXTQSX0 FP/Mg9FHX1WkJdgEmvH+Sjh6chDp0qa4rdvwceLtLU4mrx9YqTjWtdVLiOuUAqqTr9 JxBBF8wiCf2msoHxAESTMHrwoozuA53LUQYu0nChlx4mPkmdPvsjcuZz6ld/73Q1EP 49cP1v8fZ5yU4pp+jiMhNoi6TZsD6QEaZ+s7211uBewrAF+q/t4jJF4C5l0VvizKZK UqaJcABTKX49+eBLI8ebfD/p5ZMIh9Z6ly7YavV63rHaytjZkBuc5OrtUPGVxLkKwd 8IDw15RIkFr7Q== Date: Tue, 30 Nov 2021 23:07:40 +0200 From: Mike Rapoport To: Rob Herring Cc: Calvin Zhang , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Yoshinori Sato , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rich Felker , Chris Zankel , Max Filippov , Frank Rowand , Andrew Morton , David Hildenbrand , Arnd Bergmann , Kefeng Wang , Vladimir Isaev , "Russell King (Oracle)" , "Kirill A. Shutemov" , Guenter Roeck , Marc Zyngier , David Brazdil , Anshuman Khandual , Andrey Konovalov , Mark Rutland , Souptick Joarder , Jinyang He , "Rafael J. Wysocki" , Serge Semin , Tiezhu Yang , Geert Uytterhoeven , Randy Dunlap , Ley Foon Tan , Andreas Oetken , Christophe JAILLET , Christophe Leroy , Zhang Yunkai , Andy Shevchenko , Markus Elfring , Ganesh Goudar , "Aneesh Kumar K.V" , Atish Patra , Anup Patel , Nick Kossifidis , Alexandre Ghiti , Vitaly Wool , Thierry Reding , Lee Jones , Guo Ren , Alexander Sverdlin , Greg Kroah-Hartman , Mauri Sandberg , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, devicetree@vger.kernel.org Subject: Re: [PATCH 0/2] of: remove reserved regions count restriction Message-ID: References: <20211119075844.2902592-1-calvinzhang.cool@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-csky@vger.kernel.org On Mon, Nov 29, 2021 at 06:08:10PM -0600, Rob Herring wrote: > On Sun, Nov 21, 2021 at 08:43:47AM +0200, Mike Rapoport wrote: > > On Fri, Nov 19, 2021 at 03:58:17PM +0800, Calvin Zhang wrote: > > > The count of reserved regions in /reserved-memory was limited because > > > the struct reserved_mem array was defined statically. This series sorts > > > out reserved memory code and allocates that array from early allocator. > > > > > > Note: reserved region with fixed location must be reserved before any > > > memory allocation. While struct reserved_mem array should be allocated > > > after allocator is activated. We make early_init_fdt_scan_reserved_mem() > > > do reservation only and add another call to initialize reserved memory. > > > So arch code have to change for it. > > > > I think much simpler would be to use the same constant for sizing > > memblock.reserved and reserved_mem arrays. > > Do those arrays get shrunk? Or do we waste the memory forever? Memblock arrays don't get shrunk, but they are __init unless an architecture chose to keep them after boot, but most architectures that use device tree actually keep memblock structures. > Maybe we can copy and shrink the initial array? Though I suspect struct > reserved_mem pointers have already been given out. I'm not sure. It seems that reserved_mem pointers are given out at initcall time and AFAIU the reserved_mem array is created somewhere around setup_arch(). So maybe it's possible to copy and shrink the initial array. > > > > If there is too much reserved regions in the device tree, reserving them in > > memblock will fail anyway because memblock also starts with static array > > for memblock.reserved, so doing one pass with memblock_reserve() and > > another to set up reserved_mem wouldn't help anyway. > > > > > I'm only familiar with arm and arm64 architectures. Approvals from arch > > > maintainers are required. Thank you all. -- Sincerely yours, Mike. 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 1BE22C433F5 for ; Tue, 30 Nov 2021 21:08:34 +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=SQtmFTMArcWqJ4TKTx2ag5ZC6kCpCQYlcECIhcj1dos=; b=M7YIKJLjMIviY6 F/2/d4Cl2N/o+Hb3/+uYbDCA6FioeqtJkfUTiIr9Ti7wZVLavd3clg4198yW9srkqx1qV9QnaHAFk FRujNQAcKff2iGM/XDoCGEZO+GCMEdSVXjpHPbZpepo+BWC17tb7xnIcFtWfzyGPgO+JCFYFD1ZlD zSM1uwy3BtemgjR+B6naxKXlsc37E7qgGUo2O/FaiQ56r2U2BRTWpt2t3Ld9TlIhXwybxjUOhP1pk rt2cQJlI/XA6Wugi3Jxmj9kZcV9bQZxD7yT7t+jbvnur/Gk+1JloMYxvm+U65LC3mvkvOTX8Fp8Gy Uuie0qaIM3+U2G1QCnpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msAMO-006ihY-91; Tue, 30 Nov 2021 21:08:20 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msAMJ-006ifq-OH; Tue, 30 Nov 2021 21:08:17 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 2D78AB81C4F; Tue, 30 Nov 2021 21:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78438C53FC7; Tue, 30 Nov 2021 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638306491; bh=CGQDQlRxlHpJq0xzSuKQi7AU9OYm37j7CJ7xfuMMlQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MQT0554slXBNgzV6dz6ATkc3EGBq02EcnyIjFHm4NC/TQW+Ti/5+ZwpYdUyXTQSX0 FP/Mg9FHX1WkJdgEmvH+Sjh6chDp0qa4rdvwceLtLU4mrx9YqTjWtdVLiOuUAqqTr9 JxBBF8wiCf2msoHxAESTMHrwoozuA53LUQYu0nChlx4mPkmdPvsjcuZz6ld/73Q1EP 49cP1v8fZ5yU4pp+jiMhNoi6TZsD6QEaZ+s7211uBewrAF+q/t4jJF4C5l0VvizKZK UqaJcABTKX49+eBLI8ebfD/p5ZMIh9Z6ly7YavV63rHaytjZkBuc5OrtUPGVxLkKwd 8IDw15RIkFr7Q== Date: Tue, 30 Nov 2021 23:07:40 +0200 From: Mike Rapoport To: Rob Herring Cc: Calvin Zhang , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Yoshinori Sato , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rich Felker , Chris Zankel , Max Filippov , Frank Rowand , Andrew Morton , David Hildenbrand , Arnd Bergmann , Kefeng Wang , Vladimir Isaev , "Russell King (Oracle)" , "Kirill A. Shutemov" , Guenter Roeck , Marc Zyngier , David Brazdil , Anshuman Khandual , Andrey Konovalov , Mark Rutland , Souptick Joarder , Jinyang He , "Rafael J. Wysocki" , Serge Semin , Tiezhu Yang , Geert Uytterhoeven , Randy Dunlap , Ley Foon Tan , Andreas Oetken , Christophe JAILLET , Christophe Leroy , Zhang Yunkai , Andy Shevchenko , Markus Elfring , Ganesh Goudar , "Aneesh Kumar K.V" , Atish Patra , Anup Patel , Nick Kossifidis , Alexandre Ghiti , Vitaly Wool , Thierry Reding , Lee Jones , Guo Ren , Alexander Sverdlin , Greg Kroah-Hartman , Mauri Sandberg , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, devicetree@vger.kernel.org Subject: Re: [PATCH 0/2] of: remove reserved regions count restriction Message-ID: References: <20211119075844.2902592-1-calvinzhang.cool@gmail.com> 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-20211130_130816_094044_758C83C6 X-CRM114-Status: GOOD ( 27.72 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Mon, Nov 29, 2021 at 06:08:10PM -0600, Rob Herring wrote: > On Sun, Nov 21, 2021 at 08:43:47AM +0200, Mike Rapoport wrote: > > On Fri, Nov 19, 2021 at 03:58:17PM +0800, Calvin Zhang wrote: > > > The count of reserved regions in /reserved-memory was limited because > > > the struct reserved_mem array was defined statically. This series sorts > > > out reserved memory code and allocates that array from early allocator. > > > > > > Note: reserved region with fixed location must be reserved before any > > > memory allocation. While struct reserved_mem array should be allocated > > > after allocator is activated. We make early_init_fdt_scan_reserved_mem() > > > do reservation only and add another call to initialize reserved memory. > > > So arch code have to change for it. > > > > I think much simpler would be to use the same constant for sizing > > memblock.reserved and reserved_mem arrays. > > Do those arrays get shrunk? Or do we waste the memory forever? Memblock arrays don't get shrunk, but they are __init unless an architecture chose to keep them after boot, but most architectures that use device tree actually keep memblock structures. > Maybe we can copy and shrink the initial array? Though I suspect struct > reserved_mem pointers have already been given out. I'm not sure. It seems that reserved_mem pointers are given out at initcall time and AFAIU the reserved_mem array is created somewhere around setup_arch(). So maybe it's possible to copy and shrink the initial array. > > > > If there is too much reserved regions in the device tree, reserving them in > > memblock will fail anyway because memblock also starts with static array > > for memblock.reserved, so doing one pass with memblock_reserve() and > > another to set up reserved_mem wouldn't help anyway. > > > > > I'm only familiar with arm and arm64 architectures. Approvals from arch > > > maintainers are required. Thank you all. -- Sincerely yours, Mike. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 44265C433F5 for ; Tue, 30 Nov 2021 21:08:24 +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=Vbx5Lt2I/BHPTH4+83veuEnWfbYPwEuH3e0j+EdCZ4Q=; b=GsFjwjP9SzUzu6 SIRhiB++snTkUEu5Xi8s5iRbvXzzIpPCfxvnvgIxNxUiYQ8WaEykBauYPDf66Vd9xm6YJp27UmcBt AcbIh/dxliREgx+zRi9l5kaqI2MKNsCoIWQT8Zq+gn/m6ZhVM5fx5gew5tT/z2Cy0sOHRNsK2ctz3 qxjUy0SmfzndrQU4K/u8qcaL28tfjG44/w7OgJN3MZl3THaYAlwfFIaNYns/Ri8ApBQ9JzGjT96iT 9eBDE45paifPeYGd/YRHSDahp19NWOTdiIRIiyNSq52ihMrGE2MHYxgHLTfT8lkVuT3pstv3oZjue pyeyZtSMhMDxbz7jIwaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msAMQ-006ii8-1S; Tue, 30 Nov 2021 21:08:22 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msAMJ-006ifq-OH; Tue, 30 Nov 2021 21:08:17 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 2D78AB81C4F; Tue, 30 Nov 2021 21:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78438C53FC7; Tue, 30 Nov 2021 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638306491; bh=CGQDQlRxlHpJq0xzSuKQi7AU9OYm37j7CJ7xfuMMlQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MQT0554slXBNgzV6dz6ATkc3EGBq02EcnyIjFHm4NC/TQW+Ti/5+ZwpYdUyXTQSX0 FP/Mg9FHX1WkJdgEmvH+Sjh6chDp0qa4rdvwceLtLU4mrx9YqTjWtdVLiOuUAqqTr9 JxBBF8wiCf2msoHxAESTMHrwoozuA53LUQYu0nChlx4mPkmdPvsjcuZz6ld/73Q1EP 49cP1v8fZ5yU4pp+jiMhNoi6TZsD6QEaZ+s7211uBewrAF+q/t4jJF4C5l0VvizKZK UqaJcABTKX49+eBLI8ebfD/p5ZMIh9Z6ly7YavV63rHaytjZkBuc5OrtUPGVxLkKwd 8IDw15RIkFr7Q== Date: Tue, 30 Nov 2021 23:07:40 +0200 From: Mike Rapoport To: Rob Herring Cc: Calvin Zhang , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Yoshinori Sato , Thomas Bogendoerfer , Nick Hu , Greentime Hu , Vincent Chen , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rich Felker , Chris Zankel , Max Filippov , Frank Rowand , Andrew Morton , David Hildenbrand , Arnd Bergmann , Kefeng Wang , Vladimir Isaev , "Russell King (Oracle)" , "Kirill A. Shutemov" , Guenter Roeck , Marc Zyngier , David Brazdil , Anshuman Khandual , Andrey Konovalov , Mark Rutland , Souptick Joarder , Jinyang He , "Rafael J. Wysocki" , Serge Semin , Tiezhu Yang , Geert Uytterhoeven , Randy Dunlap , Ley Foon Tan , Andreas Oetken , Christophe JAILLET , Christophe Leroy , Zhang Yunkai , Andy Shevchenko , Markus Elfring , Ganesh Goudar , "Aneesh Kumar K.V" , Atish Patra , Anup Patel , Nick Kossifidis , Alexandre Ghiti , Vitaly Wool , Thierry Reding , Lee Jones , Guo Ren , Alexander Sverdlin , Greg Kroah-Hartman , Mauri Sandberg , Palmer Dabbelt , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, devicetree@vger.kernel.org Subject: Re: [PATCH 0/2] of: remove reserved regions count restriction Message-ID: References: <20211119075844.2902592-1-calvinzhang.cool@gmail.com> 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-20211130_130816_094044_758C83C6 X-CRM114-Status: GOOD ( 27.72 ) X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org On Mon, Nov 29, 2021 at 06:08:10PM -0600, Rob Herring wrote: > On Sun, Nov 21, 2021 at 08:43:47AM +0200, Mike Rapoport wrote: > > On Fri, Nov 19, 2021 at 03:58:17PM +0800, Calvin Zhang wrote: > > > The count of reserved regions in /reserved-memory was limited because > > > the struct reserved_mem array was defined statically. This series sorts > > > out reserved memory code and allocates that array from early allocator. > > > > > > Note: reserved region with fixed location must be reserved before any > > > memory allocation. While struct reserved_mem array should be allocated > > > after allocator is activated. We make early_init_fdt_scan_reserved_mem() > > > do reservation only and add another call to initialize reserved memory. > > > So arch code have to change for it. > > > > I think much simpler would be to use the same constant for sizing > > memblock.reserved and reserved_mem arrays. > > Do those arrays get shrunk? Or do we waste the memory forever? Memblock arrays don't get shrunk, but they are __init unless an architecture chose to keep them after boot, but most architectures that use device tree actually keep memblock structures. > Maybe we can copy and shrink the initial array? Though I suspect struct > reserved_mem pointers have already been given out. I'm not sure. It seems that reserved_mem pointers are given out at initcall time and AFAIU the reserved_mem array is created somewhere around setup_arch(). So maybe it's possible to copy and shrink the initial array. > > > > If there is too much reserved regions in the device tree, reserving them in > > memblock will fail anyway because memblock also starts with static array > > for memblock.reserved, so doing one pass with memblock_reserve() and > > another to set up reserved_mem wouldn't help anyway. > > > > > I'm only familiar with arm and arm64 architectures. Approvals from arch > > > maintainers are required. Thank you all. -- Sincerely yours, Mike. _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Rapoport Date: Tue, 30 Nov 2021 23:07:40 +0200 Subject: [OpenRISC] [PATCH 0/2] of: remove reserved regions count restriction In-Reply-To: References: <20211119075844.2902592-1-calvinzhang.cool@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.org On Mon, Nov 29, 2021 at 06:08:10PM -0600, Rob Herring wrote: > On Sun, Nov 21, 2021 at 08:43:47AM +0200, Mike Rapoport wrote: > > On Fri, Nov 19, 2021 at 03:58:17PM +0800, Calvin Zhang wrote: > > > The count of reserved regions in /reserved-memory was limited because > > > the struct reserved_mem array was defined statically. This series sorts > > > out reserved memory code and allocates that array from early allocator. > > > > > > Note: reserved region with fixed location must be reserved before any > > > memory allocation. While struct reserved_mem array should be allocated > > > after allocator is activated. We make early_init_fdt_scan_reserved_mem() > > > do reservation only and add another call to initialize reserved memory. > > > So arch code have to change for it. > > > > I think much simpler would be to use the same constant for sizing > > memblock.reserved and reserved_mem arrays. > > Do those arrays get shrunk? Or do we waste the memory forever? Memblock arrays don't get shrunk, but they are __init unless an architecture chose to keep them after boot, but most architectures that use device tree actually keep memblock structures. > Maybe we can copy and shrink the initial array? Though I suspect struct > reserved_mem pointers have already been given out. I'm not sure. It seems that reserved_mem pointers are given out at initcall time and AFAIU the reserved_mem array is created somewhere around setup_arch(). So maybe it's possible to copy and shrink the initial array. > > > > If there is too much reserved regions in the device tree, reserving them in > > memblock will fail anyway because memblock also starts with static array > > for memblock.reserved, so doing one pass with memblock_reserve() and > > another to set up reserved_mem wouldn't help anyway. > > > > > I'm only familiar with arm and arm64 architectures. Approvals from arch > > > maintainers are required. Thank you all. -- Sincerely yours, Mike. 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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 F35E0C433EF for ; Tue, 30 Nov 2021 22:33:13 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4J3cS818c2z3cVT for ; Wed, 1 Dec 2021 09:33:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=MQT0554s; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=145.40.68.75; helo=ams.source.kernel.org; envelope-from=rppt@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=MQT0554s; dkim-atps=neutral Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4J3ZZB1X21z2xtQ for ; Wed, 1 Dec 2021 08:08:18 +1100 (AEDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 2D78AB81C4F; Tue, 30 Nov 2021 21:08:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78438C53FC7; Tue, 30 Nov 2021 21:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1638306491; bh=CGQDQlRxlHpJq0xzSuKQi7AU9OYm37j7CJ7xfuMMlQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MQT0554slXBNgzV6dz6ATkc3EGBq02EcnyIjFHm4NC/TQW+Ti/5+ZwpYdUyXTQSX0 FP/Mg9FHX1WkJdgEmvH+Sjh6chDp0qa4rdvwceLtLU4mrx9YqTjWtdVLiOuUAqqTr9 JxBBF8wiCf2msoHxAESTMHrwoozuA53LUQYu0nChlx4mPkmdPvsjcuZz6ld/73Q1EP 49cP1v8fZ5yU4pp+jiMhNoi6TZsD6QEaZ+s7211uBewrAF+q/t4jJF4C5l0VvizKZK UqaJcABTKX49+eBLI8ebfD/p5ZMIh9Z6ly7YavV63rHaytjZkBuc5OrtUPGVxLkKwd 8IDw15RIkFr7Q== Date: Tue, 30 Nov 2021 23:07:40 +0200 From: Mike Rapoport To: Rob Herring Subject: Re: [PATCH 0/2] of: remove reserved regions count restriction Message-ID: References: <20211119075844.2902592-1-calvinzhang.cool@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Wed, 01 Dec 2021 09:32:35 +1100 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Kirill A. Shutemov" , Mark Rutland , Kefeng Wang , Rich Felker , Jinyang He , David Hildenbrand , Lee Jones , linux-kernel@vger.kernel.org, Max Filippov , Anup Patel , Guo Ren , Guo Ren , Calvin Zhang , Nick Kossifidis , Vladimir Isaev , Tiezhu Yang , Vincent Chen , Will Deacon , Markus Elfring , Vitaly Wool , Jonas Bonn , devicetree@vger.kernel.org, linux-snps-arc@lists.infradead.org, uclinux-h8-devel@lists.sourceforge.jp, Yoshinori Sato , Palmer Dabbelt , linux-sh@vger.kernel.org, "Rafael J. Wysocki" , Russell King , Ley Foon Tan , Geert Uytterhoeven , "Aneesh Kumar K.V" , Catalin Marinas , Ganesh Goudar , David Brazdil , linux-riscv@lists.infradead.org, Guenter Roeck , Alexander Sverdlin , Thierry Reding , Albert Ou , Arnd Bergmann , Anshuman Khandual , linux-xtensa@linux-xtensa.org, Vineet Gupta , Andreas Oetken , Stefan Kristiansson , "Russell King \(Oracle\)" , linux-csky@vger.kernel.org, Christophe JAILLET , Greentime Hu , Paul Walmsley , Stafford Horne , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Christophe Leroy , Chris Zankel , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Alexandre Ghiti , Nick Hu , Atish Patra , Greg Kroah-Hartman , Randy Dunlap , Frank Rowand , Serge Semin , Dinh Nguyen , Zhang Yunkai , Palmer Dabbelt , Souptick Joarder , Marc Zyngier , Mauri Sandberg , Paul Mackerras , Andrew Morton , linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Nov 29, 2021 at 06:08:10PM -0600, Rob Herring wrote: > On Sun, Nov 21, 2021 at 08:43:47AM +0200, Mike Rapoport wrote: > > On Fri, Nov 19, 2021 at 03:58:17PM +0800, Calvin Zhang wrote: > > > The count of reserved regions in /reserved-memory was limited because > > > the struct reserved_mem array was defined statically. This series sorts > > > out reserved memory code and allocates that array from early allocator. > > > > > > Note: reserved region with fixed location must be reserved before any > > > memory allocation. While struct reserved_mem array should be allocated > > > after allocator is activated. We make early_init_fdt_scan_reserved_mem() > > > do reservation only and add another call to initialize reserved memory. > > > So arch code have to change for it. > > > > I think much simpler would be to use the same constant for sizing > > memblock.reserved and reserved_mem arrays. > > Do those arrays get shrunk? Or do we waste the memory forever? Memblock arrays don't get shrunk, but they are __init unless an architecture chose to keep them after boot, but most architectures that use device tree actually keep memblock structures. > Maybe we can copy and shrink the initial array? Though I suspect struct > reserved_mem pointers have already been given out. I'm not sure. It seems that reserved_mem pointers are given out at initcall time and AFAIU the reserved_mem array is created somewhere around setup_arch(). So maybe it's possible to copy and shrink the initial array. > > > > If there is too much reserved regions in the device tree, reserving them in > > memblock will fail anyway because memblock also starts with static array > > for memblock.reserved, so doing one pass with memblock_reserve() and > > another to set up reserved_mem wouldn't help anyway. > > > > > I'm only familiar with arm and arm64 architectures. Approvals from arch > > > maintainers are required. Thank you all. -- Sincerely yours, Mike.