Re: [PATCH v2 0/6] arch, mm/execmem: resolve confusion about set_direct_map_valid_noflush()
Mike Rapoport <[email protected]>
| Newsgroups | dev.linux.lists.loongarch,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.linux-s390,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Aug 27, 2026 at 10:39:47PM -0700, Andrew Morton wrote: > On Sun, 23 Aug 2026 14:46:11 +0300 "Mike Rapoport (Microsoft)" <[email protected]> wrote: > > > Recent discussion about implementation of execmem's ROX caches on arm64 > > I'm assuming a "[1]" reference was intended here. Yes :) > > revealed a confusion about how set_direct_map_valid_noflush() > > implemented on different architectures. > > > > On arm64 it sets or clears the PTE_VALID bit marking a PTE as present or > > not present. > > > > On other architectures it's a range version of > > set_direct_map_invalid_noflush() and set_direct_map_default_noflush() > > > > Unlike arm64::set_direct_map_valid_noflush(), > > set_direct_map_default_noflush() not only marks PTE as present, but also > > sets its default protection mode. > > > > Other than that, initial design of execmem ROX caches didn't rely on > > restoration of large mappings that's now available on x86, but > > completely removed the memory allocated for the ROX cache from the > > direct map to ensure that large mappings are not split. This precluded > > usage of VM_FLUSH_RESET_PERMS for the ROX cache allocations and required > > execmem to implement manipulation of the direct map alias. > > > > Current implementation of ROX caches does not remove the direct map > > alias but simply calls set_memory_rox() that updates the permissions in > > both vmalloc address space and the direct map and relies on > > collapse_large_pages() in x86 CPA to keep large mappings. > > > > This allow using VM_FLUSH_RESET_PERMS for execmem ROX cache allocations > > with small adjustments to set_direct_map APIs and vmalloc::reset_perms() > > behaviour: adding number of pages parameter to set_direct_map APIs and > > making resetting of the direct map permissions in vmalloc VMAP_HUGE > > friendly. > > > > Implement these adjustments, make execmem always use > > VM_FLUSH_RESET_PERMS and revert set_direct_map_valid_noflush() changes. > > > > [1] https://lore.kernel.org/all/[email protected] > > The patchset is perhaps a little green but I tossed it in there, thanks. > > I hit a few rejects in arch/x86/mm/pat/set_memory.c, but minor stuff. > > I trust you've seen Sashiko's incidental oh-btw comments. > > https://sashiko.dev/#/patchset/[email protected] Yeah, it did discover something fishy with the fallbacks handling. I'm looking into it. -- Sincerely yours, Mike.