Skip to contentSkip to conversation

preempt emulation miscompile fix

PATCH Applied Andrea Arcangeli 2 participants 2 messages Feb 12, 2008 KVM

lore
Share & tools
lore
#0 lore raw

Hello,

I tracked down the reason of my kernel crashing builds with the latest kvm-userland package. It has taken a bit of time because with certain workloads this wouldn't crash. I've been testing stuff with preempt emulation enabled most of the time to be sure it worked (and to fix the host breakpoint too). This will fix it by importing the task struct before we define CONFIG_PREEMPT_NOTIFIERS. preempt.h is most certainly unnecessary but it's a good rule of thumb to include anything that uses CONFIG_PREEMPT_NOTIFIERS before defining it.

kernel/external-module-compat.h +6 -0
index 3b45999..fe6108c 100644
@@ -348,6 +348,12 @@ static inline unsigned long long __kvm_cmpxchg64(volatile void *ptr,
 #endif
 
 #ifndef CONFIG_PREEMPT_NOTIFIERS
+/*
+ * Include sched|preempt.h before defining CONFIG_PREEMPT_NOTIFIERS to avoid
+ * a miscompile.
+ */
+#include <linux/sched.h>
+#include <linux/preempt.h>
 #define CONFIG_PREEMPT_NOTIFIERS
 #define CONFIG_PREEMPT_NOTIFIERS_COMPAT
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Applied
#1 lore raw
Quoted 12 lines · Andrea Arcangeli

Hello,

I tracked down the reason of my kernel crashing builds with the latest kvm-userland package. It has taken a bit of time because with certain workloads this wouldn't crash. I've been testing stuff with preempt emulation enabled most of the time to be sure it worked (and to fix the host breakpoint too). This will fix it by importing the task struct before we define CONFIG_PREEMPT_NOTIFIERS. preempt.h is most certainly unnecessary but it's a good rule of thumb to include anything that uses CONFIG_PREEMPT_NOTIFIERS before defining it.

Applied, thanks.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/