Skip to contentSkip to conversation

2.5.38 s390 fixes: 11_preempt.

PATCH New Martin Schwidefsky 1 participant 1 message Sep 24, 2002 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.38 s390 fixes: 11_preempt.

Add support for kernel preemption on s390/s390x.

arch/s390/config.in +1 -0
diff -urN linux-2.5.38/arch/s390/config.in linux-2.5.38-s390/arch/s390/config.in
@@ -30,6 +30,7 @@
 fi
 
 comment 'Misc'
+bool 'Preemptible Kernel' CONFIG_PREEMPT
 bool 'Builtin IPL record support' CONFIG_IPL
 if [ "$CONFIG_IPL" = "y" ]; then
   choice 'IPL method generated into head.S' \
arch/s390/defconfig +1 -0
diff -urN linux-2.5.38/arch/s390/defconfig linux-2.5.38-s390/arch/s390/defconfig
@@ -50,6 +50,7 @@
 #
 # Misc
 #
+# CONFIG_PREEMPT is not set
 CONFIG_IPL=y
 # CONFIG_IPL_TAPE is not set
 CONFIG_IPL_VM=y
arch/s390/kernel/entry.S +98 -72

267 lines not on this page · raw message

arch/s390x/config.in +1 -0
diff -urN linux-2.5.38/arch/s390x/config.in linux-2.5.38-s390/arch/s390x/config.in
@@ -33,6 +33,7 @@
 fi
 
 comment 'Misc'
+bool 'Preemptible Kernel' CONFIG_PREEMPT
 bool 'Builtin IPL record support' CONFIG_IPL
 if [ "$CONFIG_IPL" = "y" ]; then
   choice 'IPL method generated into head.S' \
arch/s390x/defconfig +1 -0
diff -urN linux-2.5.38/arch/s390x/defconfig linux-2.5.38-s390/arch/s390x/defconfig
@@ -51,6 +51,7 @@
 #
 # Misc
 #
+# CONFIG_PREEMPT is not set
 CONFIG_IPL=y
 # CONFIG_IPL_TAPE is not set
 CONFIG_IPL_VM=y
arch/s390x/kernel/entry.S +93 -58

228 lines not on this page · raw message

include/asm-s390/hardirq.h +9 -3
diff -urN linux-2.5.38/include/asm-s390/hardirq.h linux-2.5.38-s390/include/asm-s390/hardirq.h
@@ -80,15 +80,21 @@
 
 extern void do_call_softirq(void);
 
-#define in_atomic()	(preempt_count() != 0)
-#define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
+#if CONFIG_PREEMPT
+# define in_atomic()	(in_interrupt() || preempt_count() == PREEMPT_ACTIVE)
+# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+#else
+# define in_atomic()	(preempt_count() != 0)
+# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
+#endif
 
 #define irq_exit()							\
 do {									\
-	preempt_count() -= HARDIRQ_OFFSET;				\
+	preempt_count() -= IRQ_EXIT_OFFSET;				\
 	if (!in_interrupt() && softirq_pending(smp_processor_id()))	\
 		/* Use the async. stack for softirq */			\
 		do_call_softirq();					\
+	preempt_enable_no_resched();					\
 } while (0)
 
 #ifndef CONFIG_SMP
include/asm-s390/softirq.h +2 -0
diff -urN linux-2.5.38/include/asm-s390/softirq.h linux-2.5.38-s390/include/asm-s390/softirq.h
@@ -10,6 +10,7 @@
 #define __ASM_SOFTIRQ_H
 
 #include <linux/smp.h>
+#include <linux/preempt.h>
 
 #include <asm/atomic.h>
 #include <asm/hardirq.h>
@@ -28,6 +29,7 @@
 	if (!in_interrupt() && softirq_pending(smp_processor_id()))	\
 		/* Use the async. stack for softirq */			\
 		do_call_softirq();					\
+	preempt_check_resched();					\
 } while (0)
 
 #endif	/* __ASM_SOFTIRQ_H */
include/asm-s390/thread_info.h +3 -3
diff -urN linux-2.5.38/include/asm-s390/thread_info.h linux-2.5.38-s390/include/asm-s390/thread_info.h
@@ -25,11 +25,9 @@
 	struct exec_domain	*exec_domain;	/* execution domain */
 	unsigned long		flags;		/* low level flags */
 	unsigned int		cpu;		/* current CPU */
-	int			preempt_count; /* 0 => preemptable, <0 => BUG */
+	unsigned int		preempt_count; /* 0 => preemptable */
 };
 
-#define PREEMPT_ACTIVE		0x4000000
-
 /*
  * macros/functions for gaining access to the thread information structure
  */
@@ -84,4 +82,6 @@
 
 #endif /* __KERNEL__ */
 
+#define PREEMPT_ACTIVE		0x4000000
+
 #endif /* _ASM_THREAD_INFO_H */
include/asm-s390x/hardirq.h +9 -3
diff -urN linux-2.5.38/include/asm-s390x/hardirq.h linux-2.5.38-s390/include/asm-s390x/hardirq.h
@@ -81,15 +81,21 @@
 
 extern void do_call_softirq(void);
 
-#define in_atomic()	(preempt_count() != 0)
-#define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
+#if CONFIG_PREEMPT
+# define in_atomic()	(in_interrupt() || preempt_count() == PREEMPT_ACTIVE)
+# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+#else
+# define in_atomic()	(preempt_count() != 0)
+# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
+#endif
 
 #define irq_exit()							\
 do {									\
-	preempt_count() -= HARDIRQ_OFFSET;				\
+	preempt_count() -= IRQ_EXIT_OFFSET;				\
 	if (!in_interrupt() && softirq_pending(smp_processor_id()))	\
 		/* Use the async. stack for softirq */			\
 		do_call_softirq();					\
+	preempt_enable_no_resched();					\
 } while (0)
 
 #ifndef CONFIG_SMP
include/asm-s390x/thread_info.h +3 -3
diff -urN linux-2.5.38/include/asm-s390x/thread_info.h linux-2.5.38-s390/include/asm-s390x/thread_info.h
@@ -25,11 +25,9 @@
 	struct exec_domain	*exec_domain;	/* execution domain */
 	unsigned long		flags;		/* low level flags */
 	unsigned int		cpu;		/* current CPU */
-	int 			preempt_count; /* 0 => preemptable, <0 => BUG */
+	unsigned int		preempt_count;  /* 0 => preemptable */
 };
 
-#define PREEMPT_ACTIVE		0x4000000
-
 /*
  * macros/functions for gaining access to the thread information structure
  */
@@ -84,4 +82,6 @@
 
 #endif /* __KERNEL__ */
 
+#define PREEMPT_ACTIVE		0x4000000
+
 #endif /* _ASM_THREAD_INFO_H */