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, Sep 29, 10:54 PM
Unknown Object (File)
Sat, Sep 28, 12:43 AM
Unknown Object (File)
Sun, Sep 22, 11:27 PM
Unknown Object (File)
Sat, Sep 14, 12:04 AM
Unknown Object (File)
Aug 22 2024, 2:15 PM
Unknown Object (File)
Aug 22 2024, 6:45 AM
Unknown Object (File)
Aug 17 2024, 6:33 AM
Unknown Object (File)
Aug 5 2024, 5:33 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