Page MenuHomeFreeBSD

loader: allocate the memdisk decompression buffer as EfiLoaderData
Needs ReviewPublic

Authored by olivier on Tue, Sep 15, 2:56 PM.
Tags
None
Referenced Files
F172898830: D59697.diff
Mon, Sep 21, 10:44 PM
F172790299: D59697.diff
Mon, Sep 21, 12:42 AM
Unknown Object (File)
Sat, Sep 19, 10:29 PM
Unknown Object (File)
Fri, Sep 18, 7:31 PM
Unknown Object (File)
Fri, Sep 18, 7:30 PM
Unknown Object (File)
Wed, Sep 16, 5:54 PM
Unknown Object (File)
Wed, Sep 16, 4:31 AM
Unknown Object (File)
Wed, Sep 16, 3:43 AM
Subscribers
None

Details

Reviewers
imp
Summary

A memdisk= image reaches the kernel as a preloaded md(4), so its pages must be in physmap.
Add_efi_map_entries() admits only EFI_MD_TYPE_CODE/DATA/FREE, so EfiReservedMemoryType gets no direct map and mdstart_preload() faults at base + mediasize - 512.
EfiLoaderData is EFI_MD_TYPE_DATA, already used for the kernel and modules.

Test Plan

Booting a 2 GB disk image with memdisk=<url> panics in mdstart_preload()
when the image is served xz-compressed. The same image served
uncompressed boots fine.

he fault is always a read of the final 512-byte sector of the registered
region: fault_addr == preload_base + mediasize - 512. The loader registers a
region whose span matches mediasize exactly, but the last sector of it is not
mapped, so the first UFS read that touches it faults.

Reproduced 3/3 on the compressed path, 0/1 on the uncompressed path.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

olivier created this revision.

Hmmm, reserved is the right type for nvdimm, but it does pmap_large_map() instead of mpam_map(), but both of those should yield the same results...

So help me understand... Can you do a bootverbose w/o the patch? Why would the uncompressed one work, but the compressed one fail after decompression...

But also do a 'show' command at the OK prompt before you do a boot -v so I can see the md.0.xxxx values and compare them against the phys_avail.