-
Notifications
You must be signed in to change notification settings - Fork 180
Fix Xen PVH boot and init_physical_heap low-memory trimming bug #2137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,8 @@ extern pvh_start | |
|
|
||
| bits 32 | ||
| pvh_start32: | ||
| ; ESP is undefined at PVH entry, we need a temporary stack before calls | ||
| mov esp, 0xa000 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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). |
||
| PREPARE_LONG_MODE eax | ||
| ; set up minimal mapping to be able to run in 64-bit mode, carving page | ||
| ; tables from the top of the first 1MB of memory (which will not be | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
| #include <symtab.h> | ||
| #include <drivers/acpi.h> | ||
|
|
||
| extern boolean pvh_boot; | ||
|
|
||
| //#define INT_DEBUG | ||
| #ifdef INT_DEBUG | ||
| #define int_debug(x, ...) do {tprintf(sym(int), 0, ss(x), ##__VA_ARGS__);} while(0) | ||
|
|
@@ -212,7 +214,7 @@ void common_handler() | |
| if (handlers[i]) { | ||
| ci->state = cpu_interrupt; | ||
| apply(handlers[i]); | ||
| if (i >= INTERRUPT_VECTOR_START) | ||
| if (i >= INTERRUPT_VECTOR_START && !pvh_boot) | ||
| lapic_eoi(); | ||
|
|
||
| /* enqueue interrupted user thread */ | ||
|
|
@@ -383,8 +385,9 @@ void init_interrupts(kernel_heaps kh) | |
| assert(v != INVALID_PHYSICAL); | ||
| spurious_int_vector = v; | ||
|
|
||
| /* APIC initialization */ | ||
| init_apic(kh); | ||
| /* APIC initialization, skip for PVH (Xen uses event channels) */ | ||
| if (!pvh_boot) | ||
| init_apic(kh); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| } | ||
|
|
||
| void triple_fault(void) | ||
|
|
||
There was a problem hiding this comment.
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.