[PATCH] preempt: fix kernel build with !CONFIG_BKL

From: Arnd Bergmann
Date: Thu Oct 28 2010 - 07:21:42 EST


The preempt count logic tries to take the BKL into account, which breaks
when CONFIG_BKL is not set.

Use the same preempt_count offset that we use without CONFIG_PREEMPT
when CONFIG_BKL is disabled.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Reported-by: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx>

---
> /home/kas/git/tmp/linux-2.6-local/arch/x86/include/asm/i387.h: In function âirq_ts_saveâ:
> /home/kas/git/tmp/linux-2.6-local/arch/x86/include/asm/i387.h:324: error: implicit declaration of function âkernel_lockedâ
> make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
> make: *** [prepare0] Error 2

Ah, found it. I had not considered or tested the case of CONFIG_BKL=n
with CONFIG_PREEMPT=y.

Does this work? Ideally please test with LOCKDEP enabled to see if
there are other problems in this configuration that I missed.

--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -96,7 +96,7 @@
*/
#define in_nmi() (preempt_count() & NMI_MASK)

-#if defined(CONFIG_PREEMPT)
+#if defined(CONFIG_PREEMPT) && defined(CONFIG_BKL)
# define PREEMPT_INATOMIC_BASE kernel_locked()
# define PREEMPT_CHECK_OFFSET 1
#else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/