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 89045C54E67 for ; Wed, 27 Mar 2024 17:18:32 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K1sKU8yhV01aHYOlGywzxJJB3Pb2bTXa8Bv7FgmZ9tc=; b=GtfGXGbOG2zM5t 2EQaD8nxVdO3CeJDFB3AOdIspK/aKxum191TLyhlqyBT20jkCcZH2tGVpDiitk54ZwdKQxWa4MEP7 j/CuR+47kgdyH+8sXgY0i3BHocTGeV/coYqepg1BHZRHrJNM1y3p67M4wQkXHDDkp9QVFrQ0GdGeH yJ+XVPOA3xYnXXNpDBZGNGkWttws5Ty3rAIo4fKWSV/SPyirgSEl2h/rh7U82JWb79U4HiidNJo1N +YWv/ILqFcMmYVSk2uuMse0rdAgWu4Mj5FaUa5SPIAeUR+DdmvoCopqPWrNHEL54D+MN8NLrEB/7L PLPEcQjrxN3KgK21mCdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpWur-0000000AFjU-3C1K; Wed, 27 Mar 2024 17:18:21 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpVrw-0000000A1M1-0Jtq for linux-arm-kernel@bombadil.infradead.org; Wed, 27 Mar 2024 16:11:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID: Sender:Reply-To:Content-ID:Content-Description; bh=kbAEdyV16O3HDrnym/J5JwgW/GBwercgrqkjqDl1h6E=; b=QkK4ZzKlQb4uZ+5YB9xakBsa0m S+9+52vbaNoKb6isxqlpNmvEFfCL4UcHBNLXcvlVzfdj73vazc36YZ4h8rC+6NS7ITeTLeBehoB0E 1pXa7suW7HZizRLExmdptFeFHeVzZwE8OPvKQblaotdwej/Q8GGNC/BBGFCHhlXNfrXv95/8faqmE jxaBtdJGBMmvRJS9j1jcOfF833MyaQfM6vuXGO+C5rsQEGvno7nSbr8Ohy20H2rJhRyJFe/zy5xzn BH+Hcv4plocxgjny+XADEAyahtJ/aNavZCY2580uTxcaFrV4A0MdXJPoYBlB7vSWOwUYnlb1dezHD sU/jRL7w==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpVrs-00000000NNv-08tJ for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 16:11:14 +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 3B27F2F4; Wed, 27 Mar 2024 09:11:44 -0700 (PDT) Received: from [10.57.72.121] (unknown [10.57.72.121]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99C323F64C; Wed, 27 Mar 2024 09:11:08 -0700 (PDT) Message-ID: <05cca7de-2dc1-4dae-abd5-da757dd9eaea@arm.com> Date: Wed, 27 Mar 2024 16:11:07 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 0/3] Speed up boot with faster linear map creation Content-Language: en-GB To: Ard Biesheuvel Cc: Catalin Marinas , Will Deacon , Mark Rutland , David Hildenbrand , Donald Dutile , Eric Chanudet , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240326101448.3453626-1-ryan.roberts@arm.com> <7f69758c-b849-48ca-b279-569469183e91@arm.com> From: Ryan Roberts In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_161112_485423_051B5C5B X-CRM114-Status: GOOD ( 23.32 ) 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 27/03/2024 15:57, Ard Biesheuvel wrote: > On Wed, 27 Mar 2024 at 17:01, Ryan Roberts wrote: >> >> On 27/03/2024 13:36, Ard Biesheuvel wrote: >>> On Wed, 27 Mar 2024 at 12:43, Ryan Roberts wrote: >>>> >>>> On 27/03/2024 10:09, Ard Biesheuvel wrote: > ... >>> >>> I think a mix of the fixmap approach with a 1:1 map could work here: >>> - use TTBR0 to create a temp 1:1 map of DRAM >>> - map page tables lazily as they are allocated but using a coarse mapping >>> - avoid all TLB maintenance except at the end when tearing down the 1:1 mapping. >> >> Yes that could work I think. So to make sure I've understood: >> >> - create a 1:1 map for all of DRAM using block and cont mappings where possible >> - use memblock_phys_alloc_*() to allocate pgtable memory >> - access via fixmap (should be minimal due to block mappings) > > Yes but you'd only need the fixmap for pages that are not in the 1:1 > map yet, so after an initial ramp up you wouldn't need it at all, > assuming locality of memblock allocations and the use of PMD mappings. > The only tricky thing here is ensuring that we are not mapping memory > that we shouldn't be touching. That sounds a bit nasty though. I think it would be simpler to just reuse the machinery we have, doing the 1:1 map using blocks and fixmap; It should be a factor of 512 better than what we have, so probably not a problem at that point. That way, we can rely on memblock to tell us what to map. If its still problematic I can add a layer to support 1G mappings too. > >> - install it in TTBR0 >> - create all the swapper mappings as normal (no block or cont mappings) >> - use memblock_phys_alloc_*() to alloc pgtable memory >> - phys address is also virtual address due to installed 1:1 map >> - Remove 1:1 map from TTBR0 >> - memblock_phys_free() all the memory associated with 1:1 map >> > > Indeed. One question on the state of TTBR0 at entrance to paging_init(); what is it? I need to know so I can set it back after. Currently I'm thinking I can do: cpu_install_ttbr0(my_dram_idmap, TCR_T0SZ(vabits_actual)); cpu_set_reserved_ttbr0(); local_flush_tlb_all(); But is it ok to leave the reserved pdg in ttbr0, or is it expecting something else? > >> That sounds doable on top of the first 2 patches in this series - I'll have a >> crack. The only missing piece is depth-first 1:1 map traversal to free the >> tables. I'm guessing something already exists that I can repurpose? >> > > Not that I am aware of, but that doesn't sound too complicated. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel