Page MenuHomeFreeBSD

x86/xen: fix migration when ACPI suspend is not available
ClosedPublic

Authored by royger on Feb 6 2024, 8:43 AM.
Tags
Referenced Files
F98814404: D43765.diff
Fri, Oct 4, 8:36 PM
F98608995: D43765.id133929.diff
Fri, Oct 4, 1:14 AM
Unknown Object (File)
Tue, Oct 1, 9:11 AM
Unknown Object (File)
Mon, Sep 30, 6:09 AM
Unknown Object (File)
Sat, Sep 28, 10:13 PM
Unknown Object (File)
Fri, Sep 27, 9:22 PM
Unknown Object (File)
Fri, Sep 27, 6:40 PM
Unknown Object (File)
Fri, Sep 27, 10:15 AM
Subscribers

Details

Summary

Xen PVH guests expose a very minimal set of ACPI tables, and due to the lack of
SCI interrupt FreeBSD doesn't allocate the suspend stacks for saving for CPU
and FPU contexts.

Such lack of context would lead to a page-fault in cpususpend_handler() when
CPUs attempted to use the save context area as a result of a Xen suspend
request. However there's no need to save the CPU or the FPU registers in the
Xen case, as that's all handled by the hypervisor. Hence avoid saving all this
state if the suspend stacks are not allocated.

Note that this will currently only apply to PVH guests, HVM ones will still get
the stack allocated and the context saved even when not strictly required. I
find it easier rather that having to provide cpususpend_handler() with extra
information whether the context needs to be saved or not.

Sponsored by: Cloud Software Group

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

royger requested review of this revision.Feb 6 2024, 8:43 AM
sys/x86/x86/mp_x86.c
1600

I think a comment summarizing the commit message would be helpful here.

royger added inline comments.
sys/x86/x86/mp_x86.c
1600

I wonder whether I should add some ASSERT here that we are at least running as a Xen guest, but that would require including xen-os.h header to this otherwise common file.

markj added inline comments.
sys/x86/x86/mp_x86.c
1600

Is it sufficient to assert vm_guest == VM_GUEST_XEN?

This revision is now accepted and ready to land.Feb 7 2024, 1:32 PM
royger added inline comments.
sys/x86/x86/mp_x86.c
1600

It is, I'm just used to the xen_domain() macros, added that.

royger marked an inline comment as done.

Add Xen guest assert.

This revision now requires review to proceed.Feb 16 2024, 11:57 AM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 16 2024, 1:17 PM
This revision was automatically updated to reflect the committed changes.