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)
Mon, Mar 10, 10:48 PM
Unknown Object (File)
Feb 16 2025, 9:56 AM
Unknown Object (File)
Feb 15 2025, 4:34 PM
Unknown Object (File)
Feb 9 2025, 10:10 PM
Unknown Object (File)
Feb 8 2025, 7:10 PM
Unknown Object (File)
Jan 23 2025, 6:37 PM
Unknown Object (File)
Jan 5 2025, 1:24 PM
Unknown Object (File)
Dec 18 2024, 7:21 AM
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

Lint
Lint Skipped
Unit
Tests Skipped

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