linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Roberts <ryan.roberts@arm.com>
To: Kevin Brodsky <kevin.brodsky@arm.com>,
	Yang Shi <yang@os.amperecomputing.com>,
	Jinjiang Tu <tujinjiang@huawei.com>,
	catalin.marinas@arm.com, will@kernel.org,
	akpm@linux-foundation.org, david@redhat.com,
	lorenzo.stoakes@oracle.com, ardb@kernel.org, dev.jain@arm.com,
	scott@os.amperecomputing.com, cl@gentwo.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v8 0/5] arm64: support FEAT_BBM level 2 and large block mapping when rodata=full
Date: Tue, 17 Mar 2026 15:05:27 +0000	[thread overview]
Message-ID: <f7105fbe-2141-4036-a6b2-5ec4384b77e6@arm.com> (raw)
In-Reply-To: <3d2e8e41-8b41-4d1d-9292-de90425708ec@arm.com>

On 17/03/2026 12:43, Kevin Brodsky wrote:
> On 17/03/2026 12:45, Ryan Roberts wrote:
>> On 17/03/2026 09:29, Kevin Brodsky wrote:
>>> On 17/03/2026 10:13, Ryan Roberts wrote:
>>>>>>> Another option would be to initially map by pte then collapse to
>>>>>>> block mappings
>>>>>>> once we have determined that all cpus support BBML2_NOABORT. We
>>>>>>> originally opted
>>>>>>> not to do that because it's a tax on symetric systems. But we could
>>>>>>> throw in the
>>>>>>> towel if it's the least bad solution we can come up with for solving
>>>>>>> this. I
>>>>>>> think it might help some of Kevin's use cases too?
>>>>>> May be an option too. When we discussed this there was no usecase for
>>>>>> direct mapping collapse. But if we can have multiple usecases, it may
>>>>>> be worth it. 
>>>> I could imagine that if user space creates and destroys lots of secretmem areas,
>>>> then it will completely split the linear map to ptes and that will never recover
>>>> currently. So I think in the long term, having the ability to collapse would be
>>>> useful. I just don't particularly like forcing symetric systems to map by pte
>>>> initially (which is slow) only to collapse later (which will cost even more
>>>> time). But it does feel inherrently more robust.
>>> Now that you spell it out, I'm realising this would actually make things
>>> pretty complicated for protected page tables. In that series, page
>>> tables for the linear map are allocated by a separate memblock-based
>>> allocator [1], tracking the allocated ranges to set their pkey later.
>>> There's a strong assumption that these page tables are never freed.
>>>
>>> If we initially PTE-mapped the linear map and then later collapsed it,
>>> that assumption clearly wouldn't hold. 
>> Sorry I don't understand why the assumptions change? All I'm proposing is walkng
>> the linear map to find compatible PTEs and collapsing them into the biggest
>> possible blocks. The pages aren't being freed, they are just being mapped
>> differently (which can be done live for BBML2_NOABORT). PTEs with different
>> pkeys would be considered incompatible, so we would end up with a boundary in
>> the leaf mappings at that point.
> 
> I'm not sure I'm following, if all entries in a PTE page are compatible,
> then surely we just convert the parent PMD entry to become a leaf and
> then free the PTE page? And same idea one level above.

Ahh - good point! That totally passed me by before. But I'm not sure it's the
end of the world...

We would end up with about 0.2% (4K/2M if I've done my maths correctly?) of the
linear map sub-optimally mapped. Personally I don't think that would be the end
of the world.

> 
>>
>>> It could be handled by poking
>>> holes in the tracked ranges, but it gets ugly and increases fragmentation.
>> You'd still want page tables to be allocated from contiguous physical (and
>> virtual) memory so that the boundaries where pkeys change are minimized.
> 
> Yes that's for sure, that's why I'm concerned with individual pages
> being freed in a middle of a block.
> 
>> I guess I've misunderstood something...
> 
> I might have too :/
> 
> - Kevin



      reply	other threads:[~2026-03-17 15:05 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-17 19:02 Yang Shi
2025-09-17 19:02 ` [PATCH v8 1/5] arm64: Enable permission change on arm64 kernel block mappings Yang Shi
2025-09-17 19:02 ` [PATCH v8 2/5] arm64: cpufeature: add AmpereOne to BBML2 allow list Yang Shi
2025-09-17 19:02 ` [PATCH v8 3/5] arm64: mm: support large block mapping when rodata=full Yang Shi
2025-11-01 16:14   ` Guenter Roeck
2025-11-02 10:31     ` Ryan Roberts
2025-11-02 12:11       ` Ryan Roberts
2025-11-02 15:13         ` Guenter Roeck
2025-11-02 17:46         ` Guenter Roeck
2025-11-02 17:49         ` Guenter Roeck
2025-11-02 17:52           ` Guenter Roeck
2025-11-03  0:47         ` Yang Shi
2025-11-03 10:07           ` Ryan Roberts
2025-11-03 16:21             ` Yang Shi
2025-11-03  5:53         ` Dev Jain
2025-09-17 19:02 ` [PATCH v8 4/5] arm64: mm: split linear mapping if BBML2 unsupported on secondary CPUs Yang Shi
2026-02-02  7:18   ` Arnd Bergmann
2026-02-02  7:43     ` Ard Biesheuvel
2026-02-02  8:11       ` Arnd Bergmann
2025-09-17 19:02 ` [PATCH v8 5/5] arm64: kprobes: call set_memory_rox() for kprobe page Yang Shi
2025-09-18 12:48   ` Catalin Marinas
2025-09-18 15:05     ` Yang Shi
2025-09-18 15:30       ` Ryan Roberts
2025-09-18 15:50         ` Yang Shi
2025-09-18 15:32       ` Catalin Marinas
2025-09-18 15:48         ` Yang Shi
2025-09-18 21:10 ` [PATCH v8 0/5] arm64: support FEAT_BBM level 2 and large block mapping when rodata=full Will Deacon
2025-09-19 10:08   ` Ryan Roberts
2025-09-19 11:27     ` Will Deacon
2025-09-19 11:49       ` Ryan Roberts
2025-09-19 11:56         ` Will Deacon
2025-09-19 12:00           ` Ryan Roberts
2025-09-19 18:44             ` Will Deacon
2025-09-23  7:15               ` Ryan Roberts
2025-09-19 14:55   ` Yang Shi
2026-03-16  7:35 ` Jinjiang Tu
2026-03-16 15:47   ` Ryan Roberts
2026-03-17  0:15     ` Yang Shi
2026-03-17  2:06       ` Jinjiang Tu
2026-03-17  9:07         ` Ryan Roberts
2026-03-17 17:03           ` Yang Shi
2026-03-18  8:29           ` Jinjiang Tu
2026-03-18  9:17             ` Ryan Roberts
2026-03-19  1:22               ` Jinjiang Tu
2026-03-17 17:12         ` Yang Shi
2026-03-17  8:47       ` Kevin Brodsky
2026-03-17  9:13         ` Ryan Roberts
2026-03-17  9:29           ` Kevin Brodsky
2026-03-17 11:45             ` Ryan Roberts
2026-03-17 12:43               ` Kevin Brodsky
2026-03-17 15:05                 ` Ryan Roberts [this message]

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=f7105fbe-2141-4036-a6b2-5ec4384b77e6@arm.com \
    --to=ryan.roberts@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cl@gentwo.org \
    --cc=david@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=kevin.brodsky@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=scott@os.amperecomputing.com \
    --cc=tujinjiang@huawei.com \
    --cc=will@kernel.org \
    --cc=yang@os.amperecomputing.com \
    /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