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
Unknown Object (File)
Mon, Dec 9, 3:13 AM
Unknown Object (File)
Sun, Dec 1, 10:55 PM
Unknown Object (File)
Nov 25 2024, 9:08 AM
Unknown Object (File)
Nov 21 2024, 7:37 PM
Unknown Object (File)
Nov 21 2024, 12:08 PM
Unknown Object (File)
Nov 20 2024, 2:10 AM
Unknown Object (File)
Nov 12 2024, 5:18 PM
Unknown Object (File)
Nov 7 2024, 4:21 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.