Skip to contentSkip to conversation

Fix v3.2.37-rt55 build break

PATCH In review John Kacur 2 participants 2 messages Jan 22, 2013 x86

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/1 Fix v3.2.37-rt55 build break

make O=/bld/v3.2.37-rt55/
make[2]: Nothing to be done for `relocs'.
Using /home/jkacur/linux-rt as source for kernel

  GEN     /bld/v3.2.37-rt55/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    /home/jkacur/linux-rt/scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC [M]  drivers/misc/sgi-xp/xpc_main.o

/home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c: In function ‘xpc_system_die’:
/home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c:1208: error:
‘X86_TRAP_DF’ undeclared (first use in this function) /home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c:1208: error: (Each undeclared identifier is reported only once /home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c:1208: error: for each function it appears in.) /home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c:1211: error:
‘X86_TRAP_MF’ undeclared (first use in this function) /home/jkacur/linux-rt/drivers/misc/sgi-xp/xpc_main.c:1212: error:
‘X86_TRAP_XF’ undeclared (first use in this function)
make[4]: *** [drivers/misc/sgi-xp/xpc_main.o] Error 1
make[3]: *** [drivers/misc/sgi-xp] Error 2
make[2]: *** [drivers/misc] Error 2
make[1]: *** [drivers] Error 2
make: *** [sub-make] Error 2

Clark Williams pointed out that this can be fixed by cherry-picking c94082656dac74257f63e91f78d5d458ac781fa5
However, there are build conflicts with the rt-patch

The following is my fix applied to the rt-kernel, but it's fine with me if you want to do the cherry-pick against the stable kernel, and then respin fix-rt-int3-x86_32-3.2-rt.patch

Note, I believe this is correct but we're still doing our internal testing.

commit 8c71778132f732bb45ec00c2bda1e39114098479

Author: Kees Cook <[email protected]>
Date:   Fri Mar 9 16:07:10 2012 -0800

x86: Use enum instead of literals for trap values

commit c94082656dac74257f63e91f78d5d458ac781fa5 upstream

The traps are referred to by their numbers and it can be difficult to understand them while reading the code without context. This patch adds enumeration of the trap numbers and replaces the numbers with the correct enum for x86.

Cherry-picked-for: v3.2-rt
Conflicts:
arch/x86/kernel/traps.c

arch/x86/include/asm/traps.h +25 -0
index 0012d09..88eae2a 100644
@@ -89,4 +89,29 @@ asmlinkage void smp_thermal_interrupt(void);
 asmlinkage void mce_threshold_interrupt(void);
 #endif
 
+/* Interrupts/Exceptions */
+enum {
+	X86_TRAP_DE = 0,	/*  0, Divide-by-zero */
+	X86_TRAP_DB,		/*  1, Debug */
+	X86_TRAP_NMI,		/*  2, Non-maskable Interrupt */
+	X86_TRAP_BP,		/*  3, Breakpoint */
+	X86_TRAP_OF,		/*  4, Overflow */
+	X86_TRAP_BR,		/*  5, Bound Range Exceeded */
+	X86_TRAP_UD,		/*  6, Invalid Opcode */
+	X86_TRAP_NM,		/*  7, Device Not Available */
+	X86_TRAP_DF,		/*  8, Double Fault */
+	X86_TRAP_OLD_MF,	/*  9, Coprocessor Segment Overrun */
+	X86_TRAP_TS,		/* 10, Invalid TSS */
+	X86_TRAP_NP,		/* 11, Segment Not Present */
+	X86_TRAP_SS,		/* 12, Stack Segment Fault */
+	X86_TRAP_GP,		/* 13, General Protection Fault */
+	X86_TRAP_PF,		/* 14, Page Fault */
+	X86_TRAP_SPURIOUS,	/* 15, Spurious Interrupt */
+	X86_TRAP_MF,		/* 16, x87 Floating-Point Exception */
+	X86_TRAP_AC,		/* 17, Alignment Check */
+	X86_TRAP_MC,		/* 18, Machine Check */
+	X86_TRAP_XF,		/* 19, SIMD Floating-Point Exception */
+	X86_TRAP_IRET = 32,	/* 32, IRET Exception */
+};
+
 #endif /* _ASM_X86_TRAPS_H */
arch/x86/kernel/irqinit.c +1 -1
index b3300e6..e328f69 100644
@@ -61,7 +61,7 @@ static irqreturn_t math_error_irq(int cpl, void *dev_id)
 	outb(0, 0xF0);
 	if (ignore_fpu_irq || !boot_cpu_data.hard_math)
 		return IRQ_NONE;
-	math_error(get_irq_regs(), 0, 16);
+	math_error(get_irq_regs(), 0, X86_TRAP_MF);
 	return IRQ_HANDLED;
 }
 
arch/x86/kernel/traps.c +75 -61

254 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · John Kacur

The following is my fix applied to the rt-kernel, but it's fine with me if you want to do the cherry-pick against the stable kernel, and then respin fix-rt-int3-x86_32-3.2-rt.patch

Does this fail on vanilla 3.2.37 as well? If so, we need to push it to mainline stable, and then wait for it to be included for -rt.

-- Steve