Thread (20 messages) 20 messages, 5 authors, 2021-10-24

Re: [PATCH v2 7/7] ARM: implement support for vmap'ed stacks

From: Ard Biesheuvel <ardb@kernel.org>
Date: 2021-10-18 15:46:24

On Mon, 18 Oct 2021 at 17:34, Nicolas Pitre [off-list ref] wrote:
On Mon, 18 Oct 2021, Ard Biesheuvel wrote:
quoted
+void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
+{
+     if (start > VMALLOC_END || end < VMALLOC_START)
+             return;
+
+     /*
+      * This hooks into the core vmalloc code to receive notifications of
+      * any PMD level changes that have been made to the kernel page tables.
+      * This means it should only be triggered once for every MiB worth of
+      * vmalloc space, given that we don't support huge vmalloc/vmap on ARM,
+      * and that kernel PMD level table entries are rarely (if ever)
+      * updated.
+      *
+      * This means that the counter is going to max out at ~250 for the
+      * typical case. If it overflows, something entirely unexpected has
+      * occurred so let's throw a warning if that happens.
+      */
+     WARN_ON(++init_mm.context.vmalloc_seq == UINT_MAX);
I don't understand the logic here. Yes, changes are not that frequent
and this is pretty unlikely to ever wrap. But given an infinite run
time, it could wrap and that woule be OK.
Each PMD entry covers 1 MB of space (assuming short descriptors), and
is either invalid or points to a page table containing page entries
for every 4k block in that 1 MB of space.

My reasoning was that, given that we don't have huge vmaps on ARM, and
that we never free those lower level page tables once they are
allocated and linked into the tree, the only transition such a PMD
entry can make is from invalid to valid table entry.

Did I miss anything?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help