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)
Thu, Nov 7, 4:21 PM
Unknown Object (File)
Wed, Oct 16, 8:16 PM
Unknown Object (File)
Tue, Oct 15, 5:44 PM
Unknown Object (File)
Oct 13 2024, 4:23 PM
Unknown Object (File)
Oct 11 2024, 1:14 PM
Unknown Object (File)
Oct 10 2024, 1:37 PM
Unknown Object (File)
Oct 9 2024, 8:49 AM
Unknown Object (File)
Oct 9 2024, 8:48 AM

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
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

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.