Page MenuHomeFreeBSD

amd64 pmap: Optimize PKU lookups when creating superpage mappings
ClosedPublic

Authored by alc on Jul 25 2024, 5:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 9:26 PM
Unknown Object (File)
Mon, Nov 4, 9:12 PM
Unknown Object (File)
Oct 3 2024, 2:28 PM
Unknown Object (File)
Oct 2 2024, 6:20 AM
Unknown Object (File)
Oct 2 2024, 4:24 AM
Unknown Object (File)
Sep 29 2024, 10:54 PM
Unknown Object (File)
Sep 28 2024, 12:43 AM
Unknown Object (File)
Sep 22 2024, 11:27 PM
Subscribers

Details

Summary

Modify pmap_pkru_same() to update the prototype PTE at the same time as
checking the address range. This eliminates the need for calling
pmap_pkru_get() in addition to pmap_pkru_same(). pmap_pkru_same() was
already doing most of the work of pmap_pkru_get().

A similar change was already made to BTI lookups on arm64.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

alc requested review of this revision.Jul 25 2024, 5:03 PM
alc created this revision.
alc retitled this revision from amd pmap: Optimize PKU lookups when creating superpage mappings to amd64 pmap: Optimize PKU lookups when creating superpage mappings.
sys/amd64/amd64/pmap.c
11493

But don't we need to clear X86_PG_PKRU_MASK first?

alc marked an inline comment as done.Jul 25 2024, 6:54 PM
alc added inline comments.
sys/amd64/amd64/pmap.c
11493

We don't set the PTE field using pmap_pkru_get() in pmap_enter() until after we've already called pmap_enter_largepage() or pmap_enter_pde(). Similarly, pmap_enter_object(), pmap_enter_2mpage(), and pmap_enter_quick() never call pmap_pkru_get(). They rely on pmap_enter_quick_locked() or pmap_enter_pde() to set the PTE field.

As a safety belt, I added the KASSERT("PKU field not set") to the start of pmap_pkru_same().

This revision is now accepted and ready to land.Jul 25 2024, 6:59 PM
alc marked an inline comment as done.Jul 26 2024, 5:30 AM