Page MenuHomeFreeBSD

x86/xen: ignore error to fetch memory map in xen_arch_init_physmem()
ClosedPublic

Authored by royger on Aug 1 2024, 3:44 PM.
Tags
None
Referenced Files
F96383849: D46205.diff
Tue, Sep 24, 7:00 PM
Unknown Object (File)
Tue, Sep 24, 4:08 PM
Unknown Object (File)
Sun, Sep 22, 1:33 PM
Unknown Object (File)
Sat, Sep 21, 4:56 AM
Unknown Object (File)
Fri, Sep 20, 12:52 PM
Unknown Object (File)
Fri, Sep 20, 12:52 PM
Unknown Object (File)
Thu, Sep 19, 6:47 AM
Unknown Object (File)
Tue, Sep 17, 12:45 PM

Details

Summary

Some implementations of Xen don't expose the XENMEM_memory_map hypercall.
Shallow the error from XENMEM_memory_map in xen_arch_init_physmem() and just
return 0. This will fallback to using the non-arch specific mechanism for
allocating scratch space.

Reported by: cperciva
Fixes: 69c47485b5f9 ('x86/xen: use UNUSABLE e820 regions for external mappings')
Sponsored by: Cloud Software Group

Diff Detail

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

Event Timeline

royger requested review of this revision.Aug 1 2024, 3:44 PM

This is basically okay, but there urgently needs to be a comment here. At a future point the versions of Xen which lack this hypercall will no longer have any support and the error should instead be returned. This will likely be at least 5 years before this can be done, but there should be a comment with specific information.

sys/x86/xen/hvm.c
566

This needs a comment:

#if xen_4_20_no_longer_supported
                    return (error);
#elif xen_4_16_no_longer_supported
                    /* once Xen 4.20 isn't supported by anyone this should be removed */
                    printf("Warning: unable to retrieve Xen memory map, update to newer Xen version!");
                    return (0);
#else
                    /* once Xen 4.16 isn't supported by anyone this should be removed */
                    return (0);
#endif
sys/x86/xen/hvm.c
566

This hypercall has been available since Xen 4.6, yet AWS seems to hide it. There's no reason to return the error, and thus refuse to boot when FreeBSD can operate without that hypercall being available.

The one comment can be done on commit.

sys/x86/xen/hvm.c
566

Ah, that seems reasonable. Though perhaps there should still be a printf() to indicate the memory regions were not obtained from Xen? At the very least if bootverbose != 0 there likely should be.

This revision is now accepted and ready to land.Aug 1 2024, 8:58 PM
sys/x86/xen/hvm.c
566

There's already a message printed once if the per-arch ranges are empty, I'm not sure it's helpful to print yet one more message here.

sys/x86/xen/hvm.c
566

Emphasis on "perhaps" then? I understand the reasoning.

Colin, could you please add Elliot Reviewed by tag when committing, if this turns out to fix the issues you saw on AWS? Thanks.

sys/x86/xen/hvm.c
566

Thanks, will leave as-is then.

Thank you! Works perfectly on the "Xen 4.11" EC2 instances.