From: Ryan Roberts <ryan.roberts@arm.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
David Hildenbrand <david@redhat.com>,
Donald Dutile <ddutile@redhat.com>,
Eric Chanudet <echanude@redhat.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 0/3] Speed up boot with faster linear map creation
Date: Wed, 27 Mar 2024 16:11:07 +0000 [thread overview]
Message-ID: <05cca7de-2dc1-4dae-abd5-da757dd9eaea@arm.com> (raw)
In-Reply-To: <CAMj1kXGVNWrm6=sWixL3PiXr1DQN_buvm1YxQW2+zALgd3b-hA@mail.gmail.com>
On 27/03/2024 15:57, Ard Biesheuvel wrote:
> On Wed, 27 Mar 2024 at 17:01, Ryan Roberts <ryan.roberts@arm.com> wrote:
>>
>> On 27/03/2024 13:36, Ard Biesheuvel wrote:
>>> On Wed, 27 Mar 2024 at 12:43, Ryan Roberts <ryan.roberts@arm.com> 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));
<create swapper>
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.
next prev parent reply other threads:[~2024-03-27 16:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-26 10:14 [PATCH v1 0/3] Speed up boot with faster linear map creation Ryan Roberts
2024-03-26 10:14 ` [PATCH v1 1/3] arm64: mm: Don't remap pgtables per- cont(pte|pmd) block Ryan Roberts
2024-03-26 10:14 ` [PATCH v1 2/3] arm64: mm: Don't remap pgtables for allocate vs populate Ryan Roberts
2024-03-27 2:05 ` kernel test robot
2024-03-26 10:14 ` [PATCH v1 3/3] arm64: mm: Lazily clear pte table mappings from fixmap Ryan Roberts
2024-03-27 10:09 ` [PATCH v1 0/3] Speed up boot with faster linear map creation Ard Biesheuvel
2024-03-27 10:43 ` Ryan Roberts
2024-03-27 13:36 ` Ard Biesheuvel
2024-03-27 15:01 ` Ryan Roberts
2024-03-27 15:57 ` Ard Biesheuvel
2024-03-27 16:11 ` Ryan Roberts [this message]
2024-03-27 11:06 ` Itaru Kitayama
2024-03-27 11:10 ` Ryan Roberts
2024-03-27 19:07 ` [PATCH v1] arm64: mm: Batch dsb and isb when populating pgtables Ryan Roberts
2024-03-28 7:23 ` Ard Biesheuvel
2024-03-28 8:45 ` Ryan Roberts
2024-03-28 8:56 ` Ard Biesheuvel
2024-03-27 19:12 ` [PATCH v1 0/3] Speed up boot with faster linear map creation Ryan Roberts
2024-03-28 23:08 ` Eric Chanudet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05cca7de-2dc1-4dae-abd5-da757dd9eaea@arm.com \
--to=ryan.roberts@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=ddutile@redhat.com \
--cc=echanude@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox