Page MenuHomeFreeBSD

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

Authored by jah on Sat, Mar 27, 3:17 AM.

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
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

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

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.Sat, Mar 27, 3:07 PM
sys/vm/vm_fault.c
561

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.Sat, Mar 27, 8:42 PM
This revision is now accepted and ready to land.Sat, Mar 27, 9:30 PM
bdragon added a subscriber: bdragon.

OK PowerPC