Page MenuHomeFreeBSD

Allow vm_fault_quick_hold_pages() to specify that nofault mode should be honored.
ClosedPublic

Authored by kib on Mar 24 2018, 2:02 PM.
Tags
None
Referenced Files
F132446185: D14825.id.diff
Fri, Oct 17, 12:35 AM
F132446183: D14825.id40751.diff
Fri, Oct 17, 12:35 AM
F132446182: D14825.id40703.diff
Fri, Oct 17, 12:35 AM
F132446179: D14825.id40694.diff
Fri, Oct 17, 12:35 AM
F132446166: D14825.id40688.diff
Fri, Oct 17, 12:35 AM
F132404231: D14825.diff
Thu, Oct 16, 3:44 PM
Unknown Object (File)
Tue, Oct 14, 1:50 AM
Unknown Object (File)
Sun, Oct 12, 1:43 AM
Subscribers

Details

Summary

This is a bit from D14633 needed to implement copyout(9).

We must not sleep or acquire any MI VM locks if TDP_NOFAULTING is specified. On the other hand, there were some callers in the tree which set TDP_NOFAULTING for larger scope than needed, I fixed the code which I wrote, but I suspect that linuxkpi and out of tree drm drivers might abuse this still.

So I only enable the mode for vm_fault_quick_hold_pages() where vm_fault_hold() is not called when specifically asked by user. I decided to use vm_prot_t flag to not change KPI. Since number of flags in vm_prot_t is limited, I reused the same flag which was already consumed for vm_map_lookup().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/vm/vm.h
83 ↗(On Diff #40688)

This is pedantic but 0x10 would look more correct. vm_prot_t is only 8 bits wide.

sys/vm/vm_fault.c
1526 ↗(On Diff #40688)

I'd add a comment explaining the motivation for QUICK_NOFAULT here.

This revision is now accepted and ready to land.Mar 24 2018, 3:45 PM
kib marked 2 inline comments as done.

Mark' notes.

This revision now requires review to proceed.Mar 24 2018, 4:01 PM
markj added inline comments.
sys/vm/vm_fault.c
1529 ↗(On Diff #40694)

There should be a comma after i.e.

I would remove the comma after "sleep."

1530 ↗(On Diff #40694)

"which means we must not call vm_fault_hold()"?

1532 ↗(On Diff #40694)

"too wide a code area"

This revision is now accepted and ready to land.Mar 24 2018, 6:18 PM
kib marked 3 inline comments as done.

Correct grammar.

This revision now requires review to proceed.Mar 24 2018, 6:28 PM
This revision was not accepted when it landed; it landed in state Needs Review.Mar 26 2018, 4:31 PM
This revision was automatically updated to reflect the committed changes.