Re: [PATCH v2 00/18] Entry stack switching

From: Ingo Molnar
Date: Thu Nov 23 2017 - 01:44:23 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> > Anyway, I booted your config (more or less -- I munged it through
> > virtme-configkernel --update first) with 17 vCPUs and it seems fine.
> > Is the issue reliable enough to bisect?
>
> Ok, it should be bisectable, will try to bisect it.

The latestest entry-stack code appears to be working fine though.

So one of the below fixes from yesterday appears to have done the trick.

I'll re-test today to make sure: maybe it's more sporadic than I thought, in one
of the bootups I got the do_IRQ warning only once, in half a day of uptime.

Thanks,

Ingo

=================>

diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index f1cef194dfba..3d404f8d0443 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -51,15 +51,19 @@ ENTRY(native_usergs_sysret64)
END(native_usergs_sysret64)
#endif /* CONFIG_PARAVIRT */

-.macro TRACE_IRQS_IRETQ
+.macro TRACE_IRQS_FLAGS flags:req
#ifdef CONFIG_TRACE_IRQFLAGS
- bt $9, EFLAGS(%rsp) /* interrupts off? */
+ bt $9, \flags /* interrupts off? */
jnc 1f
TRACE_IRQS_ON
1:
#endif
.endm

+.macro TRACE_IRQS_IRETQ
+ TRACE_IRQS_FLAGS EFLAGS(%rsp)
+.endm
+
/*
* When dynamic function tracer is enabled it will add a breakpoint
* to all locations that it is about to modify, sync CPUs, update
@@ -1069,11 +1073,13 @@ ENTRY(native_load_gs_index)
FRAME_BEGIN
pushfq
DISABLE_INTERRUPTS(CLBR_ANY & ~CLBR_RDI)
+ TRACE_IRQS_OFF
SWAPGS
.Lgs_change:
movl %edi, %gs
2: ALTERNATIVE "", "mfence", X86_BUG_SWAPGS_FENCE
SWAPGS
+ TRACE_IRQS_FLAGS (%rsp)
popfq
FRAME_END
ret
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index 8562356213cd..15cf010225c9 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -47,10 +47,9 @@ extern unsigned long __FIXADDR_TOP;
/*
* cpu_entry_area is a percpu region in the fixmap that contains things
* needed by the CPU and early entry/exit code. Real types aren't used
- * for all fields here to about circular header dependencies.
+ * for all fields here to avoid circular header dependencies.
*/
-struct cpu_entry_area
-{
+struct cpu_entry_area {
char gdt[PAGE_SIZE];

/*
@@ -232,8 +231,7 @@ static inline unsigned int __get_cpu_entry_area_page_index(int cpu, int page)

static inline struct cpu_entry_area *get_cpu_entry_area(int cpu)
{
- return (struct cpu_entry_area *)
- __fix_to_virt(__get_cpu_entry_area_page_index(cpu, 0));
+ return (struct cpu_entry_area *)__fix_to_virt(__get_cpu_entry_area_page_index(cpu, 0));
}

#endif /* !__ASSEMBLY__ */