Page MenuHomeFreeBSD

Clean up a couple of MD warts in vm_fault_populate():
ClosedPublic

Authored by jah on Mar 27 2021, 3:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 21, 2:25 AM
Unknown Object (File)
Jan 27 2024, 9:43 PM
Unknown Object (File)
Jan 13 2024, 4:39 AM
Unknown Object (File)
Dec 31 2023, 1:01 AM
Unknown Object (File)
Dec 18 2023, 7:21 PM
Unknown Object (File)
Dec 14 2023, 11:38 PM
Unknown Object (File)
Dec 12 2023, 12:35 PM
Unknown Object (File)
Nov 30 2023, 11:40 PM

Details

Summary

--Eliminate a big ifdef that encompassed all currently-supported
architectures except mips and powerpc32. This applied to the case
in which we've allocated a superpage but the pager-populated range
is insufficient for a superpage mapping. For platforms that don't
support superpages the check should be inexpensive as we shouldn't
get a superpage in the first place. Make the normal-page fallback
logic identical for all platforms and provide a simple implementation
of pmap_ps_enabled() for MIPS and Book-E/AIM32 powerpc.

--Apply the logic for handling pmap_enter() failure if a superpage
mapping can't be supported due to higher-level protection policy.
Use KERN_PROTECTION_FAILURE instead of KERN_FAILURE for this case,
and note Intel PKU on amd64 as the first example of such protection
policy.

Diff Detail

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

Event Timeline

jah requested review of this revision.Mar 27 2021, 3:17 AM
sys/powerpc/aim/mmu_oea.c
1128

For PowerPC I believe pmap_nomethod() dispatch should work for the purpose of this change without needing these added functions. In fact it seems that it already is for 64-bit Book E MMUs. But it seemed less fragile to provide the real dispatch entries since we already allocate them anyway.

sys/amd64/amd64/pmap.c
7150

This is fine and makes things consistent with pmap_enter_largepage(), but now I see that there are some issues with KERN_PROTECTION_FAILURE.

Since they are mine and pre-existing, I propose D29442.

This revision is now accepted and ready to land.Mar 27 2021, 3:07 PM
sys/vm/vm_fault.c
562

I would say 'lower-level', since PKRU is somewhere below pmap. Or remove the 'higher-level' words.

578–579

IMO it would be cleaner to assert rv value right after pmap_enter(). Something like
MPASS(rv == KERN_SUCCESS || (psind > 0 && rv == KERN_PROTECTION_FAILURE);

Adjust wording in comment, rearrange return value assertion

This revision now requires review to proceed.Mar 27 2021, 8:42 PM
This revision is now accepted and ready to land.Mar 27 2021, 9:30 PM
bdragon added a subscriber: bdragon.

OK PowerPC