|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/cpu: reposition stack alignment check
commit 99a10da1b4fee8ef7a096e5fd3608f6c15932eb0
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 28 09:17:00 2016 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 28 09:17:00 2016 +0100
x86/cpu: reposition stack alignment check
As identified during review, using BUG_ON() before `lidt` will result in a
triple fault, even on APs.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
xen/arch/x86/cpu/common.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 06ee401..1d78ab4 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -643,11 +643,6 @@ void load_system_tables(void)
.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
};
- /* Bottom-of-stack must be 16-byte aligned! */
- BUILD_BUG_ON((sizeof(struct cpu_info) -
- offsetof(struct cpu_info, guest_cpu_user_regs.es)) & 0xf);
- BUG_ON(system_state != SYS_STATE_early_boot && (stack_bottom & 0xf));
-
/* Main stack for interrupts/exceptions. */
tss->rsp0 = stack_bottom;
tss->bitmap = IOBMP_INVALID_OFFSET;
@@ -672,6 +667,15 @@ void load_system_tables(void)
asm volatile ("lidt %0" : : "m" (idtr) );
asm volatile ("ltr %w0" : : "rm" (TSS_ENTRY << 3) );
asm volatile ("lldt %w0" : : "rm" (0) );
+
+ /*
+ * Bottom-of-stack must be 16-byte aligned!
+ *
+ * Defer checks until exception support is sufficiently set up.
+ */
+ BUILD_BUG_ON((sizeof(struct cpu_info) -
+ offsetof(struct cpu_info, guest_cpu_user_regs.es)) & 0xf);
+ BUG_ON(system_state != SYS_STATE_early_boot && (stack_bottom & 0xf));
}
/*
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |