Page MenuHomeFreeBSD

lkpi_vmf_insert_pfn_prot_locked(): detect uninitialized pages
Needs ReviewPublic

Authored by kib on Tue, Sep 8, 12:18 PM.

Details

Reviewers
alc
markj
Summary
This would not detect an unitialized page at the physical address zero,
but otherwise should be reliable.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Tue, Sep 8, 12:18 PM

I understand that the immediate objection would be that memset's on the vm_page_array[] are slow and somewhat against the lazy initialization of vm_pages. But this is plain memset instead of the CPU-intensive calculations of proper vm_pages.

This should work against the class of drivers bugs where vma is created against a region that is not registered with the fictitious managed range. I was bitten by drm 6.12 on my new (but quite old) KabyLake notebook.

I don't really understand how this fixes the problem: even if a fictitious range was registered, PHYS_TO_VM_PAGE will try to find the page from the vm_page_array first. What exactly is the driver bug?

Can we make the zeroing conditional on INVARIANTS? Alternately, maybe @cperciva would be willing to benchmark this change in EC2, that was where a lot of the work described here was tested: https://wiki.freebsd.org/BootTime