Skip to contentSkip to conversation

irq_enter/irq_exit consolidation

PATCH Martin Schwidefsky 2 participants 2 messages Sep 13, 2004 – Sep 14, 2004 s390

lore
Share & tools
lore
#0 lore raw

Hi Christoph,

Quoted 7 lines

s390 has an assembly wrapper around do_softirq.

I've extended the invoke_softirq mechanism used by s390 (also called by ksoftirqd) to the two arm variants, but the right thing to do is probably to use the normal do_softirq call in arm and set __ARCH_HAS_DO_SOFTIRQ + providing a per-arch do_softirq for all callers for s390 and maybe arm26.

do_call_softirq switches to the asynchronous interrupt stack, just what i386 does now as well. Trouble is that on s390 it is non-trivial to do the switch in C with inline assembly. We need a bit of assembly. But we could get rid of invoke_softirq, define __ARCH_HAS_DO_SOFTIRQ and use do_softirq to call the assembly wrapper.

blue skies,
Martin.

---

From: Martin Schwidefsky <[email protected]>

Replace invoke_softirq mechanism by __ARCH_HAS_DO_SOFTIRQ mechanism for s390.

diffstat:

 arch/s390/kernel/entry.S      |    4 +---
 arch/s390/kernel/entry64.S    |    4 +---
 arch/s390/kernel/s390_ext.c   |    1 +
 arch/s390/kernel/s390_ksyms.c |    1 -
 arch/s390/kernel/setup.c      |   20 ++++++++++++++++++++
 include/asm-s390/hardirq.h    |    3 +--
 6 files changed, 24 insertions(+), 9 deletions(-)
arch/s390/kernel/entry64.S +1 -3
diff -urN linux-2.6/arch/s390/kernel/entry64.S linux-2.6-s390/arch/s390/kernel/entry64.S
@@ -153,7 +153,6 @@
  */
 	.global do_call_softirq
 do_call_softirq:
-	stnsm	__SF_EMPTY(%r15),0xfc
 	stmg	%r12,%r15,__SF_GPRS(%r15)
 	lgr	%r12,%r15
 	lg	%r0,__LC_ASYNC_STACK
@@ -163,9 +162,8 @@
 	lg	%r15,__LC_ASYNC_STACK
 0:	aghi	%r15,-STACK_FRAME_OVERHEAD
 	stg	%r12,__SF_BACKCHAIN(%r15)	# store back chain
-	brasl	%r14,do_softirq
+	brasl	%r14,__do_softirq
 	lmg	%r12,%r15,__SF_GPRS(%r12)
-	ssm	__SF_EMPTY(%r15)
 	br	%r14
 
 __critical_start:
arch/s390/kernel/entry.S +1 -3
diff -urN linux-2.6/arch/s390/kernel/entry.S linux-2.6-s390/arch/s390/kernel/entry.S
@@ -156,7 +156,6 @@
  */
 	.global do_call_softirq
 do_call_softirq:
-	stnsm	__SF_EMPTY(%r15),0xfc
 	stm	%r12,%r15,__SF_GPRS(%r15)
 	lr	%r12,%r15
         basr    %r13,0
@@ -171,7 +170,6 @@
 	l	%r1,.Ldo_softirq-do_call_base(%r13)
 	basr	%r14,%r1
 	lm	%r12,%r15,__SF_GPRS(%r12)
-	ssm	__SF_EMPTY(%r15)
 	br	%r14
 
 __critical_start:
@@ -733,7 +731,7 @@
 .Ldo_IRQ:      .long  do_IRQ
 .Ldo_extint:   .long  do_extint
 .Ldo_signal:   .long  do_signal
-.Ldo_softirq:  .long  do_softirq
+.Ldo_softirq:  .long  __do_softirq
 .Lhandle_per:  .long  do_single_step
 .Ljump_table:  .long  pgm_check_table
 .Lschedule:    .long  schedule
arch/s390/kernel/s390_ext.c +1 -0
diff -urN linux-2.6/arch/s390/kernel/s390_ext.c linux-2.6-s390/arch/s390/kernel/s390_ext.c
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/kernel_stat.h>
+#include <linux/interrupt.h>
 
 #include <asm/lowcore.h>
 #include <asm/s390_ext.h>
arch/s390/kernel/s390_ksyms.c +0 -1
diff -urN linux-2.6/arch/s390/kernel/s390_ksyms.c linux-2.6-s390/arch/s390/kernel/s390_ksyms.c
@@ -61,6 +61,5 @@
 EXPORT_SYMBOL(console_mode);
 EXPORT_SYMBOL(console_devno);
 EXPORT_SYMBOL(console_irq);
-EXPORT_SYMBOL(do_call_softirq);
 EXPORT_SYMBOL(sys_wait4);
 EXPORT_SYMBOL(cpcmd);
arch/s390/kernel/setup.c +20 -0
diff -urN linux-2.6/arch/s390/kernel/setup.c linux-2.6-s390/arch/s390/kernel/setup.c
@@ -654,3 +654,23 @@
 {
 	/* nothing... */
 }
+
+extern void do_call_softirq(void);
+
+asmlinkage void do_softirq(void)
+{
+	unsigned long flags;
+
+	if (in_interrupt())
+		return;
+
+	local_irq_save(flags);
+
+	if (local_softirq_pending())
+		/* Call __do_softirq on asynchromous interrupt stack. */
+		do_call_softirq();
+
+	local_irq_restore(flags);
+}
+
+EXPORT_SYMBOL(do_softirq);
include/asm-s390/hardirq.h +1 -2
diff -urN linux-2.6/include/asm-s390/hardirq.h linux-2.6-s390/include/asm-s390/hardirq.h
@@ -61,9 +61,8 @@
 #define SOFTIRQ_SHIFT	(PREEMPT_SHIFT + PREEMPT_BITS)
 #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
 
-extern void do_call_softirq(void);
 extern void account_ticks(struct pt_regs *);
 
-#define invoke_softirq() do_call_softirq()
+#define __ARCH_HAS_DO_SOFTIRQ
 
 #endif /* __ASM_HARDIRQ_H */
#1 lore raw
Quoted 10 lines · Martin Schwidefsky

Hi Christoph,

Quoted 7 lines

s390 has an assembly wrapper around do_softirq.

I've extended the invoke_softirq mechanism used by s390 (also called by ksoftirqd) to the two arm variants, but the right thing to do is probably to use the normal do_softirq call in arm and set __ARCH_HAS_DO_SOFTIRQ + providing a per-arch do_softirq for all callers for s390 and maybe arm26.

Quoted 6 lines

do_call_softirq switches to the asynchronous interrupt stack, just what i386 does now as well. Trouble is that on s390 it is non-trivial to do the switch in C with inline assembly. We need a bit of assembly. But we could get rid of invoke_softirq, define __ARCH_HAS_DO_SOFTIRQ and use do_softirq to call the assembly wrapper.

Well, the question is do you want the direct do_softirq invocations from the networking code use the separate stack or not? If not the current code is fine. If yes you should sent the patch to Andrew.