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
F102103350: D43765.id133929.diff
Thu, Nov 7, 3:54 PM
Unknown Object (File)
Wed, Oct 16, 4:44 PM
Unknown Object (File)
Tue, Oct 15, 7:43 AM
Unknown Object (File)
Tue, Oct 15, 7:43 AM
Unknown Object (File)
Sun, Oct 13, 5:33 PM
Unknown Object (File)
Sun, Oct 13, 4:01 AM
Unknown Object (File)
Sat, Oct 12, 1:18 AM
Unknown Object (File)
Thu, Oct 10, 6:36 PM
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.