ARM softirqs
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Andrea Arcangeli
On Wed, Aug 29, 2001 at 05:25:34PM +0200, Andrea Arcangeli wrote:
How does this look? (untested, I will test it later together with a dozen of other changes)btw, a number of other archs was buggy the same way as arm or it will benefit by this change the same way as arm.
I will send to Linus after it is tested.
Linus please include this patch in next kernel. In short Russell pointed out that the risc port aren't handy in implementing a very lightweight set bit atomic with respect to interrupts (so only atomic with respect to the local cpu) because they are missing an "or" or "bit set" instruction between a register and memory.
Having __cpu_raise_softirq atomic against interrupts only allows us to re-enable irqs a few cycles before, so it's only a micro irq latency optimization, it doesn't save cpu cycles so it doesn't worth to hurt the risc chips for it.
Now both cpu_raise_softirq and __cpu_raise_softirq must be recalled with irq disabled, only raise_softirq can be called in whatever irq state.
include/asm-alpha/softirq.h +0 -2
@@ -32,6 +32,4 @@#define in_softirq () (local_bh_count(smp_processor_id()) != 0) -#define __cpu_raise_softirq (cpu, nr) set_bit(nr, &softirq_pending(cpu)) -#endif /* _ALPHA_SOFTIRQ_H */
include/asm-arm/softirq.h +0 -2
@@ -21,6 +21,4 @@ __asm__("bl%? __do_softirq" : : :"lr" );/* out of line */ \ } while (0) -#define __cpu_raise_softirq (cpu, nr) __set_bit(nr, &softirq_pending(cpu)) -#endif /* __ASM_SOFTIRQ_H */
include/asm-cris/softirq.h +0 -2
@@ -27,6 +27,4 @@#define in_softirq () (local_bh_count(smp_processor_id()) != 0) -#define __cpu_raise_softirq (cpu,nr) set_bit((nr), &softirq_pending(cpu)) -#endif /* __ASM_SOFTIRQ_H */
include/asm-i386/softirq.h +0 -2
@@ -45,6 +45,4 @@ /* no registers clobbered */ ); \ } while (0) -#define __cpu_raise_softirq (cpu, nr) __set_bit(nr, &softirq_pending(cpu)) -#endif /* __ASM_SOFTIRQ_H */
include/asm-ia64/softirq.h +0 -2
@@ -18,8 +18,6 @@ } while (0) -#define __cpu_raise_softirq (cpu,nr) set_bit((nr), &softirq_pending(cpu)) -#define in_softirq () (local_bh_count() != 0)#endif /* _ASM_IA64_SOFTIRQ_H */
include/asm-ppc/softirq.h +0 -2
@@ -28,8 +28,6 @@ } \ } while (0) -#define __cpu_raise_softirq (cpu, nr) set_bit((nr), &softirq_pending(cpu)); -#define in_softirq () (local_bh_count(smp_processor_id()) != 0)#endif /* __ASM_SOFTIRQ_H */
include/asm-s390/softirq.h +0 -2
@@ -36,8 +36,6 @@do_softirq (); \ } while (0) -#define __cpu_raise_softirq (cpu, nr) (softirq_pending(cpu) |= (1<<nr)) -#endif /* __ASM_SOFTIRQ_H */
include/asm-s390x/softirq.h +0 -2
@@ -36,8 +36,6 @@do_softirq (); \ } while (0) -#define __cpu_raise_softirq (cpu, nr) (softirq_pending(cpu) |= (1<<nr)) -#endif /* __ASM_SOFTIRQ_H */
include/asm-sh/softirq.h +0 -2
@@ -25,8 +25,6 @@ } \ } while (0) -#define __cpu_raise_softirq (cpu, nr) set_bit((nr), &softirq_pending(cpu)); -#define in_softirq () (local_bh_count(smp_processor_id()) != 0)#endif /* __ASM_SH_SOFTIRQ_H */
include/asm-sparc/softirq.h +0 -7
@@ -22,13 +22,6 @@ __sti(); \ } \ } while (0) -#define __do_cpu_raise_softirq (cpu, nr) (softirq_pending(cpu) |= (1<<nr)) -#define __cpu_raise_softirq (cpu, nr) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - __do_cpu_raise_softirq(cpu, nr); \ - local_irq_restore(flags); \ -} while (0)#define in_softirq () (local_bh_count(smp_processor_id()) != 0)#endif /* __SPARC_SOFTIRQ_H */
include/asm-sparc64/softirq.h +0 -7
@@ -20,13 +20,6 @@ } \ } while (0) -#define __do_cpu_raise_softirq (cpu, nr) (softirq_pending(cpu) |= (1<<nr)) -#define __cpu_raise_softirq (cpu,nr) \ -do { unsigned long flags; \ - local_irq_save(flags); \ - __do_cpu_raise_softirq(cpu, nr); \ - local_irq_restore(flags); \ -} while (0)#define in_softirq () (local_bh_count(smp_processor_id()) != 0)#endif /* !(__SPARC64_SOFTIRQ_H) */
include/linux/interrupt.h +1 -0
@@ -74,6 +74,7 @@ asmlinkage void do_softirq(void);extern void open_softirq (int nr,void (*action)(struct softirq_action *),void *data);extern void softirq_init (void ); +#define __cpu_raise_softirq (cpu, nr) do { softirq_pending(cpu) |= 1UL << (nr); } while (0)extern void FASTCALL (cpu_raise_softirq (unsigned int cpu,unsigned int nr));extern void FASTCALL (raise_softirq (unsigned int nr));
kernel/softirq.c +9 -2
@@ -108,6 +108,9 @@local_irq_restore (flags); } +/* +* This function must run with irq disabled! +*/ inline void cpu_raise_softirq (unsigned int cpu,unsigned int nr) {__cpu_raise_softirq (cpu, nr);
@@ -127,7 +130,11 @@void raise_softirq (unsigned int nr) { +long flags; + +local_irq_save (flags);cpu_raise_softirq (smp_processor_id (), nr); +local_irq_restore (flags); }void open_softirq (int nr,void (*action)(struct softirq_action *),void *data)
@@ -195,8 +202,8 @@local_irq_disable (); t->next = tasklet_vec[cpu].list; tasklet_vec[cpu].list = t; -local_irq_enable ();__cpu_raise_softirq (cpu,TASKLET_SOFTIRQ ); +local_irq_enable (); } }
@@ -229,8 +236,8 @@local_irq_disable (); t->next = tasklet_hi_vec[cpu].list; tasklet_hi_vec[cpu].list = t; -local_irq_enable ();__cpu_raise_softirq (cpu,HI_SOFTIRQ ); +local_irq_enable (); } }
net/core/dev.c +2 -4
@@ -1217,10 +1217,9 @@ enqueue:dev_hold (skb->dev);__skb_queue_tail (&queue->input_pkt_queue,skb); -local_irq_restore (flags); -/* Runs from irqs or BH's, no need to wake BH */ __cpu_raise_softirq (this_cpu,NET_RX_SOFTIRQ ); +local_irq_restore (flags);#ifndef OFFLINE_SAMPLE get_sample_stats (this_cpu);#endif
@@ -1529,10 +1528,9 @@local_irq_disable (); netdev_rx_stat[this_cpu].time_squeeze++; -local_irq_enable (); -/* This already runs in BH context, no need to wake up BH's */ __cpu_raise_softirq (this_cpu,NET_RX_SOFTIRQ ); +local_irq_enable ();NET_PROFILE_LEAVE (softnet_process);return ;
Andrea