Skip to content

Fix Xen PVH boot and init_physical_heap low-memory trimming bug#2137

Open
niklasfemerstrand wants to merge 1 commit intonanovms:masterfrom
niklasfemerstrand:pvh_boot
Open

Fix Xen PVH boot and init_physical_heap low-memory trimming bug#2137
niklasfemerstrand wants to merge 1 commit intonanovms:masterfrom
niklasfemerstrand:pvh_boot

Conversation

@niklasfemerstrand
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@francescolavra francescolavra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! A few comments inline

Comment thread platform/pc/service.c
init_acpi_tables(get_kernel_heaps());
/* Read ACPI tables for MADT access (not available on PVH) */
if (!pvh_boot)
init_acpi_tables(get_kernel_heaps());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to call both init_acpi_tables() and init_acpi() on a guest without ACPI, in fact Nanos runs just fine on ARM guests without ACPI. I also tested a modified kernel where the AcpiOsGetRootPointer() function in src/x86_64/acpi.c always returns 0 (to simulate an x86 guest without ACPI) and it boots just fine, both with and without KVM.
If the kernel crashes on a Xen PVH guest when trying to initialize ACPI, I would rather debug and fix that, and avoid the pvh_boot global variable.

Comment thread src/x86_64/init.s
bits 32
pvh_start32:
; ESP is undefined at PVH entry, we need a temporary stack before calls
mov esp, 0xa000
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but since there already is a stack pointer initialization a few instructions below this, I would remove that in favor of this one (and update/move the relevant comment).

Comment thread src/x86_64/interrupt.c
init_apic(kh);
/* APIC initialization, skip for PVH (Xen uses event channels) */
if (!pvh_boot)
init_apic(kh);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the Xen source, and as far as I can tell, Xen PVH guests do have a local APIC (see https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/x86/domain.c;h=9ba2774762ccfc2b79d6892c55eaa06e5e66ac29;hb=HEAD#l784, where the LAPIC emulation flag is marked as required for PVH domU). So if there are issues getting it to work, I prefer to sort them out instead of disabling the APIC code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants